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

Feature/ensure pods restart when configmap changes #157

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions helm-charts/charts/kube-starrocks/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,31 @@ be.conf: |
{{- define "starrockscluster.be.log.path" -}}
{{- print "/opt/starrocks/be/log" }}
{{- end }}

{{/*
starrockscluster.fe.config.hash is used to calculate the hash value of the fe.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.fe.config.hash" }}
{{- $hash := toJson .Values.starrocksFESpec.config | sha256sum | trunc 8 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if user provided an empty fe/be/cn config? will this be still ok?

{{- printf "%s" $hash }}
{{- end }}


{{/*
starrockscluster.be.config.hash is used to calculate the hash value of the be.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.be.config.hash" }}
{{- $hash := toJson .Values.starrocksBeSpec.config | sha256sum | trunc 8 }}
kevincai marked this conversation as resolved.
Show resolved Hide resolved
{{- printf "%s" $hash }}
{{- end }}

{{/*
starrockscluster.cn.config.hash is used to calculate the hash value of the cn.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.cn.config.hash" }}
{{- $hash := toJson .Values.starrocksCnSpec.config | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ spec:
{{ toYaml .Values.starrocksFESpec.service.annotations | indent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.annotations }}
annotations:
app.starrocks.io/fe-config-hash: {{template "starrockscluster.fe.config.hash" . }}
{{- if .Values.starrocksFESpec.annotations }}
{{ toYaml .Values.starrocksFESpec.annotations | indent 6 }}
{{- end }}
{{- if .Values.starrocksFESpec.imagePullSecrets }}
Expand Down Expand Up @@ -134,8 +135,9 @@ spec:
{{ toYaml .Values.starrocksBeSpec.service.annotations | indent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.annotations }}
annotations:
app.starrocks.io/be-config-hash: {{template "starrockscluster.be.config.hash" . }}
{{- if .Values.starrocksBeSpec.annotations }}
{{ toYaml .Values.starrocksBeSpec.annotations | indent 6 }}
{{- end }}
{{- if .Values.starrocksBeSpec.imagePullSecrets }}
Expand Down Expand Up @@ -284,8 +286,9 @@ spec:
{{ toYaml .Values.starrocksCnSpec.service.annotations | indent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.annotations }}
annotations:
app.starrocks.io/cn-config-hash: {{template "starrockscluster.cn.config.hash" . }}
{{- if .Values.starrocksCnSpec.annotations }}
{{ toYaml .Values.starrocksCnSpec.annotations | indent 6 }}
{{- end }}
{{- if .Values.starrocksCnSpec.imagePullSecrets }}
Expand Down