Skip to content

Added tolerations and nodeAffinity support #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions charts/helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,34 @@ imagePullSecrets:

{{- define "screaming-snakecase-release-name" -}}
{{- snakecase .Release.Name | replace " " "_" | replace "." "_" | replace "-" "_" | upper -}}
{{- end -}}

{{- define "tolerations" -}}
{{- if .Values.tolerations }}
tolerations:
{{- range .Values.tolerations }}
- key: "{{ .key }}"
operator: "{{ .operator }}"
value: "{{ .value }}"
effect: "{{ .effect }}"
{{- end }}
{{- end }}
{{- end -}}

{{- define "nodeAffinity" -}}
{{- if .Values.nodeAffinity }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
{{- range .Values.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms }}
- matchExpressions:
{{- range .matchExpressions }}
- key: {{ .key }}
operator: {{ .operator }}
values:
{{ toYaml .values }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}
2 changes: 2 additions & 0 deletions charts/helm-chart/templates/enterprise-server/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ spec:
annotations:
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
spec:
{{ include "tolerations" . | indent 6 }}
{{ include "nodeAffinity" . | indent 6 }}
{{ include "image-pull-secrets" . | indent 6 }}
serviceAccountName: {{ include "kebabcase-release-name" . }}-enterprise-server-service-account
securityContext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
{{ include "tolerations" . | indent 6 }}
{{ include "nodeAffinity" . | indent 6 }}
{{ include "image-pull-secrets" . | indent 6 }}
containers:
- env:
Expand Down
2 changes: 2 additions & 0 deletions charts/helm-chart/templates/web-server/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ spec:
annotations:
seccomp.security.alpha.kubernetes.io/defaultProfileName: runtime/default
spec:
{{ include "tolerations" . | indent 6 }}
{{ include "nodeAffinity" . | indent 6 }}
{{ include "image-pull-secrets" . | indent 6 }}
serviceAccountName: {{ include "kebabcase-release-name" . }}-web-server-service-account
securityContext:
Expand Down
19 changes: 19 additions & 0 deletions charts/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ services:
enterpriseServer:
installationEnvironment: KUBERNETES

# Toleration for k8s deployments

# tolerations:
# - key: "dedicated"
# operator: "Equal"
# value: "burp"
# effect: "NoSchedule"

# nodeAffinity for k8s deployments

# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: "dedicated"
# operator: "In"
# values:
# - "burp"

database:
# -- JDBC connection URL for the database
url: ""
Expand Down