Skip to content

Commit 107e88f

Browse files
committed
*: add node selector for ALB/NLB add-ons
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
1 parent e1e3df6 commit 107e88f

File tree

9 files changed

+104
-50
lines changed

9 files changed

+104
-50
lines changed

CHANGELOG/CHANGELOG-1.2.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
See [code changes](https://github.com/aws/aws-k8s-tester/compare/v1.2.2...v1.2.3).
99

10+
### `eks`
11+
12+
- `eks/nlb-hello-world` uses [`AddOnNLBHelloWorld.DeploymentNodeSelector` to overwrite node selector](https://github.com/aws/aws-k8s-tester/commit/).
13+
- `eks/alb-2048` uses [`AddOnALB2048.DeploymentNodeSelector2048` to overwrite node selector](https://github.com/aws/aws-k8s-tester/commit/).
14+
15+
### `eksconfig`
16+
17+
- Add [optional `AddOnNLBHelloWorld.DeploymentNodeSelector`](https://github.com/aws/aws-k8s-tester/commit/).
18+
- `AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR`.
19+
- Add [optional `AddOnALB2048.DeploymentNodeSelector2048`](https://github.com/aws/aws-k8s-tester/commit/).
20+
- `AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_NODE_SELECTOR_2048`.
21+
1022
### Dependency
1123

1224
- Upgrade [`github.com/kubernetes/client-go`](https://github.com/kubernetes/client-go/releases) from [`v0.18.2`](https://github.com/kubernetes/clienthttps://github.com/kubernetes/client-go/releases/tag/v0.18.2) to [`v0.18.3`](https://github.com/kubernetes/client-go/releases/tag/v0.18.3).

eks/alb-2048/alb-2048.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,18 @@ func (ts *tester) createALBDeployment() error {
476476
// TODO: test in MNG
477477
ngType = "custom"
478478
}
479+
nodeSelector := map[string]string{
480+
// do not deploy in bottlerocket; PVC not working
481+
// do not mix with MNG
482+
// controller "msg"="Reconciler error" "error"="no object matching key \"eks-2020042119-bluee7qmz7kb-alb-2048/alb-2048-ingress\" in local store" "controller"="alb-ingress-controller" "request"={"Namespace":"eks-2020042119-bluee7qmz7kb-alb-2048","Name":"alb-2048-ingress"}
483+
"AMIType": ec2config.AMITypeAL2X8664,
484+
"NGType": ngType,
485+
}
486+
if len(ts.cfg.EKSConfig.AddOnALB2048.DeploymentNodeSelector2048) > 0 {
487+
nodeSelector = ts.cfg.EKSConfig.AddOnALB2048.DeploymentNodeSelector2048
488+
}
479489

480-
ts.cfg.Logger.Info("creating ALB Ingress Controller Deployment")
490+
ts.cfg.Logger.Info("creating ALB Ingress Controller Deployment", zap.Any("node-selector", nodeSelector))
481491
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
482492
_, err := ts.cfg.K8SClient.KubernetesClientSet().
483493
AppsV1().
@@ -525,13 +535,7 @@ func (ts *tester) createALBDeployment() error {
525535
},
526536
},
527537
ServiceAccountName: albIngressControllerServiceAccountName,
528-
NodeSelector: map[string]string{
529-
// do not deploy in bottlerocket; PVC not working
530-
// do not mix with MNG
531-
// controller "msg"="Reconciler error" "error"="no object matching key \"eks-2020042119-bluee7qmz7kb-alb-2048/alb-2048-ingress\" in local store" "controller"="alb-ingress-controller" "request"={"Namespace":"eks-2020042119-bluee7qmz7kb-alb-2048","Name":"alb-2048-ingress"}
532-
"AMIType": ec2config.AMITypeAL2X8664,
533-
"NGType": ngType,
534-
},
538+
NodeSelector: nodeSelector,
535539
},
536540
},
537541
},

eks/nlb-hello-world/nlb-hello-world.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@ func (ts *tester) Delete() error {
160160
}
161161

162162
func (ts *tester) createDeployment() error {
163-
ts.cfg.Logger.Info("creating NLB hello-world Deployment")
163+
var nodeSelector map[string]string
164+
if len(ts.cfg.EKSConfig.AddOnNLBHelloWorld.DeploymentNodeSelector) > 0 {
165+
nodeSelector = ts.cfg.EKSConfig.AddOnNLBHelloWorld.DeploymentNodeSelector
166+
} else {
167+
nodeSelector = nil
168+
}
169+
ts.cfg.Logger.Info("creating NLB hello-world Deployment", zap.Any("node-selector", nodeSelector))
164170
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
165171
_, err := ts.cfg.K8SClient.KubernetesClientSet().
166172
AppsV1().
@@ -206,6 +212,7 @@ func (ts *tester) createDeployment() error {
206212
},
207213
},
208214
},
215+
NodeSelector: nodeSelector,
209216
},
210217
},
211218
},

