Skip to content

Commit 2e660e5

Browse files
committed
Fix stanley_rsa file permissions
Add chown command to postStart lifecycle hook for actionrunner and st2client pods
1 parent 824bf74 commit 2e660e5

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ $.Release.Name }}-st2actionrunner-post-start-script
6+
annotations:
7+
description: Custom postStart lifecycle event handler script for st2actionrunner
8+
labels:
9+
app: st2
10+
tier: backend
11+
vendor: stackstorm
12+
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
13+
release: {{ $.Release.Name }}
14+
heritage: {{ $.Release.Service }}
15+
data:
16+
# k8s calls this script in parallel with starting st2actionrunner (ie the same time as ENTRYPOINT)
17+
# The pod will not be marked as "running" until this script completes successfully.
18+
# see: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
19+
post-start.sh: |
20+
#!/bin/bash
21+
chown -R stanley:stanley /home/stanley/.ssh/

templates/deployments.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,13 @@ spec:
10351035
mountPath: /opt/stackstorm/virtualenvs
10361036
readOnly: true
10371037
{{- end }}
1038+
- name: st2-post-start-script-vol
1039+
mountPath: /post-start.sh
1040+
subPath: post-start.sh
1041+
lifecycle:
1042+
postStart:
1043+
exec:
1044+
command: ["/bin/bash", "-c", "/post-start.sh"]
10381045
resources:
10391046
{{- toYaml .Values.st2actionrunner.resources | nindent 10 }}
10401047
{{- if .Values.st2actionrunner.serviceAccount.attach }}
@@ -1061,6 +1068,9 @@ spec:
10611068
{{- if .Values.st2.packs.images }}
10621069
{{- include "packs-volumes" . | indent 8 }}
10631070
{{- end }}
1071+
- name: st2-post-start-script-vol
1072+
configMap:
1073+
name: {{ .Release.Name }}-st2actionrunner-post-start-script
10641074
{{- if .Values.dnsPolicy }}
10651075
dnsPolicy: {{ .Values.dnsPolicy }}
10661076
{{- end }}
@@ -1274,10 +1284,17 @@ spec:
12741284
mountPath: /opt/stackstorm/virtualenvs
12751285
readOnly: true
12761286
{{- end }}
1287+
- name: st2-post-start-script-vol
1288+
mountPath: /post-start.sh
1289+
subPath: post-start.sh
12771290
command:
12781291
- 'bash'
12791292
- '-ec'
12801293
- 'while true; do sleep 999; done'
1294+
lifecycle:
1295+
postStart:
1296+
exec:
1297+
command: ["/bin/bash", "-c", "/post-start.sh"]
12811298
resources:
12821299
requests:
12831300
memory: "5Mi"
@@ -1320,6 +1337,9 @@ spec:
13201337
{{- if .Values.st2.packs.images }}
13211338
{{- include "packs-volumes" . | indent 8 }}
13221339
{{- end }}
1340+
- name: st2-post-start-script-vol
1341+
configMap:
1342+
name: {{ .Release.Name }}-st2actionrunner-post-start-script
13231343

13241344
{{ if .Values.st2chatops.enabled -}}
13251345
---

0 commit comments

Comments
 (0)