Skip to content

Commit

Permalink
fix: customizing cluster domain
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasPius authored May 18, 2024
1 parent 0536a54 commit 87ec145
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
10 changes: 5 additions & 5 deletions charts/kamaji-etcd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.1
version: 0.5.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand All @@ -27,7 +27,7 @@ home: https://github.com/clastix/kamaji-etcd
sources: ["https://github.com/clastix/kamaji-etcd"]
kubeVersion: ">=1.22.0-0"
maintainers:
- email: [email protected]
name: Adriano Pezzuto
- email: [email protected]
name: Dario Tranchitella
- email: [email protected]
name: Adriano Pezzuto
- email: [email protected]
name: Dario Tranchitella
3 changes: 2 additions & 1 deletion charts/kamaji-etcd/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kamaji-etcd

![Version: 0.5.1](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.5.6](https://img.shields.io/badge/AppVersion-3.5.6-informational?style=flat-square)
![Version: 0.5.2](https://img.shields.io/badge/Version-0.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.5.6](https://img.shields.io/badge/AppVersion-3.5.6-informational?style=flat-square)

Helm chart for deploying a multi-tenant `etcd` cluster.

Expand Down Expand Up @@ -80,6 +80,7 @@ Here the values you can override:
| backup.snapshotDateFormat | string | `"$(date +%Y%m%d)"` | The backup file date format (bash) |
| backup.snapshotNamePrefix | string | `"mysnapshot"` | The backup file name prefix |
| clientPort | int | `2379` | The client request port. |
| clusterDomain | string | `"cluster.local"` | Domain of the Kubernetes cluster. |
| datastore.enabled | bool | `false` | Create a datastore custom resource for Kamaji |
| defragmentation | object | `{"schedule":"*/15 * * * *"}` | Enable storage defragmentation |
| defragmentation.schedule | string | `"*/15 * * * *"` | The job scheduled maintenance time for defrag (empty to disable) |
Expand Down
6 changes: 3 additions & 3 deletions charts/kamaji-etcd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Comma separated list of etcd cluster peers.
{{- $outer := . -}}
{{- $list := list -}}
{{- range $i, $count := until (int $.Values.replicas) -}}
{{- $list = append $list ( printf "%s-%d=https://%s-%d.%s.%s.svc.cluster.local:%d" ( include "etcd.stsName" $outer ) $i ( include "etcd.fullname" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace (int $.Values.peerApiPort) ) -}}
{{- $list = append $list ( printf "%s-%d=https://%s-%d.%s.%s.svc.%s:%d" ( include "etcd.stsName" $outer ) $i ( include "etcd.fullname" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace $.Values.clusterDomain (int $.Values.peerApiPort) ) -}}
{{- end }}
{{- join "," $list -}}
{{- end }}
Expand All @@ -136,7 +136,7 @@ Space separated list of etcd cluster endpoints.
{{- $outer := . -}}
{{- $list := list -}}
{{- range $i, $count := until (int $.Values.replicas) -}}
{{- $list = append $list ( printf "%s-%d.%s.%s.svc.cluster.local:%d" ( include "etcd.stsName" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace (int $.Values.clientPort) ) -}}
{{- $list = append $list ( printf "%s-%d.%s.%s.svc.%s:%d" ( include "etcd.stsName" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace $.Values.clusterDomain (int $.Values.clientPort) ) -}}
{{- end }}
{{- join " " $list -}}
{{- end }}
Expand All @@ -147,7 +147,7 @@ Space separated list of etcd cluster endpoints.
{{- define "etcd.endpointsYAML" }}
{{- $outer := . -}}
{{- range $i, $count := until (int $.Values.replicas) -}}
{{ printf "- %s-%d.%s.%s.svc.cluster.local:%d\n" ( include "etcd.stsName" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace (int $.Values.clientPort) }}
{{ printf "- %s-%d.%s.%s.svc.%s:%d\n" ( include "etcd.stsName" $outer ) $count ( include "etcd.serviceName" $outer ) $.Release.Namespace $.Values.clusterDomain (int $.Values.clientPort) }}
{{- end }}
{{- end }}

Expand Down
6 changes: 3 additions & 3 deletions charts/kamaji-etcd/templates/etcd_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ data:
},
"hosts": [
{{- range $count := until (int $.Values.replicas) -}}
{{ printf "\"%s-%d.%s.%s.svc.cluster.local\"," ( include "etcd.fullname" $outer ) $count (include "etcd.serviceName" $outer) $.Release.Namespace }}
{{ printf "\"%s-%d.%s.%s.svc.%s\"," ( include "etcd.fullname" $outer ) $count (include "etcd.serviceName" $outer) $.Release.Namespace $.Values.clusterDomain }}
{{- end }}
"etcd-server.{{ .Release.Namespace }}.svc.cluster.local",
"etcd-server.{{ .Release.Namespace }}.svc.{{ $.Values.clusterDomain }}",
"etcd-server.{{ .Release.Namespace }}.svc",
"etcd-server",
"127.0.0.1"
Expand All @@ -76,7 +76,7 @@ data:
{{ printf "\"%s-%d\"," ( include "etcd.stsName" $outer ) $count }}
{{ printf "\"%s-%d.%s\"," ( include "etcd.stsName" $outer ) $count (include "etcd.serviceName" $outer) }}
{{ printf "\"%s-%d.%s.%s.svc\"," ( include "etcd.stsName" $outer ) $count (include "etcd.serviceName" $outer) $.Release.Namespace }}
{{ printf "\"%s-%d.%s.%s.svc.cluster.local\"," ( include "etcd.stsName" $outer ) $count (include "etcd.serviceName" $outer) $.Release.Namespace }}
{{ printf "\"%s-%d.%s.%s.svc.%s\"," ( include "etcd.stsName" $outer ) $count (include "etcd.serviceName" $outer) $.Release.Namespace $.Values.clusterDomain }}
{{- end }}
"127.0.0.1"
]
Expand Down
2 changes: 1 addition & 1 deletion charts/kamaji-etcd/templates/etcd_job_preinstall_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
fi
env:
- name: ETCDCTL_ENDPOINTS
value: https://{{ include "etcd.fullname" . }}-0.{{ include "etcd.serviceName" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.clientPort }}
value: https://{{ include "etcd.fullname" . }}-0.{{ include "etcd.serviceName" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:{{ .Values.clientPort }}
- name: ETCDCTL_CACERT
value: /opt/certs/ca/ca.crt
- name: ETCDCTL_CERT
Expand Down
4 changes: 2 additions & 2 deletions charts/kamaji-etcd/templates/etcd_sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ spec:
- --name=$(POD_NAME)
- --initial-cluster-state=new
- --initial-cluster={{ include "etcd.initialCluster" . }}
- --initial-advertise-peer-urls=https://$(POD_NAME).{{ include "etcd.serviceName" . }}.$(POD_NAMESPACE).svc.cluster.local:{{ .Values.peerApiPort }}
- --advertise-client-urls=https://$(POD_NAME).{{ include "etcd.serviceName" . }}.$(POD_NAMESPACE).svc.cluster.local:{{ .Values.clientPort }}
- --initial-advertise-peer-urls=https://$(POD_NAME).{{ include "etcd.serviceName" . }}.$(POD_NAMESPACE).svc.{{ .Values.clusterDomain }}:{{ .Values.peerApiPort }}
- --advertise-client-urls=https://$(POD_NAME).{{ include "etcd.serviceName" . }}.$(POD_NAMESPACE).svc.{{ .Values.clusterDomain }}:{{ .Values.clientPort }}
- --initial-cluster-token=kamaji
- --listen-client-urls=https://0.0.0.0:{{ .Values.clientPort }}
- --listen-metrics-urls=http://0.0.0.0:{{ .Values.metricsPort }}
Expand Down
3 changes: 3 additions & 0 deletions charts/kamaji-etcd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ livenessProbe: {}
# periodSeconds: 10
# timeoutSeconds: 15

# -- Domain of the Kubernetes cluster.
clusterDomain: "cluster.local"

# -- A list of extra arguments to add to the etcd default ones
extraArgs: []
#- --log-level=warn
Expand Down

0 comments on commit 87ec145

Please sign in to comment.