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 d6e0deab [charts] Change files directory shell (#466)
d6e0deab is described below
commit d6e0deab502a158d0439b507701247447599b637
Author: mfordjody <[email protected]>
AuthorDate: Wed Oct 16 07:39:42 2024 +0800
[charts] Change files directory shell (#466)
---
manifests/charts/admin/dashboards.yaml | 10 +++++
manifests/charts/admin/files/helm.sh | 13 +++----
manifests/charts/admin/files/kubectl.sh | 6 +--
manifests/charts/admin/templates/install.yaml | 54 ++++++++++++++++-----------
4 files changed, 50 insertions(+), 33 deletions(-)
diff --git a/manifests/charts/admin/dashboards.yaml
b/manifests/charts/admin/dashboards.yaml
new file mode 100644
index 00000000..3b13970d
--- /dev/null
+++ b/manifests/charts/admin/dashboards.yaml
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dashboards-config
+ namespace: default
+data:
+ {{- range $file := .Files.Glob "files/dashboards/**.yaml" }}
+ {{ $file.Name | basename }}: |-
+ {{ .Files.Get $file.Name | indent 4 }}
+ {{- end }}
\ No newline at end of file
diff --git a/manifests/charts/admin/files/helm.sh
b/manifests/charts/admin/files/helm.sh
index 945b0913..59b67674 100644
--- a/manifests/charts/admin/files/helm.sh
+++ b/manifests/charts/admin/files/helm.sh
@@ -2,17 +2,16 @@
set -eux
-WORKDIR=$(dirname "$0")
-WORKDIR=$(cd "$WORKDIR"; pwd)
+
PROMETHEUS="https://prometheus-community.github.io/helm-charts"
ISTIO="https://istio-release.storage.googleapis.com/charts"
-helm pull kube-prometheus-stack --repo $PROMETHEUS --version 65.2.0 --untar &&
\
-cp -r ${WORKDIR}/files/dashboards/
kube-prometheus-stack/templates/grafana/dashboards-1.14/ && \
+helm pull kube-prometheus-stack --repo "$PROMETHEUS" --version 65.2.0 --untar
&& \
+cp -r "/files/dashboards/"
kube-prometheus-stack/templates/grafana/dashboards-1.14/ && \
cd kube-prometheus-stack && \
-helm install kube-prometheus-stack -f values.yaml . &&\
-helm repo add istio $ISTIO && \
+helm install kube-prometheus-stack -f values.yaml . && \
+helm repo add istio "$ISTIO" && \
helm repo update && \
helm install istio-base istio/base -n istio-system --set
defaultRevision=default && \
-helm install istiod istio/istiod -n istio-system && \
\ No newline at end of file
+helm install istiod istio/istiod -n istio-system
diff --git a/manifests/charts/admin/files/kubectl.sh
b/manifests/charts/admin/files/kubectl.sh
index 4605633b..2ea3d6ab 100644
--- a/manifests/charts/admin/files/kubectl.sh
+++ b/manifests/charts/admin/files/kubectl.sh
@@ -6,8 +6,4 @@
JAEGER="https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addon
kubectl apply -f $JAEGER
-kubectl create namespace istio-system
-if [ $? -eq 0 ]; then
- # shellcheck disable=SC2105
- continue
-fi
\ No newline at end of file
+kubectl get namespace istio-system >/dev/null 2>&1 || kubectl create namespace
istio-system
diff --git a/manifests/charts/admin/templates/install.yaml
b/manifests/charts/admin/templates/install.yaml
index 9336082d..6301a609 100644
--- a/manifests/charts/admin/templates/install.yaml
+++ b/manifests/charts/admin/templates/install.yaml
@@ -10,7 +10,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": "pre-install"
- "helm.sh/hook-weight": "-1"
+ "helm.sh/hook-weight": "0"
"helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
data:
kubectl.sh: |-
@@ -29,35 +29,38 @@ metadata:
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": "pre-install"
- "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
+ "helm.sh/hook-weight": "1"
+ "helm.sh/hook-delete-policy": "hook-succeeded"
spec:
template:
metadata:
name: jobs-1
- namespace: default
spec:
serviceAccountName: helm-job-sa
restartPolicy: OnFailure
dnsPolicy: "None"
dnsConfig:
nameservers:
- - 8.8.8.8
+ - 8.8.8.8
searches:
- - default.svc.cluster.local
+ - default.svc.cluster.local
containers:
- - name: kubectl
- image: {{ $jobs.image.registry }}:{{ $jobs.image.tag }}
- imagePullPolicy: {{ $jobs.image.pullPolicy }}
- command: [ "/bin/sh", "-c", "sh /files/kubectl.sh"]
- volumeMounts:
- - name: scripts
- mountPath: /files/kubectl.sh
- subPath: kubectl.sh
+ - name: kubectl
+ image: "{{ $jobs.image.registry }}:{{ $jobs.image.tag }}"
+ imagePullPolicy: "{{ $jobs.image.pullPolicy }}"
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "sh /files/kubectl.sh"
+ volumeMounts:
+ - name: scripts
+ mountPath: /files/kubectl.sh
+ subPath: kubectl.sh
volumes:
- - name: scripts
- configMap:
- name: jobs-env
- defaultMode: 0755
+ - name: scripts
+ configMap:
+ name: jobs-env
+ defaultMode: 0755
---
apiVersion: batch/v1
kind: Job
@@ -70,12 +73,12 @@ metadata:
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": "pre-install"
- "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
+ "helm.sh/hook-weight": "2"
+ "helm.sh/hook-delete-policy": "hook-succeeded"
spec:
template:
metadata:
name: jobs-2
- namespace: default
spec:
serviceAccountName: helm-job-sa
restartPolicy: OnFailure
@@ -88,17 +91,26 @@ spec:
containers:
- name: helm
image: alpine/helm:3.16.2
- imagePullPolicy: {{ $jobs.image.pullPolicy }}
- command: ["/bin/sh", "-c", "sh /files/helm.sh"]
+ imagePullPolicy: "{{ $jobs.image.pullPolicy }}"
+ workingDir: "/admin"
+ command:
+ - "/bin/sh"
+ - "-c"
+ - "sh /files/helm.sh"
volumeMounts:
- name: scripts
mountPath: /files/helm.sh
subPath: helm.sh
+ - name: dashboards
+ mountPath: /files/dashboards
volumes:
- name: scripts
configMap:
name: jobs-env
defaultMode: 0755
+ - name: dashboards
+ configMap:
+ name: dashboards-config
---
apiVersion: v1
kind: ServiceAccount