Skip to content

Commit

Permalink
update ca cert in cloud cost and aggregator too
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan committed Dec 27, 2024
1 parent ceba274 commit 795706c
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cost-analyzer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,13 @@ Begin Kubecost 2.0 templates
- name: postgres-queries
mountPath: /var/configs/integrations/postgres-queries
{{- end }}
{{- if .Values.global.updateCaTrust.enabled }}
- name: ca-certs-secret
mountPath: {{ .Values.global.updateCaTrust.caCertsMountPath | quote }}
- name: ssl-path
mountPath: "/etc/pki/ca-trust/extracted"
readOnly: false
{{- end }}
{{- /* Only adds extraVolumeMounts if aggregator is running as its own pod */}}
{{- if and .Values.kubecostAggregator.extraVolumeMounts (eq (include "aggregator.deployMethod" .) "statefulset") }}
{{- toYaml .Values.kubecostAggregator.extraVolumeMounts | nindent 4 }}
Expand Down Expand Up @@ -1288,6 +1295,13 @@ Begin Kubecost 2.0 templates
name: plugins-config
readOnly: true
{{- end }}
{{- if .Values.global.updateCaTrust.enabled }}
- name: ca-certs-secret
mountPath: {{ .Values.global.updateCaTrust.caCertsMountPath | quote }}
- name: ssl-path
mountPath: "/etc/pki/ca-trust/extracted"
readOnly: false
{{- end }}
{{- /* Only adds extraVolumeMounts when cloudcosts is running as its own pod */}}
{{- if and .Values.kubecostAggregator.cloudCost.extraVolumeMounts (eq (include "aggregator.deployMethod" .) "statefulset") }}
{{- toYaml .Values.kubecostAggregator.cloudCost.extraVolumeMounts | nindent 4 }}
Expand Down
41 changes: 41 additions & 0 deletions cost-analyzer/templates/aggregator-cloud-cost-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ spec:
- name: tmp
emptyDir: {}
{{- end }}
{{- if .Values.global.updateCaTrust.enabled }}
- name: ca-certs-secret
{{- if .Values.global.updateCaTrust.caCertsSecret }}
secret:
defaultMode: 420
secretName: {{ .Values.global.updateCaTrust.caCertsSecret }}
{{- else }}
configMap:
name: {{ .Values.global.updateCaTrust.caCertsConfig }}
{{- end }}
- name: ssl-path
emptyDir: {}
{{- end }}
{{- if .Values.kubecostAggregator.cloudCost.extraVolumes }}
{{- toYaml .Values.kubecostAggregator.cloudCost.extraVolumes | nindent 8 }}
{{- end }}
Expand All @@ -141,6 +154,34 @@ spec:
- name: plugins-dir
mountPath: {{ .Values.kubecostModel.plugins.folder }}
{{- end }}
{{- if .Values.global.updateCaTrust.enabled }}
- name: update-ca-trust
image: {{ include "cost-model.image" . | trim | quote}}
{{- if .Values.kubecostModel.imagePullPolicy }}
imagePullPolicy: {{ .Values.kubecostModel.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
{{- with .Values.global.updateCaTrust.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.global.updateCaTrust.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
command:
- 'sh'
- '-c'
- >
mkdir -p /etc/pki/ca-trust/extracted/{edk2,java,openssl,pem};
/usr/bin/update-ca-trust extract;
volumeMounts:
- name: ca-certs-secret
mountPath: {{ .Values.global.updateCaTrust.caCertsMountPath | quote }}
- name: ssl-path
mountPath: "/etc/pki/ca-trust/extracted"
readOnly: false
{{- end}}
containers:
{{- include "aggregator.cloudCost.containerTemplate" . | nindent 8 }}
{{- if .Values.imagePullSecrets }}
Expand Down
42 changes: 42 additions & 0 deletions cost-analyzer/templates/aggregator-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,51 @@ spec:
secret:
secretName: kubecost-integrations-turbonomic
{{- end }}
{{- if .Values.global.updateCaTrust.enabled }}
- name: ca-certs-secret
{{- if .Values.global.updateCaTrust.caCertsSecret }}
secret:
defaultMode: 420
secretName: {{ .Values.global.updateCaTrust.caCertsSecret }}
{{- else }}
configMap:
name: {{ .Values.global.updateCaTrust.caCertsConfig }}
{{- end }}
- name: ssl-path
emptyDir: {}
{{- end }}
{{- if .Values.kubecostAggregator.extraVolumes }}
{{- toYaml .Values.kubecostAggregator.extraVolumes | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.global.updateCaTrust.enabled }}
- name: update-ca-trust
image: {{ include "cost-model.image" . | trim | quote}}
{{- if .Values.kubecostModel.imagePullPolicy }}
imagePullPolicy: {{ .Values.kubecostModel.imagePullPolicy }}
{{- else }}
imagePullPolicy: Always
{{- end }}
{{- with .Values.global.updateCaTrust.securityContext }}
securityContext: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.global.updateCaTrust.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
command:
- 'sh'
- '-c'
- >
mkdir -p /etc/pki/ca-trust/extracted/{edk2,java,openssl,pem};
/usr/bin/update-ca-trust extract;
volumeMounts:
- name: ca-certs-secret
mountPath: {{ .Values.global.updateCaTrust.caCertsMountPath | quote }}
- name: ssl-path
mountPath: "/etc/pki/ca-trust/extracted"
readOnly: false
{{- end}}
containers:
{{- include "aggregator.containerTemplate" . | nindent 8 }}

Expand Down

0 comments on commit 795706c

Please sign in to comment.