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 e54e55e5 [charts] Change admin templates and tpl (#461)
e54e55e5 is described below

commit e54e55e5bed72f12f88d2e4069423edfde030c15
Author: mfordjody <[email protected]>
AuthorDate: Tue Oct 15 08:32:16 2024 +0800

    [charts] Change admin templates and tpl (#461)
---
 .../charts/admin/templates/admin/admin-service.yaml  |  6 +++---
 manifests/charts/admin/templates/modular/_extras.tpl |  7 -------
 manifests/charts/admin/templates/modular/_names.tpl  |  8 ++++++++
 .../observable/exporters/servicemonitor.yaml         | 20 +++++++++++++++++++-
 .../observable/grafana-resources-app-traces.yaml     |  2 +-
 .../admin/templates/traffic/traffic-authority.yaml   |  4 ++--
 .../admin/templates/traffic/traffic-config.yaml      |  6 +++---
 .../charts/admin/templates/traffic/traffic-rbac.yaml |  4 ++--
 8 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/manifests/charts/admin/templates/admin/admin-service.yaml 
b/manifests/charts/admin/templates/admin/admin-service.yaml
index c4e0c0b9..8e9b36b6 100644
--- a/manifests/charts/admin/templates/admin/admin-service.yaml
+++ b/manifests/charts/admin/templates/admin/admin-service.yaml
@@ -35,11 +35,11 @@ spec:
   {{- end }}
   ports:
   - name: admin-http
-    port:
+    port: {{ template "admin.web.port" . }}
     targetPort: admin-http
-    appProtocol:
+    appProtocol: TCP
   - name: admin-xds-grpc
-    port:
+    port: {{ template "admin.xds.Port" . }}
     targetPort: admin-xds-grpc
   selector:
     app: {{ template "admin.selector" . }}
diff --git a/manifests/charts/admin/templates/modular/_extras.tpl 
b/manifests/charts/admin/templates/modular/_extras.tpl
index a857e79c..32a5c605 100644
--- a/manifests/charts/admin/templates/modular/_extras.tpl
+++ b/manifests/charts/admin/templates/modular/_extras.tpl
@@ -20,11 +20,4 @@ Return the ZooKeeper server-server authentication 
credentials secret.
 {{- else -}}
     {{- printf "%s-quorum-auth" (include "zoo.name" .) -}}
 {{- end -}}
-{{- end -}}
-
-{{/*
-Return the Dubbo system namespace to use.
-*/}}
-{{- define "system.namespaces" -}}
-{{- printf "dubbo-system" -}}
 {{- end -}}
\ No newline at end of file
diff --git a/manifests/charts/admin/templates/modular/_names.tpl 
b/manifests/charts/admin/templates/modular/_names.tpl
index eb8d7651..e06f053c 100644
--- a/manifests/charts/admin/templates/modular/_names.tpl
+++ b/manifests/charts/admin/templates/modular/_names.tpl
@@ -19,6 +19,14 @@ Return Admin Name to use.
 {{- printf "admin" -}}
 {{- end -}}
 
+{{/*
+Return Dubbo Namespace to use.
+*/}}
+{{- define "admin.namespace" -}}
+{{- "dubbo-system" | default }}
+{{- end }}
+
+
 {{/*
 Return ZooKeeper Name to use.
 */}}
diff --git 
a/manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml 
b/manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml
index 1768a1b7..a5140b3d 100644
--- a/manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml
+++ b/manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml
@@ -11,4 +11,22 @@
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
-  # limitations under the License.
+# limitations under the License.
+
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: {{ template "admin.name" . }}
+  namespace: {{ template "admin.namespace" . }}
+spec:
+  endpoints:
+    - interval: 15s
+      port: admin-http
+      scheme: http
+  jobLabel: app.kubernetes.io/name
+  namespaceSelector:
+    matchNames:
+      - dubbo-system
+  selector:
+    matchLabels:
+      app.kubernetes.io/name: {{ template "admin.name" . }}
\ No newline at end of file
diff --git 
a/manifests/charts/admin/templates/observable/grafana-resources-app-traces.yaml 
b/manifests/charts/admin/templates/observable/grafana-resources-app-traces.yaml
index 1768a1b7..ae1e83ee 100644
--- 
a/manifests/charts/admin/templates/observable/grafana-resources-app-traces.yaml
+++ 
b/manifests/charts/admin/templates/observable/grafana-resources-app-traces.yaml
@@ -11,4 +11,4 @@
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
-  # limitations under the License.
+# limitations under the License.
diff --git a/manifests/charts/admin/templates/traffic/traffic-authority.yaml 
b/manifests/charts/admin/templates/traffic/traffic-authority.yaml
index 83f6bb25..fb4e6667 100644
--- a/manifests/charts/admin/templates/traffic/traffic-authority.yaml
+++ b/manifests/charts/admin/templates/traffic/traffic-authority.yaml
@@ -4,7 +4,7 @@ apiVersion: dubbo.io/v1alpha1
 kind: AuthenticationPolicy
 metadata:
   name: {{ template "cp.name" . }}-authentication
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 spec:
   action: {{ $authc.action }}
   PortLevel:
@@ -16,7 +16,7 @@ apiVersion: dubbo.io/v1alpha1
 kind: AuthorizationPolicy
 metadata:
   name: {{ template "cp.name" . }}-authorization
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 spec:
   action: {{ $authz.action }}
   matchType: {{ $authz.matchType }}
diff --git a/manifests/charts/admin/templates/traffic/traffic-config.yaml 
b/manifests/charts/admin/templates/traffic/traffic-config.yaml
index d972a66d..1c1dd9a4 100644
--- a/manifests/charts/admin/templates/traffic/traffic-config.yaml
+++ b/manifests/charts/admin/templates/traffic/traffic-config.yaml
@@ -3,7 +3,7 @@ apiVersion: dubbo.io/v1alpha1
 kind: ConditionRoute
 metadata:
   name: {{ template "cp.name" . }}-conditionroute
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 spec:
   enabled: {{ $cr.enabled }}
   force: {{ $cr.force }}
@@ -19,7 +19,7 @@ apiVersion: dubbo.io/v1alpha1
 kind: DynamicConfig
 metadata:
   name: {{ template "cp.name" . }}-dynamicconfig
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 spec:
   configVersion: {{ $dc.configVersion }}
   scope: {{ $dc.scope }}
@@ -35,7 +35,7 @@ apiVersion: dubbo.io/v1alpha1
 kind: TagRoute
 metadata:
   name: {{ template "cp.name" . }}-tagroute
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 spec:
   configVersion: {{ $tr.configVersion }}
   force: {{ $tr.force }}
diff --git a/manifests/charts/admin/templates/traffic/traffic-rbac.yaml 
b/manifests/charts/admin/templates/traffic/traffic-rbac.yaml
index 0f29ff8b..0924170e 100644
--- a/manifests/charts/admin/templates/traffic/traffic-rbac.yaml
+++ b/manifests/charts/admin/templates/traffic/traffic-rbac.yaml
@@ -2,7 +2,7 @@ apiVersion: v1
 kind: ServiceAccount
 metadata:
   name: {{ template "cp.name" . }}-sa
-  namespace: {{ template "system.namespaces" . }}
+  namespace: {{ template "admin.namespace" . }}
 ---
 apiVersion: {{ include "rbac.apiVersion" . }}
 kind: ClusterRole
@@ -27,4 +27,4 @@ roleRef:
 subjects:
   - kind: ServiceAccount
     name: {{ template "cp.name" . }}-sa
-    namespace: {{ template "system.namespaces" . }}
\ No newline at end of file
+    namespace: {{ template "admin.namespace" . }}
\ No newline at end of file

Reply via email to