Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ca cert in cloud cost and aggregator container too #3794

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading