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 caf565b9 [charts] change jobs shell
caf565b9 is described below

commit caf565b9678656e2811067cf70ecfc866d0cf4cf
Author: mfordjody <[email protected]>
AuthorDate: Fri Oct 18 07:15:30 2024 +0800

    [charts] change jobs shell
---
 manifests/charts/admin/templates/jobs.yaml         | 48 +++++++++++-----------
 .../charts/admin/templates/modular/_names.tpl      |  2 +-
 2 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/manifests/charts/admin/templates/jobs.yaml 
b/manifests/charts/admin/templates/jobs.yaml
index cbbf45fc..ea7f8e8f 100644
--- a/manifests/charts/admin/templates/jobs.yaml
+++ b/manifests/charts/admin/templates/jobs.yaml
@@ -1,5 +1,5 @@
-{{- $prom := .Values.kubePrometheus }}
 {{- $jobs := .Values.jobs -}}
+{{- $prom := .Values.kubePrometheus }}
 apiVersion: v1
 kind: ConfigMap
 metadata:
@@ -25,32 +25,30 @@ data:
     kubectl get namespace istio-system >/dev/null 2>&1 || kubectl create 
namespace istio-system
 
   helm.sh: |-
-    #!/bin/bash
-
+   #!/bin/bash
     set -eux
     ISTIO="https://istio-release.storage.googleapis.com/charts";
-
-    {{- if $prom.enabled }}
     PROMETHEUS="https://prometheus-community.github.io/helm-charts";
 
-    helm pull {{ include "prom.name" . }} --repo "$PROMETHEUS" --version {{ 
$prom.image.tag }} --untar && rm -rf {{ include "prom.name" . }}-{{ 
$prom.image.tag }}.tgz/ \
+    helm pull "{{ include "prom.name" . }}" --repo "$PROMETHEUS" --version "{{ 
$prom.image.tag }}" --untar
+
     for i in {1..5}; do
-      if rm -rf {{ include "prom.name" . }}-{{ $prom.image.tag }}.tgz/; then
-      break
-      else
+    if rm -rf "{{ include "prom.name" . }}-{{ $prom.image.tag }}.tgz"; then
+    break
+    else
     echo "Attempt $i: Failed to remove directory, retrying in 2 seconds..."
-      sleep 2
-      fi
-      done
-    cp -r "/files/dashboards/" {{ include "prom.name" . }}/templates/{{ 
include "grafana.name" . }}/dashboards-{{ $prom.dashboardsVersion }} && \
-    ls -la {{ include "prom.name" . }}/templates/{{ include "grafana.name" . 
}}/dashboards-{{ $prom.dashboardsVersion }} && \
+    sleep 2
+    fi
+    done
+
+    cp -r "/files/dashboards/" "{{ include "prom.name" . }}/templates/{{ 
include "grafana.name" . }}/dashboards-{{ $prom.dashboardsVersion }}"
+    ls -la "{{ include "prom.name" . }}/templates/{{ include "grafana.name" . 
}}/dashboards-{{ $prom.dashboardsVersion }}"
 
-    if helm ls --all | grep -q {{ include "prom.name" . }}; then
-    helm upgrade kube-prometheus ./{{ include "prom.name" . }}/
+    if helm ls --all | grep -q "{{ include "prom.name" . }}"; then
+    helm upgrade kube-prometheus "./{{ include "prom.name" . }}/"
     else
-    helm install kube-prometheus ./{{ include "prom.name" . }}/
+    helm install kube-prometheus "./{{ include "prom.name" . }}/"
     fi
-    {{- end }}
     helm repo add istio "$ISTIO" && \
     helm repo update && \
     helm install istio-base istio/base -n istio-system --set 
defaultRevision=default && \
@@ -62,7 +60,7 @@ data:
 apiVersion: batch/v1
 kind: Job
 metadata:
-  name: dubbo-application-create-1
+  name: dubbo-job-create-1
   namespace: {{ template "admin.namespace" . }}
   labels:
   {{- include "jobs.labels" . | nindent 4 }}
@@ -71,9 +69,9 @@ metadata:
 spec:
   template:
     metadata:
-      name: dubbo-application-create-1
+      name: dubbo-job-create-1
     spec:
-      serviceAccountName: helm-job-sa
+      serviceAccountName: job-sa
       restartPolicy: {{ $jobs.restartPolicy }}
       dnsPolicy: "None"
       dnsConfig:
@@ -105,7 +103,7 @@ spec:
 apiVersion: batch/v1
 kind: Job
 metadata:
-  name: dubbo-application-create-2
+  name: dubbo-job-create-2
   namespace: {{ template "admin.namespace" . }}
   labels:
   {{- include "jobs.labels" . | nindent 4 }}
@@ -114,7 +112,7 @@ metadata:
 spec:
   template:
     metadata:
-      name: dubbo-application-create-2
+      name: dubbo-job-create-2
     spec:
       serviceAccountName: job-sa
       restartPolicy: {{ $jobs.restartPolicy }}
@@ -156,7 +154,7 @@ metadata:
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRoleBinding
 metadata:
-  name: helm-job-sa-binding
+  name: job-sa-binding
   annotations:
   {{- include "jobs.sa.annotations" . | nindent 4 }}
 roleRef:
@@ -165,5 +163,5 @@ roleRef:
   name: cluster-admin
 subjects:
 - kind: ServiceAccount
-  name: helm-job-sa
+  name: job-sa
   namespace: {{ template "admin.namespace" . }}
\ 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 4f4070af..2ddabfc1 100644
--- a/manifests/charts/admin/templates/modular/_names.tpl
+++ b/manifests/charts/admin/templates/modular/_names.tpl
@@ -44,7 +44,7 @@ Return Kube-Prometheus Name to use.
 Return Grafana Name to use.
 */}}
 {{- define "grafana.name" -}}
-{{- printf "grafana" -}}
+{{- printf "kube-prometheus-grafana" -}}
 {{- end -}}
 
 {{/*

Reply via email to