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 0af92aee [charts] Add control plane configuration (#472)
0af92aee is described below

commit 0af92aee9f16106bd5f1344c172778f5336ab13e
Author: mfordjody <[email protected]>
AuthorDate: Fri Oct 18 09:47:24 2024 +0800

    [charts] Add control plane configuration (#472)
---
 manifests/charts/admin/README.md                   |   6 +-
 .../admin/templates/admin/admin-configmap.yaml     |  14 ++-
 .../admin/templates/admin/admin-deployment.yaml    |  19 ++--
 .../admin/templates/admin/admin-statefulset.yaml   |  47 ++++++---
 manifests/charts/admin/templates/jobs.yaml         |   2 +-
 manifests/charts/admin/values.yaml                 | 105 ++++++++++-----------
 6 files changed, 106 insertions(+), 87 deletions(-)

diff --git a/manifests/charts/admin/README.md b/manifests/charts/admin/README.md
index 0f7843e2..700938d0 100644
--- a/manifests/charts/admin/README.md
+++ b/manifests/charts/admin/README.md
@@ -5,7 +5,7 @@
 
 ## Values
 
-### Admin
+### Dubbo
 
 | Key                                              | Description               
                                                                 | Default      
                             |
 
|--------------------------------------------------|--------------------------------------------------------------------------------------------|-------------------------------------------|
@@ -88,6 +88,4 @@
 | `nacos.storage.db.port`                                   | Specify the 
database port for Nacos storing configuration data.                             
                | `3306`                                                        
                                  |
 | `nacos.storage.db.username`                               | Specify the 
database username for Nacos storing configuration data.                         
                | `mysql`                                                       
                                  |
 | `nacos.storage.db.password`                               | Specify the 
database password for Nacos storing configuration data.                         
                | `passw0rd`                                                    
                                  |
-| `nacos.storage.db.param`                                  | Specify the 
database url parameter for Nacos storing configuration data.                    
                | 
`characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false`
 |
-
-
+| `nacos.storage.db.param`                                  | Specify the 
database url parameter for Nacos storing configuration data.                    
                | 
`characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false`
 |
\ No newline at end of file
diff --git a/manifests/charts/admin/templates/admin/admin-configmap.yaml 
b/manifests/charts/admin/templates/admin/admin-configmap.yaml
index a4e91f1a..045cc31b 100644
--- a/manifests/charts/admin/templates/admin/admin-configmap.yaml
+++ b/manifests/charts/admin/templates/admin/admin-configmap.yaml
@@ -1,4 +1,3 @@
-{{ $adminCpLabels := include "admin.labels" . }}
 {{- $admin := .Values -}}
 apiVersion: v1
 kind: ConfigMap
@@ -6,13 +5,12 @@ metadata:
   name: {{ include "admin.name" . }}-control-plane-config
   namespace: {{ template "admin.namespace" . }}
   labels:
-  {{- include "admin.labels" . | nindent 4 }}
-  {{- with $admin.labels }}
-  {{- toYaml . | nindent 4 }}
-  {{- end }}
+    {{- include "admin.labels" . | nindent 4 }}
+    {{- with $admin.labels }}
+    {{- toYaml . | nindent 4 }}
+    {{- end }}
 data:
-  {{/* TODO */}}
-  dubbo-cp.yaml: |-
+  config.yaml: |-
     {{- if $admin.cp }}
     {{ toYaml $admin.cp | nindent 4 | trim }}
-    {{ end }}
+    {{- end -}}
diff --git a/manifests/charts/admin/templates/admin/admin-deployment.yaml 
b/manifests/charts/admin/templates/admin/admin-deployment.yaml
index ca059770..b7e0e93f 100644
--- a/manifests/charts/admin/templates/admin/admin-deployment.yaml
+++ b/manifests/charts/admin/templates/admin/admin-deployment.yaml
@@ -95,14 +95,16 @@ spec:
           value: /var/run/secrets/dubbo.io/tls-cert
         {{- $promName := include "prom.name" . }}
         {{- $promPort := include "prom.port" . }}
-        {{- $promStationaryName := printf "-kube-prome-prometheus" }}
+        {{- $promStationaryName := printf "kube-prome-prometheus" }}
+        {{- $promFullName := printf "%s-%s" $promName $promStationaryName }}
         {{- if $prom.enabled }}
         - name: ADMIN_PROMETHEUS_ADDRESS
-          value: {{ $promName$promStationaryName }}:{{ $promPort }}
+          value: {{ $promFullName }}:{{ $promPort }}
+        {{- $grafanaName := include "grafana.name" . }}
         {{- $grafanaPort := include "grafana.port" . }}
-        {{- $grafanaStationaryName := printf "-grafana" }}
+        {{- $grafanaFullName := printf "%s-%s" $promName $grafanaName }}
         - name: ADMIN_GRAFANA_ADDRESS
-          value: {{ $promName$grafanaStationaryName }}:{{ $grafanaPort }}
+          value: {{ $grafanaFullName }}:{{ $grafanaPort }}
         {{- end }}
         volumeMounts:
         {{- if $admin.volumeMounts }}
@@ -120,8 +122,9 @@ spec:
           mountPath: /var/run/secrets/dubbo.io/tls-cert/ca.crt
           subPath: ca.crt
           readOnly: true
-        - name: {{ include "admin.name" . }}-control-plane-config
-          mountPath: /etc/dubbo.io/cp-config
+        - name: cp-config
+          mountPath: /etc/dubbo.io/cp-config/config.yaml
+          subPath: config.yaml
           readOnly: true
         securityContext:
         {{- if $admin.securityContext }}
@@ -147,7 +150,9 @@ spec:
       {{- if $admin.volumes }}
       {{- toYaml $admin.volumes | nindent 6 }}
       {{- end }}
-      - name: {{ include "admin.name" . }}-control-plane-config
+      - name: cp-config
+        configMap:
+          name: {{ include "admin.name" . }}-control-plane-config
       {{- if $cp.tls.secretName }}
       - name: general-tls-cert
         secret:
diff --git a/manifests/charts/admin/templates/admin/admin-statefulset.yaml 
b/manifests/charts/admin/templates/admin/admin-statefulset.yaml
index b958909b..2cf98847 100644
--- a/manifests/charts/admin/templates/admin/admin-statefulset.yaml
+++ b/manifests/charts/admin/templates/admin/admin-statefulset.yaml
@@ -60,12 +60,16 @@ spec:
         {{- if $admin.lifecycleHooks }}
         {{- toYaml $admin.lifecycleHooks | nindent 10 }}
         {{- end }}
+        args:
+        - run
+        - --config-file=/etc/dubbo.io/cp-config/config.yaml
         ports:
-        - name: http
-          {{- if $admin.service.protocol }}
-          protocol: {{ $admin.service.protocol }}
-          {{- end }}
-          containerPort: {{ template "admin.containerPort" . }}
+        - name: admin-http
+          containerPort: {{ template "admin.web.containerPort" . }}
+        - name: admin-xds-grpc
+          containerPort: {{ template "admin.xds.containerPort" . }}
+        - name: admin-admission
+          containerPort: {{ template "admin.admissionServer.containerPort" . }}
         env:
         {{- $zooName := include "zoo.name" . -}}
         {{- $nacosName := include "nacos.name" . -}}
@@ -90,19 +94,37 @@ spec:
         {{- end }}
         {{- $promName := include "prom.name" . }}
         {{- $promPort := include "prom.port" . }}
-        {{- $promStationaryName := printf "-kube-prome-prometheus" }}
+        {{- $promStationaryName := printf "kube-prome-prometheus" }}
+        {{- $promFullName := printf "%s-%s" $promName $promStationaryName }}
         {{- if $prom.enabled }}
         - name: ADMIN_PROMETHEUS_ADDRESS
-          value: {{ $promName$promStationaryName }}:{{ $promPort }}
+          value: {{ $promFullName }}:{{ $promPort }}
+        {{- $grafanaName := include "grafana.name" . }}
         {{- $grafanaPort := include "grafana.port" . }}
-        {{- $grafanaStationaryName := printf "-grafana" }}
+        {{- $grafanaFullName := printf "%s-%s" $promName $grafanaName }}
         - name: ADMIN_GRAFANA_ADDRESS
-          value: {{ $promName$grafanaStationaryName }}:{{ $grafanaPort }}
+          value: {{ $grafanaFullName }}:{{ $grafanaPort }}
         {{- end }}
         volumeMounts:
         {{- if $admin.volumeMounts }}
         {{- toYaml $admin.volumeMounts | nindent 8 }}
         {{- end }}
+        - name: general-tls-cert
+          mountPath: /var/run/secrets/dubbo.io/tls-cert/tls.crt
+          subPath: tls.crt
+          readOnly: true
+        - name: general-tls-cert
+          mountPath: /var/run/secrets/dubbo.io/tls-cert/tls.key
+          subPath: tls.key
+          readOnly: true
+        - name: general-tls-cert{{- if $cp.tls.caSecretName }}-ca{{- end }}
+          mountPath: /var/run/secrets/dubbo.io/tls-cert/ca.crt
+          subPath: ca.crt
+          readOnly: true
+        - name: cp-config
+          mountPath: /etc/dubbo.io/cp-config/config.yaml
+          subPath: config.yaml
+          readOnly: true
         securityContext:
         {{- if $admin.securityContext }}
         {{- toYaml $admin.securityContext | nindent 10 }}
@@ -127,12 +149,9 @@ spec:
       {{- if $admin.volumes }}
       {{- toYaml $admin.volumes | nindent 6 }}
       {{- end }}
-      - name: {{ include "admin.name" . }}-server-config
+      - name: cp-config
         configMap:
-          name: {{ include "admin.name" . }}-server-config
-      - name: scripts
-        configMap:
-          name: {{ template "job.name" . }}-scripts
+          name: {{ include "admin.name" . }}-control-plane-config
       {{- if $cp.tls.secretName }}
       - name: general-tls-cert
         secret:
diff --git a/manifests/charts/admin/templates/jobs.yaml 
b/manifests/charts/admin/templates/jobs.yaml
index e3caeb6b..4c11f540 100644
--- a/manifests/charts/admin/templates/jobs.yaml
+++ b/manifests/charts/admin/templates/jobs.yaml
@@ -41,7 +41,7 @@ data:
     fi
     done
 
-    cp -r "/files/dashboards/" "{{ include "prom.stack.name" . }}/templates/{{ 
include "grafana.name" . }}/dashboards-{{ $prom.dashboardsVersion }}"
+    cp -r "/files/dashboards/dubbo-resources-metrics.yaml" "{{ include 
"prom.stack.name" . }}/templates/{{ include "grafana.name" . }}/dashboards-{{ 
$prom.dashboardsVersion }}"
     ls -la "{{ include "prom.stack.name" . }}/templates/{{ include 
