This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git
The following commit(s) were added to refs/heads/refactor-with-go by this push:
new 1bc2052f fix zookeepr (#1023)
1bc2052f is described below
commit 1bc2052f643edb12ec36418c6f2d93b093f52eac
Author: Mford Jody <[email protected]>
AuthorDate: Fri Mar 10 14:57:02 2023 +0800
fix zookeepr (#1023)
---
.../charts/zookeeper/templates/_charts.tpl | 135 +++++++++++++++++----
.../charts/zookeeper/templates/configmap.yaml | 1 +
2 files changed, 113 insertions(+), 23 deletions(-)
diff --git a/deploy/charts/admin-stack/charts/zookeeper/templates/_charts.tpl
b/deploy/charts/admin-stack/charts/zookeeper/templates/_charts.tpl
index 36b2d789..ec509e30 100644
--- a/deploy/charts/admin-stack/charts/zookeeper/templates/_charts.tpl
+++ b/deploy/charts/admin-stack/charts/zookeeper/templates/_charts.tpl
@@ -1,31 +1,34 @@
-{{/* vim: set filetype=mustache: */}}
{{/*
-Return the proper Storage Class
-{{ include "common.storage.class" ( dict "persistence"
.Values.path.to.the.persistence "global" $) }}
+Create chart name and version as used by the chart label.
*/}}
-{{- define "zookeeper.storage.class" -}}
-
-{{- $storageClass := .persistence.storageClass -}}
-{{- if .global -}}
- {{- if .global.storageClass -}}
- {{- $storageClass = .global.storageClass -}}
- {{- end -}}
+{{- define "zookeeper.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 |
trimSuffix "-" -}}
{{- end -}}
-{{- if $storageClass -}}
- {{- if (eq "-" $storageClass) -}}
- {{- printf "storageClassName: \"\"" -}}
- {{- else }}
- {{- printf "storageClassName: %s" $storageClass -}}
- {{- end -}}
+
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "zookeeper.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+{{/*
+Return the appropriate apiVersion for statefulset.
+*/}}
+{{- define "zookeeper.statefulset.apiVersion" -}}
+{{- if semverCompare "<1.14-0" (include "zookeeper.capabilities.kubeVersion"
.) -}}
+{{- print "apps/v1beta1" -}}
+{{- else -}}
+{{- print "apps/v1" -}}
+{{- end -}}
{{- end -}}
{{/*
Return the target Kubernetes version
*/}}
-{{- define "zookeeper.kubeVersion" -}}
+{{- define "zookeeper.capabilities.kubeVersion" -}}
{{- if .Values.global }}
{{- if .Values.global.kubeVersion }}
{{- .Values.global.kubeVersion -}}
@@ -37,14 +40,51 @@ Return the target Kubernetes version
{{- end -}}
{{- end -}}
-{{- define "zookeeper.statefulset.apiVersion" -}}
-{{- if semverCompare "<1.14-0" (include "zookeeper.kubeVersion" .) -}}
-{{- print "apps/v1beta1" -}}
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to
this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "zookeeper.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
-{{- print "apps/v1" -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+
+{{/*
+Return ZooKeeper Namespace to use
+*/}}
+{{- define "zookeeper.namespace" -}}
+{{- if .Values.namespaceOverride -}}
+ {{- .Values.namespaceOverride -}}
+{{- else -}}
+ {{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
+{{- define "zookeeper.labels" -}}
+app.kubernetes.io/name: {{ include "zookeeper.name" . }}
+helm.sh/chart: {{ include "zookeeper.chart" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end -}}
+
+
+
+{{/*
+Labels to use on sts.spec.selector.matchLabels and svc.spec.selector
+*/}}
+{{- define "zookeeper.matchLabels" -}}
+app.kubernetes.io/name: {{ include "zookeeper.name" . }}
+{{- end -}}
{{/*
Return the appropriate apiVersion for networkpolicy.
@@ -57,12 +97,26 @@ Return the appropriate apiVersion for networkpolicy.
{{- end -}}
{{- end -}}
+{{/*
+Return the target Kubernetes version
+*/}}
+{{- define "zookeeper.kubeVersion" -}}
+{{- if .Values.global }}
+ {{- if .Values.global.kubeVersion }}
+ {{- .Values.global.kubeVersion -}}
+ {{- else }}
+ {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
+ {{- end -}}
+{{- else }}
+{{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}}
+{{- end -}}
+{{- end -}}
{{/* vim: set filetype=mustache: */}}
{{/*
Renders a value that contains template.
Usage:
-{{ include "zookeeper.tplvalues" ( dict "value" .Values.path.to.the.Value
"context" $) }}
+{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value
"context" $) }}
*/}}
{{- define "zookeeper.tplvalues" -}}
{{- if typeIs "string" .value }}
@@ -72,7 +126,6 @@ Usage:
{{- end }}
{{- end -}}
-
{{/*
Return the appropriate apiVersion for poddisruptionbudget.
*/}}
@@ -82,4 +135,40 @@ Return the appropriate apiVersion for poddisruptionbudget.
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
+{{- end -}}
+
+{{/* vim: set filetype=mustache: */}}
+{{/*
+Return the proper Storage Class
+{{ include "common.storage.class" ( dict "persistence"
.Values.path.to.the.persistence "global" $) }}
+*/}}
+{{- define "zookeeper.storage.class" -}}
+
+{{- $storageClass := .persistence.storageClass -}}
+{{- if .global -}}
+ {{- if .global.storageClass -}}
+ {{- $storageClass = .global.storageClass -}}
+ {{- end -}}
+{{- end -}}
+
+{{- if $storageClass -}}
+ {{- if (eq "-" $storageClass) -}}
+ {{- printf "storageClassName: \"\"" -}}
+ {{- else }}
+ {{- printf "storageClassName: %s" $storageClass -}}
+ {{- end -}}
+{{- end -}}
+
+{{- end -}}
+
+
+{{/*
+Return the ZooKeeper configuration ConfigMap name
+*/}}
+{{- define "zookeeper.configmapName" -}}
+{{- if .Values.existingConfigmap -}}
+ {{- printf "%s" (tpl .Values.existingConfigmap $) -}}
+{{- else -}}
+ {{- printf "%s" (include "zookeeper.fullname" .) -}}
+{{- end -}}
{{- end -}}
\ No newline at end of file
diff --git
a/deploy/charts/admin-stack/charts/zookeeper/templates/configmap.yaml
b/deploy/charts/admin-stack/charts/zookeeper/templates/configmap.yaml
index 4b7b8758..ae536bea 100644
--- a/deploy/charts/admin-stack/charts/zookeeper/templates/configmap.yaml
+++ b/deploy/charts/admin-stack/charts/zookeeper/templates/configmap.yaml
@@ -22,6 +22,7 @@ metadata:
data:
setup.sh: |-
#!/bin/bash
+
# Execute entrypoint as usual after obtaining ZOO_SERVER_ID
# check ZOO_SERVER_ID in persistent volume via myid
# if not present, set based on POD hostname