Skip to content

Commit fcaf282

Browse files
gcp-cherry-pick-bot[bot]srpomeroythomasvn
authored
Fix support for existing plugin secret (#3409) (#3467)
* fix support for custom plugin secret * fix spacing * simplify logic * remove extra end block --------- Signed-off-by: Sean Pomeroy <[email protected]> Co-authored-by: Sean Pomeroy <[email protected]> Co-authored-by: Thomas Nguyen <[email protected]>
1 parent da58b52 commit fcaf282

4 files changed

+29
-6
lines changed

cost-analyzer/templates/aggregator-cloud-cost-deployment.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,22 @@ spec:
101101
{{- end }}
102102
- name: plugins-dir
103103
emptyDir: {}
104+
{{- if and (not .Values.kubecostModel.plugins.existingCustomSecret.enabled) .Values.kubecostModel.plugins.secretName }}
104105
- name: plugins-config
105106
secret:
106-
secretName: {{ .Values.kubecostModel.plugins.configSecret }}
107+
secretName: {{ .Values.kubecostModel.plugins.secretName }}
107108
items:
108109
- key: datadog_config.json
109110
path: datadog_config.json
111+
{{- end }}
112+
{{- if .Values.kubecostModel.plugins.existingCustomSecret.enabled }}
113+
- name: plugins-config
114+
secret:
115+
secretName: {{ .Values.kubecostModel.plugins.existingCustomSecret.name }}
116+
items:
117+
- key: datadog_config.json
118+
path: datadog_config.json
119+
{{- end }}
110120
- name: tmp
111121
emptyDir: {}
112122
{{- end }}

cost-analyzer/templates/cost-analyzer-deployment-template.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,22 @@ spec:
7474
{{- if .Values.kubecostModel.plugins.enabled }}
7575
- name: plugins-dir
7676
emptyDir: {}
77+
{{- if and (not .Values.kubecostModel.plugins.existingCustomSecret.enabled) .Values.kubecostModel.plugins.secretName }}
7778
- name: plugins-config
7879
secret:
79-
secretName: {{ .Values.kubecostModel.plugins.configSecret }}
80+
secretName: {{ .Values.kubecostModel.plugins.secretName }}
8081
items:
8182
- key: datadog_config.json
8283
path: datadog_config.json
84+
{{- end }}
85+
{{- if .Values.kubecostModel.plugins.existingCustomSecret.enabled }}
86+
- name: plugins-config
87+
secret:
88+
secretName: {{ .Values.kubecostModel.plugins.existingCustomSecret.name }}
89+
items:
90+
- key: datadog_config.json
91+
path: datadog_config.json
92+
{{- end }}
8393
{{- if .Values.kubecostModel.plugins.install.enabled}}
8494
- name: install-script
8595
configMap:
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{{- if .Values.kubecostModel.plugins.enabled }}
1+
{{- if and (not .Values.kubecostModel.plugins.existingCustomSecret.enabled) .Values.kubecostModel.plugins.enabled }}
22
apiVersion: v1
33
kind: Secret
44
metadata:
5-
name: {{ .Values.kubecostModel.plugins.configSecret }}
5+
name: {{ .Values.kubecostModel.plugins.secretName }}
66
labels:
77
{{ include "cost-analyzer.commonLabels" . | nindent 4 }}
88
data:
@@ -11,4 +11,3 @@ data:
1111
{{ $config | b64enc | indent 4}}
1212
{{- end }}
1313
{{- end }}
14-

cost-analyzer/values.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,11 @@ kubecostModel:
611611
# - datadog
612612

613613
# pre-existing secret for plugin configuration
614-
configSecret: kubecost-plugin-secret
614+
existingCustomSecret:
615+
enabled: false
616+
name: "" # name of the secret containing plugin config
617+
618+
secretName: kubecost-plugin-secret
615619

616620
# uncomment this to define plugin configuration via the values file
617621
# configs:

0 commit comments

Comments
 (0)