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 13f317cc [charts] Sorting out deployment logic (#465)
13f317cc is described below
commit 13f317ccaf0a339bc0170242aa508de0052ef370
Author: mfordjody <[email protected]>
AuthorDate: Tue Oct 15 19:41:10 2024 +0800
[charts] Sorting out deployment logic (#465)
---
manifests/charts/admin/files/env.sh | 20 ----
manifests/charts/admin/files/helm.sh | 18 +++
manifests/charts/admin/files/kubectl.sh | 13 +++
manifests/charts/admin/templates/install.yaml | 126 +++++++++++++++++++++
.../{servicemonitor.yaml => _servicemonitor.yaml} | 0
manifests/charts/admin/templates/scripts.yaml | 29 -----
6 files changed, 157 insertions(+), 49 deletions(-)
diff --git a/manifests/charts/admin/files/env.sh
b/manifests/charts/admin/files/env.sh
deleted file mode 100644
index dfb082fb..00000000
--- a/manifests/charts/admin/files/env.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-JAEGER="https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/jaeger.yaml"
-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 dashboards/ kube-prometheus-stack/templates/grafana/dashboards-1.14/
-cd kube-prometheus-stack
-helm install kube-prometheus-stack -f values.yaml .
-
-kubectl apply -f $JAEGER
-
-helm repo add istio $ISTIO
-helm repo update
-
-kubectl create namespace istio-system || true
-
-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
diff --git a/manifests/charts/admin/files/helm.sh
b/manifests/charts/admin/files/helm.sh
new file mode 100644
index 00000000..945b0913
--- /dev/null
+++ b/manifests/charts/admin/files/helm.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+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/ && \
+cd kube-prometheus-stack && \
+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
diff --git a/manifests/charts/admin/files/kubectl.sh
b/manifests/charts/admin/files/kubectl.sh
new file mode 100644
index 00000000..4605633b
--- /dev/null
+++ b/manifests/charts/admin/files/kubectl.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -eux
+
+JAEGER="https://raw.githubusercontent.com/istio/istio/release-1.23/samples/addons/jaeger.yaml"
+
+kubectl apply -f $JAEGER
+
+kubectl create namespace istio-system
+if [ $? -eq 0 ]; then
+ # shellcheck disable=SC2105
+ continue
+fi
\ No newline at end of file
diff --git a/manifests/charts/admin/templates/install.yaml
b/manifests/charts/admin/templates/install.yaml
new file mode 100644
index 00000000..9336082d
--- /dev/null
+++ b/manifests/charts/admin/templates/install.yaml
@@ -0,0 +1,126 @@
+{{- $jobs := .Values.jobs -}}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: jobs-env
+ namespace: default
+ labels:
+ app.kubernetes.io/name: jobs
+ helm.sh/chart: jobs-1.28.4
+ app.kubernetes.io/managed-by: Helm
+ annotations:
+ "helm.sh/hook": "pre-install"
+ "helm.sh/hook-weight": "-1"
+ "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
+data:
+ kubectl.sh: |-
+ {{- .Files.Get "files/kubectl.sh" | nindent 4 }}
+ helm.sh: |-
+ {{- .Files.Get "files/helm.sh" | nindent 4 }}
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: jobs-1
+ namespace: default
+ labels:
+ app.kubernetes.io/name: jobs
+ helm.sh/chart: jobs-1.28.4
+ app.kubernetes.io/managed-by: Helm
+ annotations:
+ "helm.sh/hook": "pre-install"
+ "helm.sh/hook-delete-policy": "before-hook-creation,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
+ searches:
+ - 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
+ volumes:
+ - name: scripts
+ configMap:
+ name: jobs-env
+ defaultMode: 0755
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: jobs-2
+ namespace: default
+ labels:
+ app.kubernetes.io/name: jobs
+ helm.sh/chart: jobs-1.28.4
+ app.kubernetes.io/managed-by: Helm
+ annotations:
+ "helm.sh/hook": "pre-install"
+ "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
+spec:
+ template:
+ metadata:
+ name: jobs-2
+ namespace: default
+ spec:
+ serviceAccountName: helm-job-sa
+ restartPolicy: OnFailure
+ dnsPolicy: "None"
+ dnsConfig:
+ nameservers:
+ - 8.8.8.8
+ searches:
+ - default.svc.cluster.local
+ containers:
+ - name: helm
+ image: alpine/helm:3.16.2
+ imagePullPolicy: {{ $jobs.image.pullPolicy }}
+ command: ["/bin/sh", "-c", "sh /files/helm.sh"]
+ volumeMounts:
+ - name: scripts
+ mountPath: /files/helm.sh
+ subPath: helm.sh
+ volumes:
+ - name: scripts
+ configMap:
+ name: jobs-env
+ defaultMode: 0755
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: helm-job-sa
+ namespace: default
+ annotations:
+ "helm.sh/hook": "pre-install"
+ "helm.sh/hook-delete-policy": "before-hook-creation"
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: helm-job-sa-binding
+ annotations:
+ "helm.sh/hook": "pre-install"
+ "helm.sh/hook-delete-policy": "before-hook-creation"
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: cluster-admin
+subjects:
+ - kind: ServiceAccount
+ name: helm-job-sa
+ namespace: default
\ No newline at end of file
diff --git
a/manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml
b/manifests/charts/admin/templates/observable/exporters/_servicemonitor.yaml
similarity index 100%
rename from
manifests/charts/admin/templates/observable/exporters/servicemonitor.yaml
rename to
manifests/charts/admin/templates/observable/exporters/_servicemonitor.yaml
diff --git a/manifests/charts/admin/templates/scripts.yaml
b/manifests/charts/admin/templates/scripts.yaml
deleted file mode 100644
index 39c7ba7e..00000000
--- a/manifests/charts/admin/templates/scripts.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: my-script
-data:
- env.sh: |-
-
- {{- .Files.Get "files/env.sh" | indent 4 }}
----
-apiVersion: batch/v1
-kind: Job
-metadata:
- name: run-external-script
-spec:
- template:
- spec:
- containers:
- - name: script-runner
- image: alpine:latest # 选择一个适合的基础镜像
- command: ["/bin/sh", "-c", "/scripts/env.sh"]
- volumeMounts:
- - name: script-volume
- mountPath: /scripts
- restartPolicy: Never
- volumes:
- - name: script-volume
- configMap:
- name: my-script
- backoffLimit: 4