"grafana.name" . }}/dashboards-{{ $prom.dashboardsVersion }}"
 
     if helm ls --all | grep -q "{{ include "prom.name" . }}"; then
diff --git a/manifests/charts/admin/values.yaml 
b/manifests/charts/admin/values.yaml
index b9368d31..be8982dc 100644
--- a/manifests/charts/admin/values.yaml
+++ b/manifests/charts/admin/values.yaml
@@ -317,60 +317,59 @@ jobs:
 
 
 
-## TODO
 cp:
- mode: universal
- topology: zone
- tls:
-   secretName: ""
-   caSecretName: ""
-   caBundle: ""
-
-deploy_mode: universal
-#mode: test
-mode: zone
-store:
-  traditional:
-    config_center: zookeeper://localhost:2181
-    registry:
-      address: zookeeper://localhost:2181
-    metadata_report:
-      address: zookeeper://localhost:2181
-#store:
-#  traditional:
-#    config_center: nacos://localhost:8848
-#    registry:
-#      address: nacos://localhost:8848
-#    metadata_report:
-#      address: nacos://localhost:8848
-admin:
-  metric_dashboards:
-    application:
-      baseURL: 
http://47.251.100.138:3000/d/a0b114ca-edf7-4dfe-ac2c-34a4fc545fed/application
-    instance:
-      baseURL: 
http://47.251.100.138:3000/d/dcf5defe-d198-4704-9edf-6520838880e9/instance
-    service:
-      baseURL: 
http://47.251.100.138:3000/d/ec689613-b4a1-45b1-b8bd-9d557059f970/service/
-  trace_dashboards:
-    application:
-      baseURL: 
http://47.251.100.138:3000/d/e968a89b-f03d-42e3-8ad3-930ae815cb0f/application
-    instance:
-      baseURL: 
http://47.251.100.138:3000/d/f5f48f75-13ec-489b-88ae-635ae38d8618/instance
-    service:
-      baseURL: 
http://47.251.100.138:3000/d/b2e178fb-ada3-4d5e-9f54-de99e7f07662/service
-  prometheus: http://prometheus.observability.svc.cluster.local:9090/
-#multizone:
-#  zone:
-#    globalAddress: grpc://127.0.0.1:5685
-#  global:
-#    dds:
-#      grpcPort: 5685
-runtime:
-  kubernetes:
-    admissionServer:
-      address: 10.23.132.51
-      port: 5443
-      certDir: test/cert
+  deploy_mode: universal
+  mode: zone # test
+  tls:
+    secretName: ""
+    caSecretName: ""
+    caBundle: ""
+
+  store:
+    traditional:
+      config_center: zookeeper://zookeeper:2181
+      registry:
+        address: zookeeper://zookeeper:2181
+      metadata_report:
+        address: zookeeper://zookeeper:2181
+    # Uncomment the following block if you want to use Nacos instead of 
Zookeeper
+    # nacos:
+    #   config_center: nacos://nacos:8848
+    #   registry:
+    #     address: nacos://nacos:8848
+    #   metadata_report:
+    #     address: nacos://nacos:8848
+
+  admin:
+    prometheus: 
http://kube-prometheus-kube-prome-prometheus.svc.cluster.local:9090
+    metric:
+      application:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/a0b114ca-edf7-4dfe-ac2c-34a4fc545fed/application
+      instance:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/dcf5defe-d198-4704-9edf-6520838880e9/instance
+      service:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/ec689613-b4a1-45b1-b8bd-9d557059f970/service
+    trace:
+      application:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/e968a89b-f03d-42e3-8ad3-930ae815cb0f/application
+      instance:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/f5f48f75-13ec-489b-88ae-635ae38d8618/instance
+      service:
+        baseURL: 
http://kube-prometheus-grafana:3000/d/b2e178fb-ada3-4d5e-9f54-de99e7f07662/service
+
+  multizone:
+    zone:
+      globalAddress: grpc://127.0.0.1:5685
+    global:
+      dds:
+        grpcPort: 5685
+
+  runtime:
+    kubernetes:
+      admissionServer:
+        address: 10.23.132.51
+        port: 5443
+        certDir: test/cert
 
 auth:
   ## Whether to enable the control-plane auth control.

Reply via email to