From 9913c1ad6c05a24f2a07bcbf55bff82fa37f1a14 Mon Sep 17 00:00:00 2001 From: Enzo Candotti Date: Wed, 22 Dec 2021 11:14:21 -0300 Subject: [PATCH] Add master NodeSelector to SNMP pods SNMP pods should not be installed on worker nodes, since trap generation will not work as expected. This change adds a node-role.kubernetes.io/master NodeSelector in order to force the pods to be Scheduled only on master nodes. Closes-Bug: 1955571 Test Plan: PASS: Verify that tolerations and NodeSelector are installed properly. PASS: Add a NoSchedule taint to master nodes and verify that pods are not being scheduled on worker nodes. Signed-off-by: Enzo Candotti Change-Id: I28c279187463cfdc79fd39f40a817be4ee4cf011 --- .../helm-charts/snmp/templates/deployment.yaml | 10 +++++++--- .../stx-snmp-helm/helm-charts/snmp/values.yaml | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml index bc03596..8f7a019 100755 --- a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml @@ -23,10 +23,14 @@ spec: spec: imagePullSecrets: - name: default-registry-key +{{- with .Values.tolerations }} tolerations: - - key: "node-role.kubernetes.io/master" - operator: "Exists" - effect: "NoSchedule" +{{ toYaml . | indent 6 }} +{{- end }} +{{- if .Values.nodeSelector }} + nodeSelector: +{{ .Values.nodeSelector | toYaml | trim | indent 8 }} +{{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.snmp.image.repository }}:{{ .Values.snmp.image.tag }}" diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml index 39168dc..a7219c6 100755 --- a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml @@ -30,6 +30,13 @@ image: nameOverride: "" fullnameOverride: "" +nodeSelector: { node-role.kubernetes.io/master: "" } + +tolerations: + - key: "node-role.kubernetes.io/master" + operator: "Exists" + effect: "NoSchedule" + configmap: name_snmpd: snmpd-etc-config name_fm: snmpd-fm