diff --git a/CHANGELOG.md b/CHANGELOG.md index 75281c295..f584ac471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Added** - Added Basic Authentication support [Issue #534](https://github.com/TykTechnologies/tyk-operator/issues/534) +- Added nodeSelector support [Issue #551](https://github.com/TykTechnologies/tyk-operator/issues/551) **Fixed** - Operator was failing to remove finalizers from ApiDefinition that was already deleted in Dashboard [#469](https://github.com/TykTechnologies/tyk-operator/issues/469) diff --git a/config/helm/kustomization.yaml b/config/helm/kustomization.yaml index 2dcfd8141..3a3e6a508 100644 --- a/config/helm/kustomization.yaml +++ b/config/helm/kustomization.yaml @@ -37,6 +37,8 @@ patchesStrategicMerge: - manager_pod_annotations_patch.yaml # add ingress inv variables - manager_env_vars_patch.yaml + # add custom node selector + - manager_node_selector_patch.yaml # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml diff --git a/config/helm/manager_node_selector_patch.yaml b/config/helm/manager_node_selector_patch.yaml new file mode 100644 index 000000000..98574e8ce --- /dev/null +++ b/config/helm/manager_node_selector_patch.yaml @@ -0,0 +1,10 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: controller-manager + namespace: system +spec: + template: + spec: + nodeSelector: + NODE_SELECTOR: NODE_SELECTOR diff --git a/hack/helm/pre_helm.go b/hack/helm/pre_helm.go index ecd3f9c24..78500c7aa 100644 --- a/hack/helm/pre_helm.go +++ b/hack/helm/pre_helm.go @@ -21,6 +21,7 @@ func main() { {annotation, annotationTPL}, {securityContext, securityContextTPL}, {imageRBAC, imageRBACTPL}, + {nodeSelector, nodeSelectorTPL}, {"OPERATOR_FULLNAME", `{{ include "tyk-operator-helm.fullname" . }}`}, {"RELEASE_NAMESPACE", "{{ .Release.Namespace }}"}, @@ -113,3 +114,11 @@ const imageRBAC = ` image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0 const imageRBACTPL = ` image: {{ .Values.rbac.image.repository }}:{{ .Values.rbac.image.tag }} imagePullPolicy: {{ .Values.rbac.image.pullPolicy }} name: kube-rbac-proxy` + +const nodeSelector = ` nodeSelector: + NODE_SELECTOR: NODE_SELECTOR` + +const nodeSelectorTPL = `{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end }}` diff --git a/helm/templates/all.yaml b/helm/templates/all.yaml index 2a647d092..386bda919 100644 --- a/helm/templates/all.yaml +++ b/helm/templates/all.yaml @@ -476,6 +476,10 @@ spec: {{- with .Values.rbac.resources }} resources: {{- toYaml . | nindent 10 }} +{{- end }} +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} securityContext: runAsNonRoot: true diff --git a/helm/values.yaml b/helm/values.yaml index faf22a0e6..90bd9880f 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -20,6 +20,7 @@ podAnnotations: {} podSecurityContext: allowPrivilegeEscalation: false resources: {} +nodeSelector: {} #specify necessary resources for kube-rbac-proxy container rbac: resources: {}