Skip to content

Commit

Permalink
add option for both secret and config map and template imagePullPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan committed Dec 10, 2024
1 parent 331fdfd commit 04b80aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions cost-analyzer/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
{{- include "prometheusRetentionCheck" . -}}
{{- include "clusterIDCheck" . -}}
{{- include "kubeRBACProxyBearerTokenCheck" . -}}
{{- include "caCertsSecretConfigCheck" . -}}

{{- $servicePort := .Values.service.port | default 9090 }}
Kubecost {{ .Chart.Version }} has been successfully installed.
Expand Down
10 changes: 10 additions & 0 deletions cost-analyzer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,16 @@ for more information
{{- end }}
{{- end }}

{{- define "caCertsSecretConfigCheck" }}
{{- if .Values.kubecostModel.updateCaTrust.enabled }}
{{- if and .Values.kubecostModel.updateCaTrust.caCertsSecret .Values.kubecostModel.updateCaTrust.caCertsConfig }}
{{- fail "Both caCertsSecret and caCertsConfig are defined. Please specify only one." }}
{{- else if and (not .Values.kubecostModel.updateCaTrust.caCertsSecret) (not .Values.kubecostModel.updateCaTrust.caCertsConfig) }}
{{- fail "Neither caCertsSecret nor caCertsConfig is defined, but updateCaTrust is enabled. Please specify one." }}
{{- end }}
{{- end }}
{{- end }}

{{- define "clusterControllerEnabled" }}
{{- if (.Values.clusterController).enabled }}
{{- printf "true" -}}
Expand Down
11 changes: 10 additions & 1 deletion cost-analyzer/templates/cost-analyzer-deployment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,14 @@ spec:
{{- end }}
{{- if .Values.kubecostModel.updateCaTrust.enabled }}
- name: ca-certs-secret
{{- if .Values.kubecostModel.updateCaTrust.caCertsSecret }}
secret:
defaultMode: 420
secretName: {{ .Values.kubecostModel.updateCaTrust.caCertsSecret }}
{{- else }}
configMap:
name: {{ .Values.kubecostModel.updateCaTrust.caCertsConfig }}
{{- end }}
- name: ssl-path
emptyDir: {}
{{- end }}
Expand Down Expand Up @@ -356,7 +361,11 @@ spec:
{{- if .Values.kubecostModel.updateCaTrust.enabled }}
- name: update-ca-trust
image: {{ include "cost-model.image" . | trim | quote}}
imagePullPolicy: IfNotPresent
{{- if .Values.kubecostModel.imagePullPolicy }}
imagePullPolicy: {{ .Values.kubecostModel.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
{{- with .Values.kubecostModel.updateCaTrust.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions cost-analyzer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ kubecostModel:
seccompProfile:
type: RuntimeDefault
caCertsSecret: ca-certs-secret # The name of the Secret containing custom CA certificates to mount to the cost-model container.
# caCertsConfig: ca-certs-config # The name of the ConfigMap containing the CA trust configuration.
resources: {} # Resource requests and limits for the init container.
caCertsMountPath: /etc/pki/ca-trust/source/anchors # The path where the custom CA certificates will be mounted in the init container

Expand Down

0 comments on commit 04b80aa

Please sign in to comment.