Skip to content

Commit ab06fa2

Browse files
committed
update setting nodeSelector and tolearations for NATS (#6886)
1 parent f4dbad4 commit ab06fa2

File tree

6 files changed

+57
-10
lines changed

6 files changed

+57
-10
lines changed

k8s/helm/testkube/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
repository: oci://us-east1-docker.pkg.dev/testkube-cloud-372110/testkube
1919
- name: nats
2020
condition: testkube-api.nats.enabled
21-
version: 1.2.6-3
21+
version: 1.2.6-4
2222
repository: "file://./charts/nats"
2323
- name: testkube-api
2424
version: 2.x.x-x

k8s/helm/testkube/charts/nats/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords:
66
- nats
77
- messaging
88
- cncf
9-
version: 1.2.6-3
9+
version: 1.2.6-4
1010
home: http://github.com/nats-io/k8s
1111
maintainers:
1212

k8s/helm/testkube/charts/nats/files/stateful-set/pod-template.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,10 @@ spec:
7575
{{- end}}
7676

7777
securityContext:
78-
{{- include "nats.podSecurityContext" $ | nindent 6 }}
78+
{{- include "nats.podSecurityContext" $ | nindent 6 }}
79+
nodeSelector:
80+
{{- include "nats.nodeSelector" . | indent 4 }}
81+
affinity:
82+
{{- include "nats.affinity" . | indent 4 }}
83+
tolerations:
84+
{{- include "nats.tolerations" . | indent 4 }}

k8s/helm/testkube/charts/nats/templates/_helpers.tpl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,37 @@ Define containerSecurityContext
301301
{{- else }}
302302
{{- toYaml .Values.containerSecurityContext }}
303303
{{- end }}
304+
{{- end }}
305+
306+
{{/*
307+
Define tolerations
308+
*/}}
309+
{{- define "nats.tolerations" -}}
310+
{{- if .Values.global.tolerations }}
311+
{{ toYaml .Values.global.tolerations }}
312+
{{- else }}
313+
{{ toYaml .Values.tolerations }}
314+
{{- end }}
315+
{{- end }}
316+
317+
{{/*
318+
Define affinity
319+
*/}}
320+
{{- define "nats.affinity" -}}
321+
{{- if .Values.global.affinity }}
322+
{{ toYaml .Values.global.affinity }}
323+
{{- else }}
324+
{{ toYaml .Values.affinity }}
325+
{{- end }}
326+
{{- end }}
327+
328+
{{/*
329+
Define nodeSelector
330+
*/}}
331+
{{- define "nats.nodeSelector" -}}
332+
{{- if .Values.global.nodeSelector }}
333+
{{ toYaml .Values.global.nodeSelector }}
334+
{{- else }}
335+
{{ toYaml .Values.nodeSelector }}
336+
{{- end }}
304337
{{- end }}

k8s/helm/testkube/charts/nats/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ global:
1515
# can be overridden by individual image registry
1616
registry:
1717

18+
# -- Global Tolerations
19+
tolerations: []
20+
# -- Global NodeSelector
21+
nodeSelector: {}
22+
# -- Global Affinity
23+
affinity: {}
24+
1825
# global labels will be applied to all resources deployed by the chart
1926
labels: {}
2027
# -- Security Context for all pods

k8s/helm/testkube/values.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ postgresql:
262262
pullSecrets: []
263263

264264
## NATS chart parameter
265-
## Tolerations to schedule a workload to nodes with any architecture type. Required for deployment to GKE cluster.
266-
## More info: https://cloud.google.com/kubernetes-engine/docs/how-to/prepare-arm-workloads-for-deployment#node-affinity-multi-arch-arm
267265
nats:
268266
# -- Uncomment to pass a global registry name to all NATS images
269267
# global:
@@ -276,12 +274,15 @@ nats:
276274
# tag: 2.11.6-alpine
277275
# pullPolicy:
278276
# registry:
277+
# Example of setting nodeSelector and tolerations
278+
# nodeSelector:
279+
# workload-type: infra
280+
# tolerations:
281+
# - effect: NoSchedule
282+
# key: workload-type
283+
# operator: Equal
284+
# value: infra
279285
# NATS Box container settings
280-
# TODO remove this container after tests on dev and stage
281-
# nats-box is A lightweight container with NATS utilities. It's not needed for nats server
282-
# change it to
283-
# natsBox:
284-
# enabled: false
285286
natsBox:
286287
enabled: false
287288
# -- Uncomment to override the NATS Box image options

0 commit comments

Comments
 (0)