This is an automated email from the ASF dual-hosted git repository.

zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 59dc37e4 [charts] Refactoring the register package (#655)
59dc37e4 is described below

commit 59dc37e42017385f27defc4e9d00bf905763390c
Author: Jian Zhong <[email protected]>
AuthorDate: Sat Mar 22 13:08:41 2025 +0800

    [charts] Refactoring the register package (#655)
---
 .../nacos/templates/_helpers.tpl                   |  53 ----------
 .../nacos/templates/configmap.yaml                 |  17 ++-
 .../nacos/templates/service.yaml                   |  89 ++++------------
 .../nacos/templates/statefulset.yaml               | 116 +++++++++------------
 .../register-discovery/nacos/values.yaml           | 110 +------------------
 .../zookeeper/templates/_helpers.tpl               |  86 +--------------
 .../zookeeper/templates/configmap.yaml             |  17 ++-
 .../zookeeper/templates/service.yaml               | 107 ++++++-------------
 .../zookeeper/templates/statefulset.yaml           |  98 ++++++++---------
 .../zookeeper/templates/zzz_profile.yaml           |   2 +-
 .../register-discovery/zookeeper/values.yaml       | 100 +-----------------
 11 files changed, 186 insertions(+), 609 deletions(-)

diff --git 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/_helpers.tpl
 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/_helpers.tpl
index acda8872..e69de29b 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/_helpers.tpl
+++ 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/_helpers.tpl
@@ -1,53 +0,0 @@
-{{/*
-Return the appropriate apiVersion for deployment or statefulset.
-*/}}
-{{- define "apiVersion" -}}
-{{- if and ($.Capabilities.APIVersions.Has "apps/v1") (semverCompare ">= 
1.14-0" .Capabilities.KubeVersion.Version) }}
-{{- print "apps/v1" }}
-{{- else }}
-{{- print "extensions/v1beta1" }}
-{{- end }}
-{{- end }}
-
-{{/*
-Return Nacos Name to use.
-*/}}
-{{- define "nacos.name" -}}
-{{- printf "nacos" -}}
-{{- end -}}
-
-{{/*
-Return Nacos Labels to use.
-*/}}
-{{- define "nacos.labels" -}}
-app: {{ template "nacos.name" . }}
-app.kubernetes.io/name: {{ template "nacos.name" . }}
-app.kubernetes.io/instance: {{ template "nacos.name" . }}
-app.kubernetes.io/component: {{ template "nacos.name" . }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
-{{- end -}}
-
-{{/*
-Return Nacos matchLabels to use.
-*/}}
-{{- define "nacos.matchLabels" -}}
-app.kubernetes.io/name: {{ template "nacos.name" . }}
-app.kubernetes.io/instance: {{ template "nacos.name" . }}
-app.kubernetes.io/component: {{ template "nacos.name" . }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
-{{- end -}}
-
-{{/*
-Return Nacos Service Selector to use.
-*/}}
-{{- define "nacos.selector" -}}
-{{ include "nacos.name" . }}
-{{- end -}}
-
-{{/*
-Return Nacos Port to use.
-*/}}
-{{- define "nacos.port" -}}
-{{- printf "8848" -}}
-{{- end -}}
-
diff --git 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
index 88ea1f7b..b7965498 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/configmap.yaml
@@ -4,17 +4,16 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ template "nacos.name" . }}-db-config
+  name: nacos-db-config
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "nacos.labels" . | nindent 4 }}
-  {{- with $nacos.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $nacos.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: nacos
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Nacos"
+    dubbo: nacos
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 data:
   {{- with $nacos.storage | default $ncs.storage }}
   mysql.db.host: {{ .db.host | default $ncs.db.host }}
diff --git 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
index 4fad1de5..30b22df0 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/service.yaml
@@ -1,106 +1,63 @@
 {{- $nacos := .Values -}}
 {{- $ncs   := .Values.nacos }}
-{{- $service := $nacos.service -}}
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "nacos.name" . }}
+  name: nacos
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "nacos.labels" . | nindent 4 }}
-  {{- with $nacos.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $nacos.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: nacos
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Nacos"
+    dubbo: nacos
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
-  {{- if $service.type }}
-  type: {{ $service.type }}
-  {{- end }}
-  {{- if $service.clusterIP }}
-  clusterIP: {{ $service.clusterIP }}
-  {{- end }}
-  {{- if $service.externalIPs }}
-  externalIPs: {{ $service.externalIPs }}
-  {{- end }}
-  {{- if $service.loadBalancerIP }}
-  loadBalancerIP: {{ $service.loadBalancerIP }}
-  {{- end }}
-  {{- if $service.loadBalancerSourceRanges }}
-  loadBalancerSourceRanges: {{ $service.loadBalancerSourceRanges }}
-  {{- end }}
-  {{- if $service.loadBalancerClass }}
-  loadBalancerClass: {{ $service.loadBalancerClass }}
-  {{- end }}
   ports:
   - name: http
-    port: {{ template "nacos.port" }}
+    port: 8848
     targetPort: http
     protocol: TCP
   - name: clientgen-rpc
-    port: {{ add $nacos.serverPort 1000 }}
+    port: {{ add 8848 1000 }}
     targetPort: clientgen-rpc
     protocol: TCP
   - name: raft-rpc
-    port: {{ add $nacos.serverPort 1001 }}
+    port: {{ add 8848 1001 }}
     targetPort: raft-rpc
     protocol: TCP
   selector:
-    app: {{ template "nacos.selector" . }}
+    app: nacos
 ---
-{{- if and (eq $nacos.mode "cluster"|default $ncs.mode) }}
+{{- if and (eq $nacos.mode "cluster" | default $ncs.mode) }}
 apiVersion: v1
 kind: Service
 metadata:
   name: {{ template "nacos.name" . }}-headless
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "nacos.labels" . | nindent 4 }}
-  {{- with .Values.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $nacos.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: nacos
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Nacos"
+    dubbo: nacos
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
-  {{- if $service.type }}
-  type: {{ $service.type }}
-  {{- end }}
-  clusterIP: None
-  {{- if $service.externalIPs }}
-  externalIPs: {{ $service.externalIPs }}
-  {{- end }}
-  {{- if $service.loadBalancerIP }}
-  loadBalancerIP: {{ $service.loadBalancerIP }}
-  {{- end }}
-  {{- if $service.loadBalancerSourceRanges }}
-  loadBalancerSourceRanges: {{ $service.loadBalancerSourceRanges }}
-  {{- end }}
-  {{- if $service.loadBalancerClass }}
-  loadBalancerClass: {{ $service.loadBalancerClass }}
-  {{- end }}
-  {{- if $service.sessionAffinity }}
-  sessionAffinity: {{ $service.sessionAffinity }}
-  {{- end }}
-  {{- if $service.publishNotReadyAddresses }}
-  publishNotReadyAddresses: {{ $service.publishNotReadyAddresses }}
-  {{- end }}
   ports:
   - name: http
     port: 8848
     targetPort: http
     protocol: TCP
   - name: clientgen-rpc
-    port: {{ add $nacos.serverPort 1000 }}
+    port: {{ add 8848 1000 }}
     targetPort: clientgen-rpc
     protocol: TCP
   - name: raft-rpc
-    port: {{ add $nacos.serverPort 1001 }}
+    port: {{ add 8848 1001 }}
     targetPort: raft-rpc
     protocol: TCP
   selector:
-    app: {{ template "nacos.selector" . }}
+    app: nacos
 {{- end -}}
diff --git 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
index 9de3ed4c..9a555933 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/nacos/templates/statefulset.yaml
@@ -3,97 +3,77 @@
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
-  name: {{ template "nacos.name" . }}
+  name: nacos
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "nacos.labels" . | nindent 4 }}
-  {{- with $nacos.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $nacos.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: nacos
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Nacos"
+    dubbo: nacos
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
   replicas: {{ $ncs.replicas }}
   {{- if eq $nacos.mode "cluster" }}
-  serviceName: {{ template "nacos.name" . }}-headless
+  serviceName: nacos-headless
   {{- else }}
-  serviceName: {{ template "nacos.name" . }}
+  serviceName: nacos
   {{- end }}
   selector:
     matchLabels:
-    {{- include "nacos.matchLabels" . | nindent 6 }}
+      app: nacos
+      dubbo.io/rev: {{ default "default" | quote }}
+      dubbo: nacos
   template:
     metadata:
       labels:
-      {{- include "nacos.labels" . | nindent 8 }}
+        app: nacos
+        dubbo.io/rev: {{ default "default" | quote }}
+        install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+        operator.dubbo.io/component: "Nacos"
+        dubbo: nacos
+        release: {{ .Release.Name }}
+        app.kubernetes.io/name: "register"
     spec:
-      securityContext:
-      {{- if $nacos.securityContext.enabled }}
-      {{- omit $nacos.securityContext "enabled" | toYaml | nindent 8 }}
-      {{- end }}
-      {{- if and (eq $nacos.mode "cluster" |default $ncs.mode) 
($nacos.plugin.enabled | default $ncs.plugin.enabled) }}
+      {{- if and (eq $nacos.mode "cluster" | default $ncs.mode) 
($nacos.plugin.enabled | default $ncs.plugin.enabled) }}
       initContainers:
-        - name: peer-finder-plugin-install
-          image: {{ $nacos.plugin.image.registry }}:{{ $nacos.plugin.image.tag 
}}
-          imagePullPolicy: {{ $nacos.plugin.image.pullPolicy }}
-          volumeMounts:
-          - name: data
-            mountPath: /home/nacos/plugins/peer-finder
-            subPath: peer-finder
+      - name: peer-finder-plugin-install
+        image: {{ $nacos.plugin.image.registry }}:{{ $nacos.plugin.image.tag }}
+        imagePullPolicy: {{ $nacos.plugin.image.pullPolicy }}
+        volumeMounts:
+        - name: data
+          mountPath: /home/nacos/plugins/peer-finder
+          subPath: peer-finder
       {{- end }}
       containers:
       - name: nacos
         image: {{ $nacos.image.registry }}:{{ $nacos.image.tag }}
         imagePullPolicy: {{ $nacos.image.pullPolicy }}
-        securityContext:
-        {{- if $nacos.containerSecurityContext.enabled }}
-        {{- omit $nacos.containerSecurityContext "enabled" | toYaml | nindent 
10 }}
-        {{- end }}
-        startupProbe:
-        {{- if $nacos.startupProbe }}
-        {{- toYaml $nacos.startupProbe | nindent 10 }}
-        {{- end }}
-        readinessProbe:
-        {{- if $nacos.readinessProbe }}
-        {{- toYaml $nacos.readinessProbe | nindent 10 }}
-        {{- end }}
-        livenessProbe:
-        {{- if $nacos.livenessProbe }}
-        {{- toYaml $nacos.livenessProbe | nindent 10 }}
-        {{- end }}
         ports:
         - name: http
           containerPort: 8848
         - name: clientgen-rpc
-          containerPort: {{ add $nacos.serverPort 1000 }}
+          containerPort: {{ add 8848 1000 }}
         - name: raft-rpc
-          containerPort: {{ add $nacos.serverPort 1001 }}
+          containerPort: {{ add 8848 1001 }}
         resources:
-        {{- if $nacos.resources }}
-        {{- toYaml $nacos.resources | nindent 10 }}
-        {{- end }}
+{{ toYaml $nacos.resources | trim | indent 10 }}
         env:
         - name: NACOS_SERVER_PORT
-          value: {{ $nacos.serverPort | quote }}
+          value: "8848"
         - name: NACOS_APPLICATION_PORT
-          value: {{ $nacos.serverPort | quote }}
+          value: "8848"
         - name: PREFER_HOST_MODE
-          value: {{ $nacos.preferhostmode | quote }}
-        {{- if eq $nacos.mode "standalone" |default $ncs.mode }}
+          value: {{ $ncs.preferhostmode | quote }}
+        {{- if eq $nacos.mode "standalone" | default $ncs.mode }}
         - name: MODE
           value: "standalone"
-        {{- else if eq $nacos.mode "cluster" |default $ncs.mode }}
+        {{- else if eq $nacos.mode "cluster" | default $ncs.mode }}
         - name: SERVICE_NAME
-          value: "{{ template "nacos.name" . }}-headless"
+          value: "nacos-headless"
         - name: DOMAIN_NAME
-          value: {{ $nacos.clusterDomain | quote }}
-        - name: POD_NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
+          value: "cluster.local"
         {{- end }}
         {{- if eq $nacos.storage.type "mysql" }}
         - name: SPRING_DATASOURCE_PLATFORM
@@ -101,37 +81,45 @@ spec:
         - name: MYSQL_SERVICE_HOST
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.db.host
         - name: MYSQL_SERVICE_DB_NAME
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.db.name
         - name: MYSQL_SERVICE_PORT
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.port
         - name: MYSQL_SERVICE_USER
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.user
         - name: MYSQL_SERVICE_PASSWORD
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.password
         - name: MYSQL_SERVICE_DB_PARAM
           valueFrom:
             configMapKeyRef:
-              name: {{ template "nacos.name" . }}-db-config
+              name: nacos-db-config
               key: mysql.param
         {{- else }}
         - name: EMBEDDED_STORAGE
           value: embedded
         {{- end }}
+        readinessProbe:
+          httpGet:
+            path: /nacos/v1/console/health/readiness
+            port: 8848
+            scheme: HTTP
+          initialDelaySeconds: 10
+          periodSeconds: 5
+          timeoutSeconds: 10
         volumeMounts:
         - name: data
           mountPath: /home/nacos/plugins/peer-finder
diff --git 
a/manifests/charts/dubbo-control/register-discovery/nacos/values.yaml 
b/manifests/charts/dubbo-control/register-discovery/nacos/values.yaml
index 1485b043..8e56c90a 100644
--- a/manifests/charts/dubbo-control/register-discovery/nacos/values.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/nacos/values.yaml
@@ -18,14 +18,6 @@ _internal_default_values_not_set:
   enabled: false
   ## Specifies the mode in which nacos is running (standalone, cluster, etc.).
   mode: standalone
-  ## Override the namespace where the resource is deployed.
-  namespaceOverride: ~
-  ## Labels to attach to the resource.
-  labels: ~
-  ## Annotations to attach to the resource.
-  annotations: ~
-  ## Specifies the cluster's domain name for DNS resolution.
-  clusterDomain: cluster.local
   ## Number of replicas for the Deployment.
   replicas: 1
 
@@ -48,101 +40,12 @@ _internal_default_values_not_set:
     tag: latest
     # Image pull policy, available options are: Always, IfNotPresent, Never.
     pullPolicy: IfNotPresent
-  securityContext:
-    # Whether to enable the security context.
-    enabled: true
-    # Defines the POSIX group ID that owns the pod's volumes.
-    fsGroup: 1001
-  containerSecurityContext:
-    # Whether to enable the container security context.
-    enabled: true
-    # Specifies the user ID under which the container should run.
-    runAsUser: 1001
-    # Set to 'true' to run the container as a non-root user.
-    runAsNonRoot: true
-    # Set to 'false' to disallow privilege escalation for the container.
-    allowPrivilegeEscalation: false
-  service:
-    # Labels to be applied to the service.
-    labels: ~
-    # Annotations to be added to the service.
-    annotations: ~
-    # Specifies the service type (ClusterIP, NodePort, LoadBalancer, etc.).
-    type: NodePort
-    # Specifies the ClusterIP for the service, or use "~" to auto-assign.
-    clusterIP: ~
-    # List of external IPs to associate with the service.
-    externalIPs: ~
-    # Specifies the IP address for a LoadBalancer service.
-    loadBalancerIP: ~
-    # Restrict access to the LoadBalancer by IP ranges.
-    loadBalancerSourceRanges: ~
-    # Specifies the LoadBalancer class (if applicable).
-    loadBalancerClass: ~
-    # Specifies the session affinity mode (None, ClientIP)
-    sessionAffinity: None
-    # Set to 'true' to publish endpoints for not-ready pods.
-    publishNotReadyAddresses: true
-  startupProbe:
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 180
-    # How often to perform the probe.
-    periodSeconds: 5
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 10
-    # Perform an HTTP GET request to check.
-    httpGet:
-      # The protocol used for the HTTP GET request (HTTP, HTTPS).
-      scheme: HTTP
-      # The port on which the HTTP GET request will be made.
-      port: 8848
-      # The path to use for the HTTP GET request.
-      path: /nacos/v1/console/health/readiness
-  readinessProbe:
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 10
-    # How often to perform the probe.
-    periodSeconds: 5
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 10
-    # Perform an HTTP GET request to check.
-    httpGet:
-      # The protocol used for the HTTP GET request (HTTP, HTTPS).
-      scheme: HTTP
-      # The port on which the HTTP GET request will be made.
-      port: 8848
-      # The path to use for the HTTP GET request.
-      path: /nacos/v1/console/health/readiness
-  livenessProbe:
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 10
-    # How often to perform the probe.
-    periodSeconds: 5
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 10
-    # Perform an HTTP GET request to check.
-    httpGet:
-      # The protocol used for the HTTP GET request (HTTP, HTTPS).
-      scheme: HTTP
-      # The port on which the HTTP GET request will be made.
-      port: 8848
-      # The path to use for the HTTP GET request.
-      path: /nacos/v1/console/health/liveness
+
   resources:
-    # Maximum CPU and memory resources allowed for the container.
-    limits:
-      # CPU usage limit.
-      cpu: ~
-      # Memory usage limit.
-      memory: ~
-    # Initial CPU and memory resource requests for the container.
     requests:
-      # CPU usage request.
-      cpu: ~
-      # Memory usage request.
-      memory: ~
-  # Specifies the port on which the server should run.
-  serverPort: 8848
+      cpu: 500m
+      memory: 2Gi
+
   # Specifies the preferred host mode (e.g., 'hostname').
   preferhostmode: ~
   storage:
@@ -161,7 +64,4 @@ _internal_default_values_not_set:
       # Specifies the database password.
       password: passw0rd
       # Additional database connection parameters (if needed).
-      param: ""
-  global:
-    # Used to locate dubbod.
-    dubboNamespace: dubbo-system
\ No newline at end of file
+      param: ""
\ No newline at end of file
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/_helpers.tpl
 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/_helpers.tpl
index df8fd864..e4687170 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/_helpers.tpl
+++ 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/_helpers.tpl
@@ -1,99 +1,23 @@
-{{/*
-Return the appropriate apiVersion for deployment or statefulset.
-*/}}
-{{- define "apiVersion" -}}
-{{- if and ($.Capabilities.APIVersions.Has "apps/v1") (semverCompare ">= 
1.14-0" .Capabilities.KubeVersion.Version) }}
-{{- print "apps/v1" }}
-{{- else }}
-{{- print "extensions/v1beta1" }}
-{{- end }}
-{{- end }}
-
 {{/*
 Return the ZooKeeper client-server authentication credentials secret.
 */}}
-{{- define "zoo.client.secretName" -}}
+{{- define "zookeeper.client.secretName" -}}
 {{- $zoo := .Values.registerCentre.zookeeper -}}
 {{- if $zoo.auth.client.existingSecret -}}
     {{- printf "%s" (tpl $zoo.auth.client.existingSecret $) -}}
 {{- else -}}
-    {{- printf "%s-client-auth" (include "zoo.name" .) -}}
+    {{- printf "zookeeper-client-auth" -}}
 {{- end -}}
 {{- end -}}
 
 {{/*
 Return the ZooKeeper server-server authentication credentials secret.
 */}}
-{{- define "zoo.quorum.secretName" -}}
+{{- define "zookeeper.quorum.secretName" -}}
 {{- $zoo := .Values.registerCentre.zookeeper -}}
 {{- if $zoo.auth.quorum.existingSecret -}}
     {{- printf "%s" (tpl $zoo.auth.quorum.existingSecret $) -}}
 {{- else -}}
-    {{- printf "%s-quorum-auth" (include "zoo.name" .) -}}
-{{- end -}}
-{{- end -}}
-
-{{/*
-Return ZooKeeper Labels to use.
-*/}}
-{{- define "zoo.labels" -}}
-app: {{ template "zoo.name" . }}
-app.kubernetes.io/name: {{ template "zoo.name" . }}
-app.kubernetes.io/instance: {{ template "zoo.name" . }}
-app.kubernetes.io/component: {{ template "zoo.name" . }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
-{{- end -}}
-
-
-{{/*
-Return ZooKeeper matchLabels to use.
-*/}}
-{{- define "zoo.matchLabels" -}}
-app.kubernetes.io/name: {{ template "zoo.name" . }}
-app.kubernetes.io/instance: {{ template "zoo.name" . }}
-app.kubernetes.io/component: {{ template "zoo.name" . }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
-{{- end -}}
-
-{{/*
-Return ZooKeeper Name to use.
-*/}}
-{{- define "zoo.name" -}}
-{{- printf "zookeeper" -}}
-{{- end -}}
-
-{{/*
-Return Dubbo Namespace to use.
-*/}}
-{{- define "admin.namespace" -}}
-{{- "dubbo-system" | default }}
-{{- end }}
-
-{{/*
-Return ZooKeeper Service Selector to use.
-*/}}
-{{- define "zoo.selector" -}}
-{{ include "zoo.name" . }}
-{{- end -}}
-
-
-{{/*
-Return ZooKeeper Client Port to use.
-*/}}
-{{- define "zoo.client" -}}
-{{- printf "2181" -}}
-{{- end -}}
-
-{{/*
-Return ZooKeeper Follower Port to use.
-*/}}
-{{- define "zoo.follower" -}}
-{{- printf "2888" -}}
-{{- end -}}
-
-{{/*
-Return ZooKeeper Election Port to use.
-*/}}
-{{- define "zoo.election" -}}
-{{- printf "3888" -}}
+    {{- printf "zookeeper-quorum-auth" -}}
 {{- end -}}
+{{- end -}}
\ No newline at end of file
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
index f87fceb8..9a807984 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/configmap.yaml
@@ -2,17 +2,16 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ template "zoo.name" . }}-scripts
+  name: zookeeper-scripts
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "zoo.labels" . | nindent 4 }}
-  {{- with $zoo.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $zoo.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: zookeeper
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Zookeeper"
+    dubbo: zookeeper
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 data:
   init-certs.sh: |-
     #!/bin/bash
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
index fc803e93..dee0a29c 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/service.yaml
@@ -1,100 +1,53 @@
-{{- $zoo := .Values.zookeeper -}}
-{{- $service := $zoo.service -}}
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "zoo.name" . }}
+  name: zookeeper
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "zoo.labels" . | nindent 4 }}
-  {{- with $zoo.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $zoo.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: zookeeper
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Zookeeper"
+    dubbo: zookeeper
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
-  {{- if $service.type }}
-  type: {{ $service.type }}
-  {{- end }}
-  {{- if $service.clusterIP }}
-  clusterIP: {{ $service.clusterIP }}
-  {{- end }}
-  {{- if $service.externalIPs }}
-  externalIPs: {{ $service.externalIPs }}
-  {{- end }}
-  {{- if $service.loadBalancerIP }}
-  loadBalancerIP: {{ $service.loadBalancerIP }}
-  {{- end }}
-  {{- if $service.loadBalancerSourceRanges }}
-  loadBalancerSourceRanges: {{ $service.loadBalancerSourceRanges }}
-  {{- end }}
-  {{- if $service.loadBalancerClass }}
-  loadBalancerClass: {{ $service.loadBalancerClass }}
-  {{- end }}
   ports:
   - name: tcp-client
-    port: {{ template "zoo.client" . }}
+    port: 2181
     targetPort: client
   - name: tcp-follower
-    port: {{ template "zoo.follower" . }}
+    port: 2888
     targetPort: follower
   - name: tcp-election
-    port: {{ template "zoo.election" . }}
+    port: 3888
     targetPort: election
   selector:
-    app: {{ template "zoo.selector" . }}
+    app: zookeeper
 ---
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "zoo.name" . }}-headless
+  name: zookeeper-headless
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "zoo.labels" . | nindent 4 }}
-  {{- with .Values.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $zoo.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: zookeeper
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Zookeeper"
+    dubbo: zookeeper
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
-  {{- if $service.type }}
-  type: {{ $service.type }}
-  {{- end }}
-  clusterIP: None
-  {{- if $service.type }}
-  type: {{ $service.type }}
-  {{- end }}
-  {{- if $service.externalIPs }}
-  externalIPs: {{ $service.externalIPs }}
-  {{- end }}
-  {{- if $service.loadBalancerIP }}
-  loadBalancerIP: {{ $service.loadBalancerIP }}
-  {{- end }}
-  {{- if $service.loadBalancerSourceRanges }}
-  loadBalancerSourceRanges: {{ $service.loadBalancerSourceRanges }}
-  {{- end }}
-  {{- if $service.loadBalancerClass }}
-  loadBalancerClass: {{ $service.loadBalancerClass }}
-  {{- end }}
-  {{- if $service.sessionAffinity }}
-  sessionAffinity: {{ $service.sessionAffinity }}
-  {{- end }}
-  {{- if $service.publishNotReadyAddresses }}
-  publishNotReadyAddresses: {{ $service.publishNotReadyAddresses }}
-  {{- end }}
   ports:
-  - name: tcp-client
-    port: {{ template "zoo.client" . }}
-    targetPort: client
-  - name: tcp-follower
-    port: {{ template "zoo.follower" . }}
-    targetPort: follower
-  - name: tcp-election
-    port: {{ template "zoo.election" . }}
-    targetPort: election
+    - name: tcp-client
+      port: 2181
+      targetPort: client
+    - name: tcp-follower
+      port: 2888
+      targetPort: follower
+    - name: tcp-election
+      port: 3888
+      targetPort: election
   selector:
-    app: {{ template "zoo.selector" . }}
\ No newline at end of file
+    app: zookeeper
\ No newline at end of file
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
index 3d98e2ed..cd27de50 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/statefulset.yaml
@@ -3,46 +3,43 @@
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
-  name: {{ template "zoo.name" . }}
+  name: zookeeper
   namespace: {{ .Release.Namespace }}
   labels:
-  {{- include "zoo.labels" . | nindent 4 }}
-  {{- with $zookeeper.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
-  annotations:
-  {{- with $zookeeper.annotations }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    app: zookeeper
+    dubbo.io/rev: {{ default "default" | quote }}
+    install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+    operator.dubbo.io/component: "Zookeeper"
+    dubbo: zookeeper
+    release: {{ .Release.Name }}
+    app.kubernetes.io/name: "register"
 spec:
   replicas: {{ $zookeeper.replicas }}
   selector:
     matchLabels:
-    {{- include "zoo.matchLabels" . | nindent 6 }}
-  serviceName: {{ template "zoo.name" . }}
+      app: zookeeper
+      dubbo.io/rev: {{ default "default" | quote }}
+      dubbo: zookeeper
+  serviceName: zookeeper
   template:
     metadata:
       labels:
-      {{- include "zoo.labels" . | nindent 8 }}
+        app: zookeeper
+        dubbo.io/rev: {{ default "default" | quote }}
+        install.operator.dubbo.io/owning-resource: {{ default "unknown" }}
+        operator.dubbo.io/component: "Zookeeper"
+        dubbo: zookeeper
+        release: {{ .Release.Name }}
+        app.kubernetes.io/name: "register"
     spec:
-      securityContext:
-      {{- if $zookeeper.securityContext.enabled }}
-      {{- omit $zookeeper.securityContext "enabled" | toYaml | nindent 8 }}
-      {{- end }}
       containers:
       - name: zookeeper
         image: {{ $zookeeper.image.registry }}:{{ $zookeeper.image.tag }}
         imagePullPolicy: {{ $zookeeper.image.pullPolicy }}
-        securityContext:
-        {{- if $zookeeper.containerSecurityContext.enabled }}
-        {{- omit $zookeeper.containerSecurityContext "enabled" | toYaml | 
nindent 10 }}
-        {{- end }}
         command:
         - /scripts/setup.sh
         resources:
-        {{- if $zookeeper.resources }}
-        {{- toYaml $zookeeper.resources | nindent 10 }}
-        {{- end }}
+{{ toYaml $zookeeper.resources | trim | indent 10 }}
         env:
         - name: BITNAMI_DEBUG
           value: {{ ternary "true" "false" (or $zookeeper.image.debug) | quote 
}}
@@ -72,11 +69,11 @@ spec:
           value: {{ $zookeeper.autopurge.snapRetainCount | quote }}
         - name: ZOO_MAX_SESSION_TIMEOUT
           value: {{ $zookeeper.maxSessionTimeout | quote }}
-        {{- $zooName := include "zoo.name" . }}
+        {{- $zooName := "zookeeper" }}
         {{- $zooReplicas := int $zookeeper.replicas  }}
         {{- $zooHeadless := printf "%s-%s" $zooName "headless" | trunc 63 }}
         {{- $zooNamespace := .Release.Namespace }}
-        {{- $zooDomain := $zookeeper.clusterDomain }}
+        {{- $zooDomain := "cluster.local" }}
         - name: ZOO_SERVERS
           value: {{ range $k, $v := until $zooReplicas }}{{ $zooName }}-{{ $v 
}}.{{ $zooName }}.{{ $zooNamespace }}.svc.{{ $zooDomain }}:2888:3888::{{ add $v 
1 }} {{ end }}
         - name: ZOO_ENABLE_AUTH
@@ -89,14 +86,14 @@ spec:
         - name: ZOO_CLIENT_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ include "zoo.client.secretName" . }}
+              name: {{ include "zookeeper.client.secretName" . }}
               key: client-password
         - name: ZOO_SERVER_USERS
           value: {{ $zookeeper.auth.client.serverUsers | quote }}
         - name: ZOO_SERVER_PASSWORDS
           valueFrom:
             secretKeyRef:
-              name: {{ include "zoo.client.secretName" . }}
+              name: {{ include "zookeeper.client.secretName" . }}
               key: server-password
         {{- end }}
         - name: ZOO_ENABLE_QUORUM_AUTH
@@ -107,44 +104,51 @@ spec:
         - name: ZOO_QUORUM_LEARNER_PASSWORD
           valueFrom:
             secretKeyRef:
-              name: {{ include "zoo.quorum.secretName" . }}
+              name: {{ include "zookeeper.quorum.secretName" . }}
               key: quorum-learner-password
         - name: ZOO_QUORUM_SERVER_USERS
           value: {{ $zookeeper.auth.quorum.serverUsers | quote }}
         - name: ZOO_QUORUM_SERVER_PASSWORDS
           valueFrom:
             secretKeyRef:
-              name: {{ include "zoo.quorum.secretName" . }}
+              name: {{ include "zookeeper.quorum.secretName" . }}
               key: quorum-server-password
         {{- end }}
         - name: ZOO_HEAP_SIZE
           value: {{ $zookeeper.heapSize | quote }}
         - name: ZOO_LOG_LEVEL
           value: {{ $zookeeper.logLevel | quote }}
-        - name: POD_NAME
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.name
         ports:
         - name: client
-          containerPort: {{ template "zoo.client" . }}
+          containerPort: 2181
         - name: follower
-          containerPort: {{ template "zoo.follower" . }}
+          containerPort: 2888
         - name: election
-          containerPort: {{ template "zoo.election" . }}
+          containerPort: 3888
         startupProbe:
-        {{- if $zookeeper.startupProbe }}
-        {{- toYaml $zookeeper.startupProbe | nindent 10 }}
-        {{- end }}
+          exec:
+            command: [ '/bin/bash', '-c', 'echo "ruok" | timeout 2 nc -w 2 
localhost 2181 | grep imok' ]
+          initialDelaySeconds: 5
+          periodSeconds: 10
+          successThreshold: 1
+          failureThreshold: 5
+          timeoutSeconds: 5
         readinessProbe:
-        {{- if $zookeeper.readinessProbe }}
-        {{- toYaml $zookeeper.readinessProbe | nindent 10 }}
-        {{- end }}
+          exec:
+            command: [ '/bin/bash', '-c', 'curl -s -m 2 
http://localhost:8080/commands/ruok | grep error | grep null' ]
+          initialDelaySeconds: 5
+          periodSeconds: 10
+          successThreshold: 1
+          failureThreshold: 5
+          timeoutSeconds: 5
         livenessProbe:
-        {{- if $zookeeper.livenessProbe }}
-        {{- toYaml $zookeeper.livenessProbe | nindent 10 }}
-        {{- end }}
+          exec:
+            command: [ '/bin/bash', '-c', 'curl -s -m 2 
http://localhost:8080/commands/ruok | grep ruok' ]
+          initialDelaySeconds: 5
+          periodSeconds: 10
+          successThreshold: 1
+          failureThreshold: 5
+          timeoutSeconds: 5
         volumeMounts:
         - name: scripts
           mountPath: /scripts/setup.sh
@@ -154,7 +158,7 @@ spec:
       volumes:
       - name: scripts
         configMap:
-          name: {{ template "zoo.name" . }}-scripts
+          name: zookeeper-scripts
           defaultMode: 0755
       - name: data
         emptyDir: {}
\ No newline at end of file
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/zzz_profile.yaml
 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/zzz_profile.yaml
index 3f87a4b6..056b69ee 100644
--- 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/zzz_profile.yaml
+++ 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/templates/zzz_profile.yaml
@@ -1,4 +1,4 @@
-{{- if $.Values.defaults}}
+{{- if $.Values.defaults }}
 {{ fail (cat
   "`--set defaults.foo=bar` with `--set foo=bar`. Defaults set:\n"
   ($.Values.defaults | toYaml |nindent 4) ) }}
diff --git 
a/manifests/charts/dubbo-control/register-discovery/zookeeper/values.yaml 
b/manifests/charts/dubbo-control/register-discovery/zookeeper/values.yaml
index d19824da..a6d155fe 100644
--- a/manifests/charts/dubbo-control/register-discovery/zookeeper/values.yaml
+++ b/manifests/charts/dubbo-control/register-discovery/zookeeper/values.yaml
@@ -16,14 +16,6 @@
 _internal_default_values_not_set:
   ## Whether to enable the zookeeper.
   enabled: false
-  ## Override the namespace where the resource is deployed.
-  namespaceOverride: ~
-  ## Labels to attach to the resource.
-  labels: ~
-  ## Annotations to attach to the resource.
-  annotations: ~
-  ## Specifies the cluster's domain name for DNS resolution.
-  clusterDomain: cluster.local
   ## Number of replicas for the Deployment.
   replicas: 1
   ## Configure the application image
@@ -36,96 +28,12 @@ _internal_default_values_not_set:
     pullPolicy: IfNotPresent
     # Set to 'true' to enable debug mode for the image.
     debug: false
-  securityContext:
-    # Whether to enable the security context.
-    enabled: true
-    # Defines the POSIX group ID that owns the pod's volumes.
-    fsGroup: 1001
-  containerSecurityContext:
-    # Whether to enable the container security context.
-    enabled: true
-    # Specifies the user ID under which the container should run.
-    runAsUser: 1001
-    # Set to 'true' to run the container as a non-root user.
-    runAsNonRoot: true
-    # Set to 'false' to disallow privilege escalation for the container.
-    allowPrivilegeEscalation: false
-  service:
-    # Labels to be applied to the service.
-    labels: ~
-    # Annotations to be added to the service.
-    annotations: ~
-    # Specifies the service type (ClusterIP, NodePort, LoadBalancer, etc.).
-    type: ClusterIP
-    # Specifies the ClusterIP for the service, or use "~" to auto-assign.
-    clusterIP: ~
-    # List of external IPs to associate with the service.
-    externalIPs: ~
-    # Specifies the IP address for a LoadBalancer service.
-    loadBalancerIP: ~
-    # Restrict access to the LoadBalancer by IP ranges.
-    loadBalancerSourceRanges: ~
-    # Specifies the LoadBalancer class (if applicable).
-    loadBalancerClass: ~
-    # Specifies the session affinity mode (None, ClientIP)
-    sessionAffinity: None
-    # Set to 'true' to publish endpoints for not-ready pods.
-    publishNotReadyAddresses: true
+
   resources:
-    # Maximum CPU and memory resources allowed for the container.
-    limits:
-      # CPU usage limit.
-      cpu: 250m
-      # Memory usage limit.
-      memory: 256Mi
-    # Initial CPU and memory resource requests for the container.
     requests:
-      # CPU usage request.
       cpu: 250m
-      # Memory usage request.
       memory: 256Mi
-  startupProbe:
-    # Number of consecutive failures before marking the container as unhealthy.
-    failureThreshold: 6
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 5
-    # How often to perform the probe.
-    periodSeconds: 10
-    # Minimum consecutive successes for the probe to be considered successful.
-    successThreshold: 1
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 5
-    exec:
-      # Run the specified command to check.
-      command: [ '/bin/bash', '-c', 'echo "ruok" | timeout 2 nc -w 2 localhost 
2181 | grep imok' ]
-  readinessProbe:
-    # Number of consecutive failures before marking the container as unhealthy.
-    failureThreshold: 6
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 5
-    # How often to perform the probe.
-    periodSeconds: 10
-    # Minimum consecutive successes for the probe to be considered successful.
-    successThreshold: 1
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 5
-    exec:
-      # Run the specified command to check.
-      command: [ '/bin/bash', '-c', 'curl -s -m 2 
http://localhost:8080/commands/ruok | grep error | grep null' ]
-  livenessProbe:
-    # Number of consecutive failures before marking the container as unhealthy.
-    failureThreshold: 6
-    # Delay before the probe is initiated.
-    initialDelaySeconds: 30
-    # How often to perform the probe.
-    periodSeconds: 10
-    # Minimum consecutive successes for the probe to be considered successful.
-    successThreshold: 1
-    # Time to wait for the probe to complete.
-    timeoutSeconds: 5
-    exec:
-      # Run the specified command to check.
-      command: [ '/bin/bash', '-c', 'curl -s -m 2 
http://localhost:8080/commands/ruok | grep ruok' ]
+
   # This allows a dedicated log device to be used, and helps avoid competition 
between logging and snapshots.
   dataLogDir: ""
   # tickTime Basic time unit (in milliseconds) used by ZooKeeper for 
heartbeats.
@@ -185,6 +93,4 @@ _internal_default_values_not_set:
       # auth.quorum.serverPasswords Comma, semicolon or whitespace separated 
list of passwords to assign to users when created.
       serverPasswords: ""
       # auth.quorum.existingSecret Use existing secret (ignores previous 
passwords).
-      existingSecret: ""
-  global:
-    dubboNamespace: dubbo-system
\ No newline at end of file
+      existingSecret: ""
\ No newline at end of file


Reply via email to