Skip to content

Commit

Permalink
chart: Support custom labels variable for etcd
Browse files Browse the repository at this point in the history
Signed-off-by: xin.li <[email protected]>
  • Loading branch information
my-git9 committed Feb 10, 2023
1 parent 57236e5 commit 4304597
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
2 changes: 2 additions & 0 deletions charts/karmada/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ helm install karmada-scheduler-estimator -n karmada-system ./charts/karmada
| `certs.custom.frontProxyCaCrt` | CA CRT of the front proxy certificate | `""` |
| `certs.custom.frontProxyCrt` | CRT of the front proxy certificate | `""` |
| `certs.custom.frontProxyKey` | KEY of the front proxy certificate | `""` |
| `etcd.labels` | Labels of etcd statefulset | `{"app": "etcd"}` |
| `etcd.podLabels` | Labels of etcd pods | `{}` |
| `etcd.mode` | Mode "external" and "internal" are provided, "external" means use external ectd, "internal" means install a etcd in the cluster | `"internal"` |
| `etcd.external.servers` | Servers of etcd | `""` |
| `etcd.external.registryPrefix` | Use to registry prefix of etcd | `"/registry/karmada"` |
Expand Down
18 changes: 18 additions & 0 deletions charts/karmada/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ app: {{- include "karmada.name" .}}-apiserver
{{- end }}
{{- end -}}

{{- define "karmada.etcd.labels" -}}
{{- if .Values.etcd.labels }}
{{- range $key, $value := .Values.etcd.labels }}
{{ $key }}: {{ $value }}
{{- end }}
{{- else}}
app: etcd
{{- end }}
{{- end -}}

{{- define "karmada.etcd.podLabels" -}}
{{- if .Values.etcd.podLabels }}
{{- range $key, $value := .Values.etcd.podLabels }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end -}}

{{- define "karmada.aggregatedApiserver.labels" -}}
{{- if .Values.aggregatedApiServer.labels }}
{{- range $key, $value := .Values.aggregatedApiServer.labels }}
Expand Down
15 changes: 8 additions & 7 deletions charts/karmada/templates/etcd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ metadata:
name: etcd
namespace: {{ include "karmada.namespace" . }}
labels:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.etcd.internal.replicaCount }}
serviceName: etcd
selector:
matchLabels:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 6 }}
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 8 }}
{{- include "karmada.etcd.podLabels" . | nindent 8 }}
spec:
automountServiceAccountToken: false
{{- include "karmada.internal.etcd.imagePullSecrets" . | nindent 6 }}
Expand Down Expand Up @@ -126,7 +127,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 4 }}
name: etcd-client
namespace: {{ include "karmada.namespace" . }}
spec:
Expand All @@ -136,13 +137,13 @@ spec:
protocol: TCP
targetPort: 2379
selector:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
labels:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 4 }}
name: etcd
namespace: {{ include "karmada.namespace" . }}
spec:
Expand All @@ -157,5 +158,5 @@ spec:
targetPort: 2380
clusterIP: None
selector:
app: etcd
{{- include "karmada.etcd.labels" . | nindent 4 }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/karmada/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@ kubeControllerManager:

## etcd config
etcd:
## @param etcd.labels labels of the etcd statefulset
labels:
app: etcd
## @param etcd.labels labels of the etcd pods
podLabels: {}
## @param etcd.mode "external" and "internal" are provided
## "external" means use external ectd
## "internal" means install a etcd in the cluster
Expand Down

0 comments on commit 4304597

Please sign in to comment.