[bitnami/etcd] Fixing defrag etcd for authenticated and tls clusters (#30096)

* fix(etcd): Fix defragmentation cronjob to work with authenticated enabled clusters

We don't have an easy way to generate jwt tokens so for now it only works with
.Values.auth.token.type = "simple".

Signed-off-by: Miguel Sacristán Izcue <miguel_tete17@hotmail.com>

* fix(etcd): Support the usage of client secure transport for the defrag cron job

Signed-off-by: Miguel Sacristán Izcue <miguel_tete17@hotmail.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

---------

Signed-off-by: Miguel Sacristán Izcue <miguel_tete17@hotmail.com>
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
Co-authored-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Tete17
2024-10-28 12:47:19 +01:00
committed by GitHub
co-authored by Bitnami Containers
parent a5afdbe173
commit 558e971fd3
3 changed files with 42 additions and 4 deletions
+6 -2
View File
@@ -1,8 +1,12 @@
# Changelog
## 10.4.1 (2024-10-24)
## 10.4.2 (2024-10-28)
* [bitnami/etcd]: Fix podLabels bug ([#30052](https://github.com/bitnami/charts/pull/30052))
* [bitnami/etcd] Fixing defrag etcd for authenticated and tls clusters ([#30096](https://github.com/bitnami/charts/pull/30096))
## <small>10.4.1 (2024-10-24)</small>
* [bitnami/etcd]: Fix podLabels bug (#30052) ([9a5b58e](https://github.com/bitnami/charts/commit/9a5b58eff6fadde572f596f387ee921259a80469)), closes [#30052](https://github.com/bitnami/charts/issues/30052)
## 10.4.0 (2024-10-22)
+1 -1
View File
@@ -32,4 +32,4 @@ maintainers:
name: etcd
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/etcd
version: 10.4.1
version: 10.4.2
+35 -1
View File
@@ -60,6 +60,27 @@ spec:
env:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
{{- if and .Values.auth.rbac.create .Values.auth.token.enabled }}
{{- if eq .Values.auth.token.type "simple" }}
- name: ETCD_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "etcd.secretName" . }}
key: {{ include "etcd.secretPasswordKey" . }}
{{- else }}
{{- fail "defragmention and auth.token = jwt is not supported by the helm chart" }}
{{- end }}
- name: ETCDCTL_USER
value: "root:$(ETCD_ROOT_PASSWORD)"
{{- end }}
{{- if or .Values.auth.client.enableAuthentication (and .Values.auth.client.secureTransport (not .Values.auth.client.useAutoTLS )) }}
- name: ETCDCTL_CA_FILE
value: "/opt/bitnami/etcd/certs/client/{{ .Values.auth.client.caFilename | default "ca.crt" }}"
- name: ETCDCTL_KEY_FILE
value: "/opt/bitnami/etcd/certs/client/{{ .Values.auth.client.certKeyFilename }}"
- name: ETCDCTL_CERT_FILE
value: "/opt/bitnami/etcd/certs/client/{{ .Values.auth.client.certFilename }}"
{{- end }}
{{- if .Values.defrag.cronjob.command }}
command: {{ .Values.defrag.cronjob.command | toYaml | nindent 16 }}
{{- else }}
@@ -97,4 +118,17 @@ spec:
{{- if .Values.defrag.cronjob.containerSecurityContext.enabled }}
securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.defrag.cronjob.containerSecurityContext "context" $) | nindent 16 }}
{{- end }}
{{- end }}
{{- if or .Values.auth.client.enableAuthentication (and .Values.auth.client.secureTransport (not .Values.auth.client.useAutoTLS )) }}
volumeMounts:
- name: etcd-client-certs
mountPath: /opt/bitnami/etcd/certs/client/
readOnly: true
{{- end }}
{{- if or .Values.auth.client.enableAuthentication (and .Values.auth.client.secureTransport (not .Values.auth.client.useAutoTLS )) }}
volumes:
- name: etcd-client-certs
secret:
secretName: {{ required "A secret containing the client certificates is required" (tpl .Values.auth.client.existingSecret .) }}
defaultMode: 256
{{- end }}
{{- end }}