From 45b73eafe01961039b1533d28695a7e71714afca Mon Sep 17 00:00:00 2001 From: Y-Rookie Date: Thu, 9 Nov 2023 17:34:27 +0800 Subject: [PATCH] add kubeblock component post start demo --- .../pika/templates/clusterdefinition.yaml | 7 +++++++ tools/kubeblocks_helm/pika/templates/script.yaml | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/tools/kubeblocks_helm/pika/templates/clusterdefinition.yaml b/tools/kubeblocks_helm/pika/templates/clusterdefinition.yaml index a81a82bdbb..4433e81510 100644 --- a/tools/kubeblocks_helm/pika/templates/clusterdefinition.yaml +++ b/tools/kubeblocks_helm/pika/templates/clusterdefinition.yaml @@ -32,6 +32,13 @@ spec: namespace: {{ .Release.Namespace }} volumeName: script defaultMode: 0555 + postStartSpec: + cmdExecutorConfig: + image: {{ .Values.image.pika.registry | default "docker.io" }}/{{ .Values.image.pika.repository }}:{{ .Values.image.pika.tag }} + command: + - /script/pika-group-post-start.sh + scriptSpecSelectors: + - name: pika-script podSpec: containers: - name: pika diff --git a/tools/kubeblocks_helm/pika/templates/script.yaml b/tools/kubeblocks_helm/pika/templates/script.yaml index d550ace041..aeb893a54b 100644 --- a/tools/kubeblocks_helm/pika/templates/script.yaml +++ b/tools/kubeblocks_helm/pika/templates/script.yaml @@ -7,3 +7,13 @@ metadata: data: admin.sh: |- {{- .Files.Get "script/admin.sh" | nindent 4 }} + pika-group-post-start.sh: |- + #! /bin/bash + set -x + + echo "add your post start script logic here" + envParams=$(env) + echo "add envs can be used in script:" + echo $envParams + + sleep 60 \ No newline at end of file