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

Commit

Permalink
[TT-7498] - Add nodeSelector support (#552)
Browse files Browse the repository at this point in the history
* Add nodeSelector support

* Add nodeselector support through kustomize

* remove added vendor file

* revert crd changes

* reset crd file

* Update changelog
  • Loading branch information
zalbiraw authored Jan 5, 2023
1 parent d8a4543 commit e845fbc
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
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

0 comments on commit e845fbc

Please # to comment.