Skip to content

Commit c65e635

Browse files
committed
add postStart lifecycle hook script to all deployments
1 parent 1ff6e36 commit c65e635

File tree

3 files changed

+268
-12
lines changed

3 files changed

+268
-12
lines changed
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
{{- range tuple "st2auth" "st2api" "st2stream" "st2web" "st2rulesengine" "st2timersengine" "st2workflowengine" "st2scheduler" "st2notifier" "st2sensorcontainer" "st2actionrunner" "st2garbagecollector" "st2client" "st2chatops" -}}
2+
{{- if or (index $.Values . "postStartScript") (eq . "st2actionrunner") (eq . "st2client") }}
13
---
24
apiVersion: v1
35
kind: ConfigMap
46
metadata:
5-
name: {{ $.Release.Name }}-st2actionrunner-post-start-script
7+
name: {{ $.Release.Name }}-{{ . }}-post-start-script
68
annotations:
7-
description: Custom postStart lifecycle event handler script for st2actionrunner
9+
description: Custom postStart lifecycle event handler script for {{ . }}
810
labels:
911
app: st2
1012
tier: backend
@@ -13,11 +15,12 @@ metadata:
1315
release: {{ $.Release.Name }}
1416
heritage: {{ $.Release.Service }}
1517
data:
16-
# k8s calls this script in parallel with starting st2actionrunner (ie the same time as ENTRYPOINT)
18+
# k8s calls this script in parallel with starting {{ . }} (ie the same time as ENTRYPOINT)
1719
# The pod will not be marked as "running" until this script completes successfully.
1820
# see: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
1921
post-start.sh: |
2022
#!/bin/bash
23+
{{- if or (eq . "st2actionrunner") (eq . "st2client") }}
2124
{{- $system_user := $.Values.st2.system_user.user }}
2225
{{- $ssh_key_file := tpl $.Values.st2.system_user.ssh_key_file $ }}
2326
{{- $ssh_key_file_name := base $ssh_key_file }}
@@ -27,3 +30,8 @@ data:
2730
chown -R {{ $system_user }}:{{ $system_user }} {{ $ssh_key_file_dir }}
2831
chmod 400 {{ $ssh_key_file }}
2932
chmod 500 {{ $ssh_key_file_dir }}
33+
{{- end }}
34+
{{- index $.Values . "postStartScript" | nindent 4 }}
35+
36+
{{- end }}
37+
{{- end -}}

0 commit comments

Comments
 (0)