Skip to content

Commit 97715e3

Browse files
Add node affinity to kit substrate components (#178)
* Add node affinity to kit substrate components * Implement review comments
1 parent 1c951ea commit 97715e3

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

operator/charts/kit-operator/templates/controller/deployment.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,16 @@ spec:
2525
memory: 20Mi
2626
# https://github.com/aws/amazon-eks-pod-identity-webhook/issues/8#issuecomment-636888074
2727
securityContext:
28-
fsGroup: 1000
28+
fsGroup: 1000
29+
{{- with .Values.controller.nodeSelector }}
30+
nodeSelector:
31+
{{- toYaml . | nindent 8 }}
32+
{{- end }}
33+
{{- with .Values.controller.affinity }}
34+
affinity:
35+
{{- toYaml . | nindent 8 }}
36+
{{- end }}
37+
{{- with .Values.controller.tolerations }}
38+
tolerations:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}

operator/charts/kit-operator/templates/webhook/deployment.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,17 @@ spec:
4343
fieldPath: metadata.namespace
4444
# https://github.com/aws/amazon-eks-pod-identity-webhook/issues/8#issuecomment-636888074
4545
securityContext:
46-
fsGroup: 1000
46+
fsGroup: 1000
47+
{{- with .Values.webhook.nodeSelector }}
48+
nodeSelector:
49+
{{- toYaml . | nindent 8 }}
50+
{{- end }}
51+
{{- with .Values.webhook.affinity }}
52+
affinity:
53+
{{- toYaml . | nindent 8 }}
54+
{{- end }}
55+
{{- with .Values.webhook.tolerations }}
56+
tolerations:
57+
{{- toYaml . | nindent 8 }}
58+
{{- end }}
59+

operator/charts/kit-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ webhook:
1717
tolerations: []
1818
affinity: {}
1919
# TODO this will be updated by the git actions
20-
image: "public.ecr.aws/kit/kit-webhook:latest"
20+
image: "public.ecr.aws/kit/kit-webhook:latest"

substrate/pkg/controller/substrate/cluster/addons/kitoperator.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ func (l *KITOperator) Create(ctx context.Context, substrate *v1alpha1.Substrate)
3333
if err := helm.NewClient(*substrate.Status.Cluster.KubeConfig).Apply(ctx, &helm.Chart{
3434
Namespace: "kit",
3535
Name: "kit-operator",
36-
Repository: "https://github.com/awslabs/kubernetes-iteration-toolkit/releases/download/kit-operator-0.0.12",
37-
Version: "0.0.12",
36+
Repository: "https://github.com/awslabs/kubernetes-iteration-toolkit/releases/download/latest",
37+
Version: "latest",
3838
CreateNamespace: true,
39+
Values: map[string]interface{}{
40+
"controller": map[string]interface{}{"nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}},
41+
"webhook": map[string]interface{}{"nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}},
42+
},
3943
}); err != nil {
4044
return reconcile.Result{}, fmt.Errorf("applying chart, %w", err)
4145
}

substrate/pkg/controller/substrate/cluster/addons/prometheusstack.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ func (p *PrometheusStack) Create(ctx context.Context, substrate *v1alpha1.Substr
4444
"kubeApiServer": map[string]interface{}{"enabled": false},
4545
"kubeStateMetrics": map[string]interface{}{"enabled": false},
4646
"kubeControllerManager": map[string]interface{}{"enabled": false},
47-
"prometheus": map[string]interface{}{"serviceMonitor": map[string]interface{}{"selfMonitor": false}},
48-
"prometheusOperator": map[string]interface{}{"serviceMonitor": map[string]interface{}{"selfMonitor": false}},
47+
"prometheus": map[string]interface{}{"serviceMonitor": map[string]interface{}{"selfMonitor": false}, "prometheusSpec": map[string]interface{}{"nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}}},
48+
"prometheusOperator": map[string]interface{}{"serviceMonitor": map[string]interface{}{"selfMonitor": false}, "nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}},
49+
"grafana": map[string]interface{}{"nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}},
4950
},
5051
}); err != nil {
5152
return reconcile.Result{}, fmt.Errorf("applying chart, %w", err)

0 commit comments

Comments
 (0)