eksconfig/README.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -213,39 +213,41 @@ AWS_K8S_TESTER_EKS_ADD_ON_CONFORMANCE_ENABLE=true \
213213
*----------------------------------------------------------------------*-------------------*--------------------------------------------------------*---------------*
214214
215215
216-
*---------------------------------------------------------------*-------------------*--------------------------------------------------*---------------*
217-
| ENVIRONMENTAL VARIABLE | READ ONLY | TYPE | GO TYPE |
218-
*---------------------------------------------------------------*-------------------*--------------------------------------------------*---------------*
219-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_ENABLE | read-only "false" | *eksconfig.AddOnNLBHelloWorld.Enable | bool |
220-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATED | read-only "true" | *eksconfig.AddOnNLBHelloWorld.Created | bool |
221-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATE_TOOK | read-only "true" | *eksconfig.AddOnNLBHelloWorld.CreateTook | time.Duration |
222-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATE_TOOK_STRING | read-only "true" | *eksconfig.AddOnNLBHelloWorld.CreateTookString | string |
223-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DELETE_TOOK | read-only "true" | *eksconfig.AddOnNLBHelloWorld.DeleteTook | time.Duration |
224-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DELETE_TOOK_STRING | read-only "true" | *eksconfig.AddOnNLBHelloWorld.DeleteTookString | string |
225-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NAMESPACE | read-only "false" | *eksconfig.AddOnNLBHelloWorld.Namespace | string |
226-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_REPLICAS | read-only "false" | *eksconfig.AddOnNLBHelloWorld.DeploymentReplicas | int32 |
227-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NLB_ARN | read-only "true" | *eksconfig.AddOnNLBHelloWorld.NLBARN | string |
228-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NLB_NAME | read-only "true" | *eksconfig.AddOnNLBHelloWorld.NLBName | string |
229-
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_URL | read-only "true" | *eksconfig.AddOnNLBHelloWorld.URL | string |
230-
*---------------------------------------------------------------*-------------------*--------------------------------------------------*---------------*
231-
232-
233-
*-------------------------------------------------------------*-------------------*------------------------------------------------*---------------*
234-
| ENVIRONMENTAL VARIABLE | READ ONLY | TYPE | GO TYPE |
235-
*-------------------------------------------------------------*-------------------*------------------------------------------------*---------------*
236-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ENABLE | read-only "false" | *eksconfig.AddOnALB2048.Enable | bool |
237-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATED | read-only "true" | *eksconfig.AddOnALB2048.Created | bool |
238-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATE_TOOK | read-only "true" | *eksconfig.AddOnALB2048.CreateTook | time.Duration |
239-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATE_TOOK_STRING | read-only "true" | *eksconfig.AddOnALB2048.CreateTookString | string |
240-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DELETE_TOOK | read-only "true" | *eksconfig.AddOnALB2048.DeleteTook | time.Duration |
241-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DELETE_TOOK_STRING | read-only "true" | *eksconfig.AddOnALB2048.DeleteTookString | string |
242-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_NAMESPACE | read-only "false" | *eksconfig.AddOnALB2048.Namespace | string |
243-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_REPLICAS_ALB | read-only "false" | *eksconfig.AddOnALB2048.DeploymentReplicasALB | int32 |
244-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_REPLICAS_2048 | read-only "false" | *eksconfig.AddOnALB2048.DeploymentReplicas2048 | int32 |
245-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ALB_ARN | read-only "true" | *eksconfig.AddOnALB2048.ALBARN | string |
246-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ALB_NAME | read-only "true" | *eksconfig.AddOnALB2048.ALBName | string |
247-
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_URL | read-only "true" | *eksconfig.AddOnALB2048.URL | string |
248-
*-------------------------------------------------------------*-------------------*------------------------------------------------*---------------*
216+
*--------------------------------------------------------------------*-------------------*------------------------------------------------------*-------------------*
217+
| ENVIRONMENTAL VARIABLE | READ ONLY | TYPE | GO TYPE |
218+
*--------------------------------------------------------------------*-------------------*------------------------------------------------------*-------------------*
219+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_ENABLE | read-only "false" | *eksconfig.AddOnNLBHelloWorld.Enable | bool |
220+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATED | read-only "true" | *eksconfig.AddOnNLBHelloWorld.Created | bool |
221+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATE_TOOK | read-only "true" | *eksconfig.AddOnNLBHelloWorld.CreateTook | time.Duration |
222+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_CREATE_TOOK_STRING | read-only "true" | *eksconfig.AddOnNLBHelloWorld.CreateTookString | string |
223+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DELETE_TOOK | read-only "true" | *eksconfig.AddOnNLBHelloWorld.DeleteTook | time.Duration |
224+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DELETE_TOOK_STRING | read-only "true" | *eksconfig.AddOnNLBHelloWorld.DeleteTookString | string |
225+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NAMESPACE | read-only "false" | *eksconfig.AddOnNLBHelloWorld.Namespace | string |
226+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_REPLICAS | read-only "false" | *eksconfig.AddOnNLBHelloWorld.DeploymentReplicas | int32 |
227+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR | read-only "false" | *eksconfig.AddOnNLBHelloWorld.DeploymentNodeSelector | map[string]string |
228+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NLB_ARN | read-only "true" | *eksconfig.AddOnNLBHelloWorld.NLBARN | string |
229+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NLB_NAME | read-only "true" | *eksconfig.AddOnNLBHelloWorld.NLBName | string |
230+
| AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_URL | read-only "true" | *eksconfig.AddOnNLBHelloWorld.URL | string |
231+
*--------------------------------------------------------------------*-------------------*------------------------------------------------------*-------------------*
232+
233+
234+
*------------------------------------------------------------------*-------------------*----------------------------------------------------*-------------------*
235+
| ENVIRONMENTAL VARIABLE | READ ONLY | TYPE | GO TYPE |
236+
*------------------------------------------------------------------*-------------------*----------------------------------------------------*-------------------*
237+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ENABLE | read-only "false" | *eksconfig.AddOnALB2048.Enable | bool |
238+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATED | read-only "true" | *eksconfig.AddOnALB2048.Created | bool |
239+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATE_TOOK | read-only "true" | *eksconfig.AddOnALB2048.CreateTook | time.Duration |
240+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_CREATE_TOOK_STRING | read-only "true" | *eksconfig.AddOnALB2048.CreateTookString | string |
241+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DELETE_TOOK | read-only "true" | *eksconfig.AddOnALB2048.DeleteTook | time.Duration |
242+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DELETE_TOOK_STRING | read-only "true" | *eksconfig.AddOnALB2048.DeleteTookString | string |
243+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_NAMESPACE | read-only "false" | *eksconfig.AddOnALB2048.Namespace | string |
244+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_REPLICAS_ALB | read-only "false" | *eksconfig.AddOnALB2048.DeploymentReplicasALB | int32 |
245+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_REPLICAS_2048 | read-only "false" | *eksconfig.AddOnALB2048.DeploymentReplicas2048 | int32 |
246+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_NODE_SELECTOR_2048 | read-only "false" | *eksconfig.AddOnALB2048.DeploymentNodeSelector2048 | map[string]string |
247+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ALB_ARN | read-only "true" | *eksconfig.AddOnALB2048.ALBARN | string |
248+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ALB_NAME | read-only "true" | *eksconfig.AddOnALB2048.ALBName | string |
249+
| AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_URL | read-only "true" | *eksconfig.AddOnALB2048.URL | string |
250+
*------------------------------------------------------------------*-------------------*----------------------------------------------------*-------------------*
249251
250252
251253
*------------------------------------------------------*-------------------*-----------------------------------------*---------------*

