From 9da9db00e4c50590783c35161279f23657f7b36f Mon Sep 17 00:00:00 2001 From: Shivangi Pandey Date: Thu, 21 Nov 2024 14:55:16 +0100 Subject: [PATCH] [egressd] add support for clusterIDSecretRef - fix bug allow passing of both apiKey and apiKeySecretRef --- .../templates/exporter/deployment.yaml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/charts/egressd/templates/exporter/deployment.yaml b/charts/egressd/templates/exporter/deployment.yaml index 633bce4f..740171ec 100644 --- a/charts/egressd/templates/exporter/deployment.yaml +++ b/charts/egressd/templates/exporter/deployment.yaml @@ -62,19 +62,20 @@ spec: fieldRef: fieldPath: metadata.namespace {{- if .Values.castai.clusterID }} - {{- if ne .Values.castai.clusterIDSecretRef "" }} - {{- fail "clusterID and clusterIDSecretRef are mutually exclusive" }} - {{- end }} + {{- if ne .Values.castai.clusterIDSecretRef "" }} + {{- fail "clusterID and clusterIDSecretRef are mutually exclusive" }} + {{- end }} - name: CLUSTER_ID value: {{ .Values.castai.clusterID | quote }} {{- else }} - {- if not .Values.castai.clusterIDSecretRef }} - {{- fail "either clusterID or clusterIDSecretRef should be passed" }} - {{- end }} - valueFrom: + {{- if not .Values.castai.clusterIDSecretRef }} + {{- fail "either clusterID or clusterIDSecretRef should be passed" }} + {{- end }} + - name: CLUSTER_ID + valueFrom: secretKeyRef: name: {{ .Values.castai.clusterIDSecretRef }} - key: CLUSTER_ID + key: CLUSTER_ID {{- end }} {{- if or .Values.castai.apiKey .Values.castai.apiKeySecretRef }} - name: API_KEY @@ -84,6 +85,9 @@ spec: {{- fail "`collector.extraArgs.send-traffic-delta` should be set to `true` when CAST AI is used as sink" }} {{- else }} {{- if .Values.castai.apiKey }} + {{- if ne .Values.castai.apiKeySecretRef "" }} + {{- fail "apiKey and apiKeySecretRef are mutually exclusive" }} + {{- end }} name: "{{- include "egressd.fullname" . }}" key: API_KEY {{- else if .Values.castai.apiKeySecretRef }}