diff --git a/chart/kubedb/README.md b/chart/kubedb/README.md index 54557af39..a6ef29959 100644 --- a/chart/kubedb/README.md +++ b/chart/kubedb/README.md @@ -52,6 +52,9 @@ The following table lists the configurable parameters of the KubeDB chart and th | `imagePullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) | | `imagePullPolicy` | Image pull policy | `IfNotPresent` | | `criticalAddon` | If true, installs KubeDB operator as critical addon | `false` | +| `affinity` | Affinity rules for pod assignment | `{}` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | Tolerations used pod assignment | `{}` | | `rbac.create` | If `true`, create and use RBAC resources | `true` | | `serviceAccount.create` | If `true`, create a new service account | `true` | | `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | `` | diff --git a/chart/kubedb/templates/deployment.yaml b/chart/kubedb/templates/deployment.yaml index 56d025730..8d4de769d 100644 --- a/chart/kubedb/templates/deployment.yaml +++ b/chart/kubedb/templates/deployment.yaml @@ -78,8 +78,24 @@ spec: secret: defaultMode: 420 secretName: {{ template "kubedb.fullname" . }}-apiserver-cert -{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} +{{- if or .Values.tolerations (and .Values.criticalAddon (eq .Release.Namespace "kube-system")) }} tolerations: +{{- if .Values.tolerations }} +{{ toYaml .Values.tolerations | indent 8 }} +{{- end -}} +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} - key: CriticalAddonsOnly operator: Exists {{- end -}} +{{- end -}} +{{- if .Values.affinity }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} +{{- end -}} +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end -}} +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} + priorityClassName: system-cluster-critical +{{- end -}} diff --git a/chart/kubedb/values.yaml b/chart/kubedb/values.yaml index 120bc335f..cecefa1b6 100644 --- a/chart/kubedb/values.yaml +++ b/chart/kubedb/values.yaml @@ -22,6 +22,21 @@ imagePullPolicy: IfNotPresent ## https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/ criticalAddon: false +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## Tolerations for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: {} + +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + rbac: # Specifies whether RBAC resources should be created create: true diff --git a/hack/deploy/operator.yaml b/hack/deploy/operator.yaml index b36907d5e..d8ee5c3d4 100644 --- a/hack/deploy/operator.yaml +++ b/hack/deploy/operator.yaml @@ -71,6 +71,7 @@ spec: tolerations: - key: CriticalAddonsOnly operator: Exists + priorityClassName: system-cluster-critical --- # kube lacks the service serving cert signer, so provide a manual secret for it apiVersion: v1