Skip to content

Commit 95d4f90

Browse files
committed
2 parents f93cf36 + d4001eb commit 95d4f90

52 files changed

Lines changed: 6491 additions & 8 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addons/etcd/3.6/chart/etcd-3.6/CHANGELOG.md

Lines changed: 1877 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright Broadcom, Inc. All Rights Reserved.
2+
# SPDX-License-Identifier: APACHE-2.0
3+
4+
annotations:
5+
images: |
6+
- name: etcd
7+
image: registry.drycc.cc/drycc-addons/etcd:3.6
8+
- name: base
9+
image: registry.drycc.cc/drycc/base:trixie
10+
licenses: Apache-2.0
11+
tanzuCategory: service
12+
apiVersion: v2
13+
appVersion: 3.6.6
14+
dependencies:
15+
- name: common
16+
repository: oci://registry.drycc.cc/charts
17+
version: ~1.1.4
18+
description: etcd is a distributed key-value store designed to securely store data
19+
across a cluster. etcd is widely used in production on account of its reliability,
20+
fault-tolerance and ease of use.
21+
home: https://bitnami.com
22+
icon: https://dyltqmyl993wv.cloudfront.net/assets/stacks/etcd/img/etcd-stack-220x234.png
23+
keywords:
24+
- etcd
25+
- cluster
26+
- database
27+
- cache
28+
- key-value
29+
maintainers:
30+
- name: Broadcom, Inc. All Rights Reserved.
31+
url: https://github.com/bitnami/charts
32+
name: etcd
33+
sources:
34+
- https://github.com/bitnami/charts/tree/main/bitnami/etcd
35+
version: 12.0.20

addons/etcd/3.6/chart/etcd-3.6/README.md

