From d0844b54df62d05ff0275904ada7a87f4854073f Mon Sep 17 00:00:00 2001 From: Akash LM Date: Tue, 19 Sep 2023 21:15:23 +0530 Subject: [PATCH] Added secret reference nats token for client and agent chart --- charts/agent/Chart.yaml | 2 +- charts/agent/templates/deployment.yaml | 21 +++++++++++++++++++++ charts/agent/values.yaml | 7 ++++++- charts/client/Chart.yaml | 4 ++-- charts/client/templates/deployment.yaml | 9 ++++++++- charts/client/values.yaml | 7 ++++++- 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index 2d5827bd..939082d5 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.1.1 +version: 1.1.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/agent/templates/deployment.yaml b/charts/agent/templates/deployment.yaml index 407c35fc..dbbf85b7 100644 --- a/charts/agent/templates/deployment.yaml +++ b/charts/agent/templates/deployment.yaml @@ -49,7 +49,14 @@ spec: - name: CLUSTER_NAME value: {{ .Values.clusterName }} - name: NATS_TOKEN + {{- if .Values.nats.auth.token }} value: {{ .Values.nats.auth.token }} + {{- else if .Values.nats.auth.secret }} + valueFrom: + secretKeyRef: + name: {{ .Values.nats.auth.secret.name }} + key: {{ .Values.nats.auth.secret.key }} + {{- end }} - name: NATS_ADDRESS value: {{ .Values.nats.host }} - name: SCHEDULING_INTERVAL @@ -82,7 +89,14 @@ spec: - name: CLUSTER_NAME value: {{ .Values.clusterName }} - name: NATS_TOKEN + {{- if .Values.nats.auth.token }} value: {{ .Values.nats.auth.token }} + {{- else if .Values.nats.auth.secret }} + valueFrom: + secretKeyRef: + name: {{ .Values.nats.auth.secret.name }} + key: {{ .Values.nats.auth.secret.key }} + {{- end }} - name: NATS_ADDRESS value: {{ .Values.nats.host }} resources: @@ -100,7 +114,14 @@ spec: - name: CLUSTER_NAME value: {{ .Values.clusterName }} - name: NATS_TOKEN + {{- if .Values.nats.auth.token }} value: {{ .Values.nats.auth.token }} + {{- else if .Values.nats.auth.secret }} + valueFrom: + secretKeyRef: + name: {{ .Values.nats.auth.secret.name }} + key: {{ .Values.nats.auth.secret.key }} + {{- end }} - name: NATS_ADDRESS value: {{ .Values.nats.host }} resources: diff --git a/charts/agent/values.yaml b/charts/agent/values.yaml index dba580a7..0787dc3a 100644 --- a/charts/agent/values.yaml +++ b/charts/agent/values.yaml @@ -156,4 +156,9 @@ clusterName: "kubviz" nats: host: kubviz-client-nats auth: - token: "UfmrJOYwYCCsgQvxvcfJ3BdI6c8WBbnD" + # Use token if you want to provide the token via Helm Values + token: "" + # Use a secret reference if you want to get a token from a secret + secret: + name: "" + key: "" diff --git a/charts/client/Chart.yaml b/charts/client/Chart.yaml index 53bf6cf1..5b6b5071 100644 --- a/charts/client/Chart.yaml +++ b/charts/client/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.1.1 +version: 1.1.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to @@ -25,7 +25,7 @@ appVersion: "v1.0.0" dependencies: - name: nats condition: nats.enabled - version: 0.13.4 + version: 0.13.5 repository: https://intelops.github.io/kubviz/ - name: clickhouse condition: clickhouse.enabled diff --git a/charts/client/templates/deployment.yaml b/charts/client/templates/deployment.yaml index 0fd4d7fd..d33e17ea 100644 --- a/charts/client/templates/deployment.yaml +++ b/charts/client/templates/deployment.yaml @@ -63,7 +63,14 @@ spec: # port: http env: - name: NATS_TOKEN + {{- if and .Values.nats.enabled .Values.nats.auth.enabled .Values.nats.auth.token }} value: {{ .Values.nats.auth.token }} + {{- else if and .Values.nats.enabled .Values.nats.auth.enabled .Values.nats.auth.secret }} + valueFrom: + secretKeyRef: + name: {{ .Values.nats.auth.secret.name }} + key: {{ .Values.nats.auth.secret.key }} + {{- end }} - name: NATS_ADDRESS value: {{ include "client.fullname" . }}-nats - name: DB_ADDRESS @@ -83,4 +90,4 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} \ No newline at end of file diff --git a/charts/client/values.yaml b/charts/client/values.yaml index a4053a25..0d1ab1e7 100644 --- a/charts/client/values.yaml +++ b/charts/client/values.yaml @@ -83,7 +83,12 @@ nats: #Authentication setup auth: enabled: true - token: "UfmrJOYwYCCsgQvxvcfJ3BdI6c8WBbnD" + # Use token if you want to provide the token via Helm Values + token: "" + # Use a secret reference if you want to get a token from a secret + secret: + name: "" + key: "" nats: jetstream: enabled: true