eksconfig/add-on-alb-2048.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ type AddOnALB2048 struct {
2929
DeploymentReplicasALB int32 `json:"deployment-replicas-alb"`
3030
// DeploymentReplicas2048 is the number of 2048 replicas to deploy using "Deployment" object.
3131
DeploymentReplicas2048 int32 `json:"deployment-replicas-2048"`
32+
// DeploymentNodeSelector2048 is configured to overwrite existing node selector
33+
// for ALB 2048 deployment. If left empty, tester sets default selector.
34+
DeploymentNodeSelector2048 map[string]string `json:"deployment-node-selector-2048"`
3235

3336
// ALBARN is the ARN of the ALB created from the service.
3437
ALBARN string `json:"alb-arn" read-only:"true"`
@@ -56,9 +59,10 @@ func (cfg *Config) IsEnabledAddOnALB2048() bool {
5659

5760
func getDefaultAddOnALB2048() *AddOnALB2048 {
5861
return &AddOnALB2048{
59-
Enable: false,
60-
DeploymentReplicasALB: 3,
61-
DeploymentReplicas2048: 3,
62+
Enable: false,
63+
DeploymentReplicasALB: 3,
64+
DeploymentReplicas2048: 3,
65+
DeploymentNodeSelector2048: make(map[string]string),
6266
}
6367
}
6468

eksconfig/add-on-nlb-hello-world.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ type AddOnNLBHelloWorld struct {
2727

2828
// DeploymentReplicas is the number of replicas to deploy using "Deployment" object.
2929
DeploymentReplicas int32 `json:"deployment-replicas"`
30+
// DeploymentNodeSelector is configured to overwrite existing node selector
31+
// for NLB hello world deployment. If left empty, tester sets default selector.
32+
DeploymentNodeSelector map[string]string `json:"deployment-node-selector"`
3033

3134
// NLBARN is the ARN of the NLB created from the service.
3235
NLBARN string `json:"nlb-arn" read-only:"true"`
@@ -54,8 +57,9 @@ func (cfg *Config) IsEnabledAddOnNLBHelloWorld() bool {
5457

5558
func getDefaultAddOnNLBHelloWorld() *AddOnNLBHelloWorld {
5659
return &AddOnNLBHelloWorld{
57-
Enable: false,
58-
DeploymentReplicas: 3,
60+
Enable: false,
61+
DeploymentReplicas: 3,
62+
DeploymentNodeSelector: make(map[string]string),
5963
}
6064
}
6165

eksconfig/default.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ log-level: info
2121
log-outputs:
2222
- stderr
2323
- /home/ANT.AMAZON.COM/leegyuho/go/src/github.com/aws/aws-k8s-tester/eksconfig/default.log
24-
name: eks-2020051713-bellevuerg76
24+
name: eks-2020052118-icymzmgqktdb
2525
on-failure-delete: true
2626
on-failure-delete-wait-seconds: 120
2727
parameters:
@@ -38,7 +38,7 @@ parameters:
3838
role-cfn-stack-id: ""
3939
role-create: true
4040
role-managed-policy-arns: null
41-
role-name: eks-2020051713-bellevuerg76-role
41+
role-name: eks-2020052118-icymzmgqktdb-role
4242
role-service-principals: null
4343
signing-name: eks
4444
tags: null
@@ -51,7 +51,7 @@ partition: aws
5151
region: us-west-2
5252
remote-access-commands-output-path: /home/ANT.AMAZON.COM/leegyuho/go/src/github.com/aws/aws-k8s-tester/eksconfig/default.ssh.sh
5353
remote-access-key-create: true
54-
remote-access-key-name: eks-2020051713-bellevuerg76-remote-access-key
54+
remote-access-key-name: eks-2020052118-icymzmgqktdb-remote-access-key
5555
remote-access-private-key-path: /home/ANT.AMAZON.COM/leegyuho/.ssh/kube_aws_rsa
5656
s3-bucket-create: false
5757
s3-bucket-create-keep: false

eksconfig/env.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,15 @@ func parseEnvs(pfx string, addOn interface{}) (interface{}, error) {
502502
vv.Field(i).SetMapIndex(reflect.ValueOf(fields[0]), reflect.ValueOf(fields[1]))
503503
}
504504

505+
case "DeploymentNodeSelector",
506+
"DeploymentNodeSelector2048":
507+
vv.Field(i).Set(reflect.ValueOf(make(map[string]string)))
508+
mm := make(map[string]string)
509+
if err := json.Unmarshal([]byte(sv), &mm); err != nil {
510+
return nil, fmt.Errorf("failed to parse %q (field name %q, environmental variable key %q, error %v)", sv, fieldName, env, err)
511+
}
512+
vv.Field(i).Set(reflect.ValueOf(mm))
513+
505514
case "ASGs":
506515
asgs := make(map[string]ASG)
507516
if err := json.Unmarshal([]byte(sv), &asgs); err != nil {

eksconfig/env_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ func TestEnv(t *testing.T) {
170170
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_REPLICAS")
171171
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NAMESPACE", "test-namespace")
172172
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_NAMESPACE")
173+
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR", `{"a":"b","c":"d"}`)
174+
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_NLB_HELLO_WORLD_DEPLOYMENT_NODE_SELECTOR")
173175

174176
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ENABLE", "true")
175177
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_ENABLE")
@@ -179,6 +181,8 @@ func TestEnv(t *testing.T) {
179181
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_REPLICAS_2048")
180182
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_NAMESPACE", "test-namespace")
181183
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_NAMESPACE")
184+
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_NODE_SELECTOR_2048", `{"1":"2","3":"4", "5":"6"}`)
185+
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_ALB_2048_DEPLOYMENT_NODE_SELECTOR_2048")
182186

183187
os.Setenv("AWS_K8S_TESTER_EKS_ADD_ON_JOBS_PI_ENABLE", "true")
184188
defer os.Unsetenv("AWS_K8S_TESTER_EKS_ADD_ON_JOBS_PI_ENABLE")
@@ -730,6 +734,10 @@ func TestEnv(t *testing.T) {
730734
if cfg.AddOnNLBHelloWorld.Namespace != "test-namespace" {
731735
t.Fatalf("unexpected cfg.AddOnNLBHelloWorld.Namespace %q", cfg.AddOnNLBHelloWorld.Namespace)
732736
}
737+
expectedNodeSelectorNLB := map[string]string{"a": "b", "c": "d"}
738+
if !reflect.DeepEqual(cfg.AddOnNLBHelloWorld.DeploymentNodeSelector, expectedNodeSelectorNLB) {
739+
t.Fatalf("unexpected cfg.AddOnNLBHelloWorld.DeploymentNodeSelector %v", cfg.AddOnNLBHelloWorld.DeploymentNodeSelector)
740+
}
733741

734742
if !cfg.AddOnALB2048.Enable {
735743
t.Fatalf("unexpected cfg.AddOnALB2048.Enable %v", cfg.AddOnALB2048.Enable)
@@ -743,6 +751,10 @@ func TestEnv(t *testing.T) {
743751
if cfg.AddOnALB2048.Namespace != "test-namespace" {
744752
t.Fatalf("unexpected cfg.AddOnALB2048.Namespace %q", cfg.AddOnALB2048.Namespace)
745753
}
754+
expectedNodeSelectorALB := map[string]string{"1": "2", "3": "4", "5": "6"}
755+
if !reflect.DeepEqual(cfg.AddOnALB2048.DeploymentNodeSelector2048, expectedNodeSelectorALB) {
756+
t.Fatalf("unexpected cfg.AddOnALB2048.DeploymentNodeSelector2048 %v", cfg.AddOnALB2048.DeploymentNodeSelector2048)
757+
}
746758

747759
if !cfg.AddOnJobsPi.Enable {
748760
t.Fatalf("unexpected cfg.AddOnJobsPi.Enable %v", cfg.AddOnJobsPi.Enable)

0 commit comments

Comments
 (0)