Lines changed: 899 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
6+
{{- if and (eq .Values.service.type "LoadBalancer") .Values.auth.rbac.allowNoneAuthentication }}
7+
-------------------------------------------------------------------------------
8+
WARNING
9+
10+
By specifying "service.type=LoadBalancer", "auth.rbac.enabled=false" and
11+
"auth.rbac.allowNoneAuthentication=true" you have most likely exposed the etcd
12+
service externally without any authentication mechanism.
13+
14+
For security reasons, we strongly suggest that you switch to "ClusterIP" or
15+
"NodePort". As alternative, you can also switch to "auth.rbac.enabled=true"
16+
providing a valid password on "auth.rbac.rootPassword" parameter.
17+
18+
-------------------------------------------------------------------------------
19+
{{- end }}
20+
21+
** Please be patient while the chart is being deployed **
22+
23+
{{- if .Values.diagnosticMode.enabled }}
24+
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
25+
26+
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
27+
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
28+
29+
Get the list of pods by executing:
30+
31+
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}
32+
33+
Access the pod you want to debug by executing
34+
35+
kubectl exec --namespace {{ include "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash
36+
37+
In order to replicate the container startup scripts execute this command:
38+
39+
/opt/drycc/scripts/etcd/entrypoint.sh /opt/drycc/scripts/etcd/run.sh
40+
41+
{{- else }}
42+
43+
etcd can be accessed via port {{ .Values.service.ports.client }} on the following DNS name from within your cluster:
44+
45+
{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
46+
47+
To create a pod that you can use as a etcd client run the following command:
48+
49+
kubectl run {{ template "common.names.fullname" . }}-client --restart='Never' --image {{ template "etcd.image" . }}{{- if or .Values.auth.rbac.create .Values.auth.rbac.enabled }} --env ROOT_PASSWORD=$(kubectl get secret --namespace {{ include "common.names.namespace" . }} {{ if .Values.auth.rbac.existingSecret }}{{ .Values.auth.rbac.existingSecret }}{{ else }}{{ template "common.names.fullname" . }}{{ end }} -o jsonpath="{{ if .Values.auth.rbac.existingSecret }}{.data.{{ .Values.auth.rbac.existingSecretPasswordKey }}}{{ else }}{.data.etcd-root-password}{{ end }}" | base64 -d){{- end }} --env ETCDCTL_ENDPOINTS="{{ template "common.names.fullname" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}:{{ .Values.service.ports.client }}" --namespace {{ include "common.names.namespace" . }} --command -- sleep infinity
50+
51+
Then, you can set/get a key using the commands below:
52+
53+
kubectl exec --namespace {{ include "common.names.namespace" . }} -it {{ template "common.names.fullname" . }}-client -- bash
54+
{{- $etcdAuthOptions := include "etcd.authOptions" . }}
55+
etcdctl {{ $etcdAuthOptions }} put /message Hello
56+
etcdctl {{ $etcdAuthOptions }} get /message
57+
58+
To connect to your etcd server from outside the cluster execute the following commands:
59+
60+
{{- if contains "NodePort" .Values.service.type }}
61+
62+
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
63+
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
64+
echo "etcd URL: http://$NODE_IP:$NODE_PORT/"
65+
66+
{{- else if contains "LoadBalancer" .Values.service.type }}
67+
68+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
69+
Watch the status with: 'kubectl get svc --namespace {{ include "common.names.namespace" . }} -w {{ template "common.names.fullname" . }}'
70+
71+
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
72+
echo "etcd URL: http://$SERVICE_IP:{{ .Values.service.ports.client }}/"
73+
74+
{{- else if contains "ClusterIP" .Values.service.type }}
75+
76+
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} {{ .Values.service.ports.client }}:{{ .Values.service.ports.client }} &
77+
echo "etcd URL: http://127.0.0.1:{{ .Values.service.ports.client }}"
78+
79+
{{- end }}
80+
{{- if or .Values.auth.rbac.create .Values.auth.rbac.enabled }}
81+
82+
* As rbac is enabled you should add the flag `--user root:$ETCD_ROOT_PASSWORD` to the etcdctl commands. Use the command below to export the password:
83+
84+
export ETCD_ROOT_PASSWORD=$(kubectl get secret --namespace {{ include "common.names.namespace" . }} {{ if .Values.auth.rbac.existingSecret }}{{ .Values.auth.rbac.existingSecret }}{{ else }}{{ template "common.names.fullname" . }}{{ end }} -o jsonpath="{{ if .Values.auth.rbac.existingSecret }}{.data.{{ .Values.auth.rbac.existingSecretPasswordKey }}}{{ else }}{.data.etcd-root-password}{{ end }}" | base64 -d)
85+
86+
{{- end }}
87+
{{- if .Values.auth.client.secureTransport }}
88+
{{- if .Values.auth.client.useAutoTLS }}
89+
90+
* As TLS is enabled you should add the flag `--cert-file /drycc/etcd/data/fixtures/client/cert.pem --key-file /drycc/etcd/data/fixtures/client/key.pem --insecure-skip-tls-verify` to the etcdctl commands.
91+
92+
{{- else }}
93+
94+
* As TLS is enabled you should add the flag `--cert-file /opt/drycc/etcd/certs/client/{{ .Values.auth.client.certFilename }} --key-file /opt/drycc/etcd/certs/client/{{ .Values.auth.client.certKeyFilename }}` to the etcdctl commands.
95+
96+
{{- end }}
97+
98+
* You should also export a proper etcdctl endpoint using the https schema. Eg.
99+
100+
export ETCDCTL_ENDPOINTS=https://{{ template "common.names.fullname" . }}-0:{{ .Values.service.ports.client }}
101+
102+
{{- end }}
103+
{{- if .Values.auth.client.enableAuthentication }}
104+
105+
* As TLS host authentication is enabled you should add the flag `--ca-file /opt/drycc/etcd/certs/client/{{ .Values.auth.client.caFilename | default "ca.crt" }}` to the etcdctl commands.
106+
107+
{{- end }}
108+
{{- $autoCompactionValue := (regexReplaceAll "[^0-9]" .Values.autoCompactionRetention "" | int) }}
109+
{{- if and .Values.defrag.enabled (or (empty .Values.autoCompactionRetention) (eq $autoCompactionValue 0)) }}
110+
111+
* Disk defragmentation in etcd is most effective when paired with key history auto compaction. Consider setting "autoCompactionRetention > 0".
112+
113+
{{- end }}
114+
{{- end }}
115+
116+
{{- include "common.warnings.rollingTag" .Values.image }}
117+
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
118+
{{- include "etcd.validateValues" . }}
119+
{{- include "common.warnings.resources" (dict "sections" (list "" "volumePermissions" "preUpgradeJob" "disasterRecovery.cronjob") "context" $) }}
120+
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image .Values.volumePermissions.image) "context" $) }}
121+
{{- include "common.errors.insecureImages" (dict "images" (list .Values.image .Values.volumePermissions.image) "context" $) }}
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
{{/*
2+
Copyright Broadcom, Inc. All Rights Reserved.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{/* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return the proper etcd image name
10+
*/}}
11+
{{- define "etcd.image" -}}
12+
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
13+
{{- end -}}
14+
15+
{{/*
16+
Return the proper image name (for the init container volume-permissions image)
17+
*/}}
18+
{{- define "etcd.volumePermissions.image" -}}
19+
{{ include "common.images.image" (dict "imageRoot" .Values.volumePermissions.image "global" .Values.global) }}
20+
{{- end -}}
21+
22+
{{/*
23+
Return the proper Docker Image Registry Secret Names
24+
*/}}
25+
{{- define "etcd.imagePullSecrets" -}}
26+
{{ include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.volumePermissions.image) "global" .Values.global) }}
27+
{{- end -}}
28+
29+
{{/*
30+
Return the proper etcd peer protocol
31+
*/}}
32+
{{- define "etcd.peerProtocol" -}}
33+
{{- if .Values.auth.peer.secureTransport -}}
34+
{{- print "https" -}}
35+
{{- else -}}
36+
{{- print "http" -}}
37+
{{- end -}}
38+
{{- end -}}
39+
40+
{{/*
41+
Return the proper etcd client protocol
42+
*/}}
43+
{{- define "etcd.clientProtocol" -}}
44+
{{- if .Values.auth.client.secureTransport -}}
45+
{{- print "https" -}}
46+
{{- else -}}
47+
{{- print "http" -}}
48+
{{- end -}}
49+
{{- end -}}
50+
51+
{{/*
52+
Return the proper etcdctl authentication options
53+
*/}}
54+
{{- define "etcd.authOptions" -}}
55+
{{- $rbacOption := "--user root:$ROOT_PASSWORD" -}}
56+
{{- $certsOption := " --cert $ETCD_CERT_FILE --key $ETCD_KEY_FILE" -}}
57+
{{- $autoCertsOption := " --cert /drycc/etcd/data/fixtures/client/cert.pem --key /drycc/etcd/data/fixtures/client/key.pem --insecure-skip-tls-verify" -}}
58+
{{- $caOption := " --cacert $ETCD_TRUSTED_CA_FILE" -}}
59+
{{- $insecureTlsOption := " --insecure-skip-tls-verify" -}}
60+
{{- if or .Values.auth.rbac.create .Values.auth.rbac.enabled -}}
61+
{{- printf "%s" $rbacOption -}}
62+
{{- end -}}
63+
{{- if and .Values.auth.client.secureTransport .Values.auth.client.useAutoTLS -}}
64+
{{- printf "%s" $autoCertsOption -}}
65+
{{- else if and .Values.auth.client.secureTransport (not .Values.auth.client.useAutoTLS) -}}
66+
{{- printf "%s" $certsOption -}}
67+
{{- if or .Values.auth.client.enableAuthentication .Values.auth.client.caFilename -}}
68+
{{- printf "%s" $caOption -}}
69+
{{- else -}}
70+
{{- printf "%s" $insecureTlsOption -}}
71+
{{- end -}}
72+
{{- end -}}
73+
{{- end -}}
74+
75+
{{/*
76+
Return the etcd configuration configmap
77+
*/}}
78+
{{- define "etcd.configmapName" -}}
79+
{{- if .Values.existingConfigmap -}}
80+
{{- printf "%s" (tpl .Values.existingConfigmap $) | trunc 63 | trimSuffix "-" -}}
81+
{{- else -}}
82+
{{- printf "%s-configuration" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
83+
{{- end -}}
84+
{{- end -}}
85+
86+
{{/*
87+
Return true if a configmap object should be created
88+
*/}}
89+
{{- define "etcd.createConfigmap" -}}
90+
{{- if and .Values.configuration (not .Values.existingConfigmap) }}
91+
{{- true -}}
92+
{{- end -}}
93+
{{- end -}}
94+
95+
{{/*
96+
Return the secret with etcd credentials
97+
*/}}
98+
{{- define "etcd.secretName" -}}
99+
{{- if .Values.auth.rbac.existingSecret -}}
100+
{{- printf "%s" .Values.auth.rbac.existingSecret | trunc 63 | trimSuffix "-" -}}
101+
{{- else -}}
102+
{{- printf "%s" (include "common.names.fullname" .) -}}
103+
{{- end -}}
104+
{{- end -}}
105+
106+
{{/*
107+
Get the secret password key to be retrieved from etcd secret.
108+
*/}}
109+
{{- define "etcd.secretPasswordKey" -}}
110+
{{- if and .Values.auth.rbac.existingSecret .Values.auth.rbac.existingSecretPasswordKey -}}
111+
{{- printf "%s" .Values.auth.rbac.existingSecretPasswordKey -}}
112+
{{- else -}}
113+
{{- printf "etcd-root-password" -}}
114+
{{- end -}}
115+
{{- end -}}
116+
117+
{{/*
118+
Return true if a secret object should be created for the etcd token private key
119+
*/}}
120+
{{- define "etcd.token.createSecret" -}}
121+
{{- if and (eq .Values.auth.token.enabled true) (eq .Values.auth.token.type "jwt") (empty .Values.auth.token.privateKey.existingSecret) }}
122+
{{- true -}}
123+
{{- end -}}
124+
{{- end -}}
125+
126+
{{/*
127+
Return the secret with etcd token private key
128+
*/}}
129+
{{- define "etcd.token.secretName" -}}
130+
{{- if .Values.auth.token.privateKey.existingSecret -}}
131+
{{- printf "%s" .Values.auth.token.privateKey.existingSecret | trunc 63 | trimSuffix "-" -}}
132+
{{- else -}}
133+
{{- printf "%s-jwt-token" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
134+
{{- end -}}
135+
{{- end -}}
136+
137+
{{/*
138+
Return the proper Disaster Recovery PVC name
139+
*/}}
140+
{{- define "etcd.disasterRecovery.pvc.name" -}}
141+
{{- if .Values.disasterRecovery.pvc.existingClaim -}}
142+
{{- printf "%s" (tpl .Values.disasterRecovery.pvc.existingClaim $) | trunc 63 | trimSuffix "-" -}}
143+
{{- else if .Values.startFromSnapshot.existingClaim -}}
144+
{{- printf "%s" (tpl .Values.startFromSnapshot.existingClaim $) | trunc 63 | trimSuffix "-" -}}
145+
{{- else -}}
146+
{{- printf "%s-snapshotter" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
147+
{{- end -}}
148+
{{- end -}}
149+
150+
{{/*
151+
Create the name of the service account to use
152+
*/}}
153+
{{- define "etcd.serviceAccountName" -}}
154+
{{- if .Values.serviceAccount.create -}}
155+
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
156+
{{- else -}}
157+
{{ default "default" .Values.serviceAccount.name | trunc 63 | trimSuffix "-" }}
158+
{{- end -}}
159+
{{- end -}}
160+
161+
{{/*
162+
Compile all warnings into a single message, and call fail.
163+
*/}}
164+
{{- define "etcd.validateValues" -}}
165+
{{- $messages := list -}}
166+
{{- $messages := append $messages (include "etcd.validateValues.startFromSnapshot.existingClaim" .) -}}
167+
{{- $messages := append $messages (include "etcd.validateValues.startFromSnapshot.snapshotFilename" .) -}}
168+
{{- $messages := append $messages (include "etcd.validateValues.disasterRecovery" .) -}}
169+
{{- $messages := without $messages "" -}}
170+
{{- $message := join "\n" $messages -}}
171+
172+
{{- if $message -}}
173+
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
174+
{{- end -}}
175+
{{- end -}}
176+
177+
{{/* Validate values of etcd - an existing claim must be provided when startFromSnapshot is enabled */}}
178+
{{- define "etcd.validateValues.startFromSnapshot.existingClaim" -}}
179+
{{- if and .Values.startFromSnapshot.enabled (not .Values.startFromSnapshot.existingClaim) (not .Values.disasterRecovery.enabled) -}}
180+
etcd: startFromSnapshot.existingClaim
181+
An existing claim must be provided when startFromSnapshot is enabled and disasterRecovery is disabled!!
182+
Please provide it (--set startFromSnapshot.existingClaim="xxxx")
183+
{{- end -}}
184+
{{- end -}}
185+
186+
{{/* Validate values of etcd - the snapshot filename must be provided when startFromSnapshot is enabled */}}
187+
{{- define "etcd.validateValues.startFromSnapshot.snapshotFilename" -}}
188+
{{- if and .Values.startFromSnapshot.enabled (not .Values.startFromSnapshot.snapshotFilename) (not .Values.disasterRecovery.enabled) -}}
189+
etcd: startFromSnapshot.snapshotFilename
190+
The snapshot filename must be provided when startFromSnapshot is enabled and disasterRecovery is disabled!!
191+
Please provide it (--set startFromSnapshot.snapshotFilename="xxxx")
192+
{{- end -}}
193+
{{- end -}}
194+
195+
{{/* Validate values of etcd - persistence must be enabled when disasterRecovery is enabled */}}
196+
{{- define "etcd.validateValues.disasterRecovery" -}}
197+
{{- if and .Values.disasterRecovery.enabled (not .Values.persistence.enabled) -}}
198+
etcd: disasterRecovery
199+
Persistence must be enabled when disasterRecovery is enabled!!
200+
Please enable persistence (--set persistence.enabled=true)
201+
{{- end -}}
202+
{{- end -}}
203+
204+
{{- define "etcd.token.jwtToken" -}}
205+
{{- if (include "etcd.token.createSecret" .) -}}
206+
{{- $jwtToken := lookup "v1" "Secret" (include "common.names.namespace" .) (printf "%s-jwt-token" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" ) -}}
207+
{{- if $jwtToken -}}
208+
{{ index $jwtToken "data" "jwt-token.pem" | b64dec }}
209+
{{- else -}}
210+
{{ genPrivateKey "rsa" }}
211+
{{- end -}}
212+
{{- end -}}
213+
{{- end -}}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- /*
2+
Copyright Broadcom, Inc. All Rights Reserved.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if (include "etcd.createConfigmap" .) }}
7+
apiVersion: v1
8+
kind: ConfigMap
9+
metadata:
10+
name: {{ printf "%s-configuration" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13+
app.kubernetes.io/component: etcd
14+
{{- if .Values.commonAnnotations }}
15+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
16+
{{- end }}
17+
data:
18+
etcd.conf.yml: |-
19+
{{- include "common.tplvalues.render" ( dict "value" .Values.configuration "context" $ ) | nindent 4 }}
20+
{{- end }}

0 commit comments

Comments
 (0)