Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

[TT-7498] - Add nodeSelector support #552

Merged
merged 6 commits into from
Jan 5, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions config/helm/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions config/helm/manager_node_selector_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
nodeSelector:
NODE_SELECTOR: NODE_SELECTOR
9 changes: 9 additions & 0 deletions hack/helm/pre_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"},
Expand Down Expand Up @@ -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 }}`
4 changes: 4 additions & 0 deletions helm/templates/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ podAnnotations: {}
podSecurityContext:
allowPrivilegeEscalation: false
resources: {}
nodeSelector: {}
#specify necessary resources for kube-rbac-proxy container
rbac:
resources: {}
Expand Down