This is an automated email from the ASF dual-hosted git repository. dgrove pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git
The following commit(s) were added to refs/heads/master by this push: new 23a98f4 feat: add k8s tolerations support (#490) 23a98f4 is described below commit 23a98f4ee1c97df5a919c1c326065f8a2da9be44 Author: Robert Kopaczewski <r...@23doors.com> AuthorDate: Thu Jul 11 16:37:51 2019 +0200 feat: add k8s tolerations support (#490) --- helm/openwhisk/templates/_tolerations.tpl | 23 ++++++++++++++++++++ helm/openwhisk/templates/apigateway-pod.yaml | 6 +++++ helm/openwhisk/templates/controller-pod.yaml | 5 +++++ helm/openwhisk/templates/couchdb-pod.yaml | 6 +++++ helm/openwhisk/templates/invoker-agent-pod.yaml | 5 +++++ helm/openwhisk/templates/invoker-pod.yaml | 5 +++++ helm/openwhisk/templates/kafka-pod.yaml | 5 +++++ helm/openwhisk/templates/nginx-pod.yaml | 5 +++++ helm/openwhisk/templates/redis-pod.yaml | 5 +++++ helm/openwhisk/templates/zookeeper-pod.yaml | 5 +++++ helm/openwhisk/values-metadata.yaml | 29 +++++++++++++++++++++++++ helm/openwhisk/values.yaml | 9 ++++++++ 12 files changed, 108 insertions(+) diff --git a/helm/openwhisk/templates/_tolerations.tpl b/helm/openwhisk/templates/_tolerations.tpl new file mode 100644 index 0000000..921b172 --- /dev/null +++ b/helm/openwhisk/templates/_tolerations.tpl @@ -0,0 +1,23 @@ +{{/* Core toleration */}} +{{- define "openwhisk.toleration.core" -}} +- key: "openwhisk-role" + operator: "Equal" + value: {{ .Values.toleration.coreValue }} + effect: "NoSchedule" +{{- end -}} + + {{/* Edge toleration */}} +{{- define "openwhisk.toleration.edge" -}} +- key: "openwhisk-role" + operator: "Equal" + value: {{ .Values.toleration.edgeValue }} + effect: "NoSchedule" +{{- end -}} + + {{/* Invoker toleration */}} +{{- define "openwhisk.toleration.invoker" -}} +- key: "openwhisk-role" + operator: "Equal" + value: {{ .Values.toleration.invokerValue }} + effect: "NoSchedule" +{{- end -}} diff --git a/helm/openwhisk/templates/apigateway-pod.yaml b/helm/openwhisk/templates/apigateway-pod.yaml index 01e7030..deb5988 100644 --- a/helm/openwhisk/templates/apigateway-pod.yaml +++ b/helm/openwhisk/templates/apigateway-pod.yaml @@ -40,6 +40,12 @@ spec: {{ include "openwhisk.affinity.core" . | indent 8 }} {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-apigateway" .Release.Name ) | indent 8 }} {{- end }} + + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} + {{- end }} + {{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }} containers: - name: apigateway diff --git a/helm/openwhisk/templates/controller-pod.yaml b/helm/openwhisk/templates/controller-pod.yaml index 44a49a9..454959f 100644 --- a/helm/openwhisk/templates/controller-pod.yaml +++ b/helm/openwhisk/templates/controller-pod.yaml @@ -44,6 +44,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-controller" .Release.Name ) | indent 8 }} {{- end }} + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} + {{- end }} + initContainers: {{- if not .Values.controller.lean }} # The controller must wait for kafka and/or couchdb to be ready before it starts diff --git a/helm/openwhisk/templates/couchdb-pod.yaml b/helm/openwhisk/templates/couchdb-pod.yaml index 718f89c..01f7af7 100644 --- a/helm/openwhisk/templates/couchdb-pod.yaml +++ b/helm/openwhisk/templates/couchdb-pod.yaml @@ -41,6 +41,12 @@ spec: {{ include "openwhisk.affinity.core" . | indent 8 }} {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-couchdb" .Release.Name ) | indent 8 }} {{- end }} + + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} + {{- end }} + {{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }} containers: - name: couchdb diff --git a/helm/openwhisk/templates/invoker-agent-pod.yaml b/helm/openwhisk/templates/invoker-agent-pod.yaml index 8efd7ca..698eaac 100644 --- a/helm/openwhisk/templates/invoker-agent-pod.yaml +++ b/helm/openwhisk/templates/invoker-agent-pod.yaml @@ -39,6 +39,11 @@ spec: affinity: {{ include "openwhisk.affinity.invoker" . | indent 8 }} +{{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.invoker" . | indent 8 }} +{{- end }} + volumes: {{ include "openwhisk.docker_volumes" . | indent 6 }} - name: userlogs diff --git a/helm/openwhisk/templates/invoker-pod.yaml b/helm/openwhisk/templates/invoker-pod.yaml index 81588e0..98355f6 100644 --- a/helm/openwhisk/templates/invoker-pod.yaml +++ b/helm/openwhisk/templates/invoker-pod.yaml @@ -55,6 +55,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-invoker" .Release.Name ) | indent 8 }} {{- end }} +{{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.invoker" . | indent 8 }} +{{- end }} + {{ include "openwhisk.invoker.volumes" . }} initContainers: diff --git a/helm/openwhisk/templates/kafka-pod.yaml b/helm/openwhisk/templates/kafka-pod.yaml index fac4710..a74452d 100644 --- a/helm/openwhisk/templates/kafka-pod.yaml +++ b/helm/openwhisk/templates/kafka-pod.yaml @@ -45,6 +45,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-kafka" .Release.Name ) | indent 8 }} {{- end }} + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} + {{- end }} + {{- if and .Values.k8s.persistence.enabled (eq (int .Values.kafka.replicaCount) 1) }} volumes: - name: "{{ .Release.Name }}-kafka-pvc" diff --git a/helm/openwhisk/templates/nginx-pod.yaml b/helm/openwhisk/templates/nginx-pod.yaml index 7591f70..4d09a75 100644 --- a/helm/openwhisk/templates/nginx-pod.yaml +++ b/helm/openwhisk/templates/nginx-pod.yaml @@ -41,6 +41,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-nginx" .Release.Name ) | indent 8 }} {{- end }} + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.edge" . | indent 8 }} + {{- end }} + volumes: - name: nginx-certs secret: diff --git a/helm/openwhisk/templates/redis-pod.yaml b/helm/openwhisk/templates/redis-pod.yaml index d68b3a1..53aeb4d 100644 --- a/helm/openwhisk/templates/redis-pod.yaml +++ b/helm/openwhisk/templates/redis-pod.yaml @@ -41,6 +41,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-redis" .Release.Name | quote ) | indent 8 }} {{- end }} + {{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} + {{- end }} + {{- if .Values.k8s.persistence.enabled }} volumes: - name: redis-data diff --git a/helm/openwhisk/templates/zookeeper-pod.yaml b/helm/openwhisk/templates/zookeeper-pod.yaml index e673023..b4fb0a1 100644 --- a/helm/openwhisk/templates/zookeeper-pod.yaml +++ b/helm/openwhisk/templates/zookeeper-pod.yaml @@ -45,6 +45,11 @@ spec: {{ include "openwhisk.affinity.selfAntiAffinity" ( printf "%s-zookeeper" .Release.Name ) | indent 8 }} {{- end }} +{{- if .Values.toleration.enabled }} + tolerations: +{{ include "openwhisk.toleration.core" . | indent 8 }} +{{- end }} + volumes: - name: zk-config configMap: diff --git a/helm/openwhisk/values-metadata.yaml b/helm/openwhisk/values-metadata.yaml index 8137bfb..6f0aafa 100644 --- a/helm/openwhisk/values-metadata.yaml +++ b/helm/openwhisk/values-metadata.yaml @@ -1498,6 +1498,35 @@ affinity: type: "string" required: true +toleration: + __metadata: + label: "Node toleration configuration" + description: "Key used for node tolerations" + enabled: + __metadata: + label: "Toleration enabled" + description: "If toleration should be enabled" + type: "boolean" + required: true + coreValue: + __metadata: + label: "Core openwhisk-role toleration value" + description: "Value used for worker nodes toleration that should execute OpenWhisk core pods" + type: "string" + required: true + edgeValue: + __metadata: + label: "Edge openwhisk-role toleration value" + description: "Value used for worker nodes toleration that should execute OpenWhisk edge pods" + type: "string" + required: true + invokerValue: + __metadata: + label: "Invoker openwhisk-role toleration value" + description: "Value used for worker nodes toleration that should execute OpenWhisk invoker pods" + type: "string" + required: true + probes: _metadata: label: "Pod's Probes Settings" diff --git a/helm/openwhisk/values.yaml b/helm/openwhisk/values.yaml index bf23bd5..deb5fae 100644 --- a/helm/openwhisk/values.yaml +++ b/helm/openwhisk/values.yaml @@ -377,6 +377,15 @@ affinity: invokerNodeLabel: invoker providerNodeLabel: provider +# Used to define toleration for the Kubernetes scheduler. +# If tolerations.enabled is true, then all of the deployments for the OpenWhisk +# microservices will add tolerations for key openwhisk-role with specified value and effect NoSchedule. +toleration: + enabled: true + coreValue: core + edgeValue: edge + invokerValue: invoker + # Used to define the probes timing settings so that you can more precisely control the # liveness and readiness checks. # initialDelaySeconds - Initial wait time to start probes after container has started