From bb6470d3b5cea38d09c3277fe5fb9d3cad9c0fb7 Mon Sep 17 00:00:00 2001 From: semihbkgr Date: Tue, 30 Jul 2024 15:56:26 +0300 Subject: [PATCH] update the enterprise chart --- .../templates/_helpers.tpl | 21 +++++++++---------- .../templates/config.yaml | 2 +- .../templates/statefulset.yaml | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/stable/hazelcast-enterprise/templates/_helpers.tpl b/stable/hazelcast-enterprise/templates/_helpers.tpl index edcb31ae..57875b3c 100644 --- a/stable/hazelcast-enterprise/templates/_helpers.tpl +++ b/stable/hazelcast-enterprise/templates/_helpers.tpl @@ -54,19 +54,18 @@ Create the name of the service to use {{- end -}} {{/* -Create the config of the service-name to use +Generate the Hazelcast configuration, ensuring that any conflicting discovery configurations are resolved. +Remove the default value for the 'service-name' field when other discovery mechanisms are explicitly used. */}} -{{- define "hazelcast.serviceNameConfig" -}} -{{- if and ((((((.Values.hazelcast).yaml).hazelcast).network).join).kubernetes) - (or - (index .Values.hazelcast.yaml.hazelcast.network.join.kubernetes "service-dns") - (index .Values.hazelcast.yaml.hazelcast.network.join.kubernetes "service-label-name") - (index .Values.hazelcast.yaml.hazelcast.network.join.kubernetes "pod-label-name") - ) -}} - {{ default "" }} -{{- else -}} - {{ template "hazelcast.serviceName" .}} +{{- define "hazelcast.config" -}} +{{- $config := .Values.hazelcast.yaml | deepCopy -}} +{{- $k8sJoin := $config.hazelcast.network.join.kubernetes -}} +{{- if and $k8sJoin -}} + {{- if or (index $k8sJoin "service-dns") (index $k8sJoin "service-label-name") (index $k8sJoin "pod-label-name") -}} + {{- $_ := unset $k8sJoin "service-name" -}} + {{- end -}} {{- end -}} +{{- toYaml $config -}} {{- end -}} {{/* diff --git a/stable/hazelcast-enterprise/templates/config.yaml b/stable/hazelcast-enterprise/templates/config.yaml index 86cfc9f1..7c63368d 100644 --- a/stable/hazelcast-enterprise/templates/config.yaml +++ b/stable/hazelcast-enterprise/templates/config.yaml @@ -21,5 +21,5 @@ data: {{ $val | indent 4}} {{- end }} hazelcast.yaml: |- -{{ toYaml .Values.hazelcast.yaml | indent 4 }} +{{ include "hazelcast.config" . | indent 4 }} {{- end -}} diff --git a/stable/hazelcast-enterprise/templates/statefulset.yaml b/stable/hazelcast-enterprise/templates/statefulset.yaml index 3b21c5c5..d5f6c68c 100644 --- a/stable/hazelcast-enterprise/templates/statefulset.yaml +++ b/stable/hazelcast-enterprise/templates/statefulset.yaml @@ -173,7 +173,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} - name: JAVA_OPTS - value: "-Dhazelcast.config=/data/hazelcast/hazelcast.yaml -DserviceName={{ template "hazelcast.serviceNameConfig" . }} -Dnamespace={{ .Release.Namespace }} -Dhazelcast.persistence={{ .Values.persistence.enabled }} {{ if .Values.persistence.enabled }}-Dhazelcast.stale.join.prevention.duration.seconds=5{{ end }} -Dhz.jet.enabled={{ .Values.jet.enabled }} {{ if .Values.gracefulShutdown.enabled }}-Dhazelcast.shutdownhook.policy=GRACEFUL -Dhazelcast.shutdownhook.enabled=true -Dhazelcast.graceful.shutdown.max.wait={{ .Values.gracefulShutdown.maxWaitSeconds }} {{ end }} -Dhazelcast.cluster.version.auto.upgrade.enabled={{ .Values.hazelcast.updateClusterVersionAfterRollingUpgrade }} {{ if .Values.metrics.enabled }}-Dhazelcast.jmx=true{{ end }} {{ .Values.hazelcast.javaOpts }}" + value: "-Dhazelcast.config=/data/hazelcast/hazelcast.yaml -DserviceName={{ template "hazelcast.serviceName" . }} -Dnamespace={{ .Release.Namespace }} -Dhazelcast.persistence={{ .Values.persistence.enabled }} {{ if .Values.persistence.enabled }}-Dhazelcast.stale.join.prevention.duration.seconds=5{{ end }} -Dhz.jet.enabled={{ .Values.jet.enabled }} {{ if .Values.gracefulShutdown.enabled }}-Dhazelcast.shutdownhook.policy=GRACEFUL -Dhazelcast.shutdownhook.enabled=true -Dhazelcast.graceful.shutdown.max.wait={{ .Values.gracefulShutdown.maxWaitSeconds }} {{ end }} -Dhazelcast.cluster.version.auto.upgrade.enabled={{ .Values.hazelcast.updateClusterVersionAfterRollingUpgrade }} {{ if .Values.metrics.enabled }}-Dhazelcast.jmx=true{{ end }} {{ .Values.hazelcast.javaOpts }}" {{- if .Values.hazelcast.loggingLevel }} - name: LOGGING_LEVEL value: {{ .Values.hazelcast.loggingLevel }}