Skip to content

Commit cde22a6

Browse files
authored
Merge branch 'master' into packs-volumes
2 parents 5456f40 + fd2e6db commit cde22a6

File tree

3 files changed

+43
-19
lines changed

3 files changed

+43
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## In Development
4+
* New feature: Shared packs volumes `st2.packs.volumes`. Allow using cluster-specific persistent volumes to store packs, virtualenvs, and (optionally) configs. This enables using `st2 pack install`. It even works with `st2packs` images in `st2.packs.images`. (#199) (by @cognifloyd)
45
* Updated redis constant sentinel ID which will allow other sentinel peers to update to the new given IP in case of pod failure or worker node reboots. (#191) (by @manisha-tanwar)
56
* Removed reference to st2-license pullSecrets, which was missed when removing enterprise flags (#192) (by @cognifloyd)
67
* Add optional imagePullSecrets to ServiceAccount using `serviceAccount.pullSecret` from values.yaml. If pods do not have imagePullSecrets (eg without `image.pullSecret` in values.yaml), k8s populates them from the ServiceAccount. (#196) (by @cognifloyd)
@@ -19,7 +20,7 @@
1920
* Allow providing scripts in values for use in lifecycle postStart hooks of all deployments. (#206) (by @cognifloyd)
2021
* Add preRegisterContentCommand in an initContainer for register-content job to run last-minute content customizations (#213) (by @cognifloyd)
2122
* Fix a bug when datastore cryto keys are not able to read by the rules engine. ``datastore_crypto_key`` volume is now mounted on the ``st2rulesengine`` pods (#223) (by @moti1992)
22-
* New feature: Shared packs volumes `st2.packs.volumes`. Allow using cluster-specific persistent volumes to store packs, virtualenvs, and (optionally) configs. This enables using `st2 pack install`. It even works with `st2packs` images in `st2.packs.images`. (#199) (by @cognifloyd)
23+
* Minimize required sensor config by using default values from st2sensorcontainer for each sensor in st2.packs.sensors (#221) (by @cognifloyd)
2324

2425
## v0.60.0
2526
* Switch st2 version to `v3.5dev` as a new latest development version (#187)

templates/deployments.yaml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -990,13 +990,18 @@ spec:
990990
{{- end }}
991991

992992
{{- range .Values.st2.packs.sensors }}
993+
{{- $sensor := omit $.Values.st2sensorcontainer "name" "ref" "postStartScript" }}
994+
{{- range $key, $val := . }}
995+
{{- $_ := set $sensor $key $val }}
996+
{{- end }}
997+
{{- $name := print "st2sensorcontainer" (include "hyphenPrefix" $sensor.name) }}
993998
---
994999
apiVersion: apps/v1
9951000
kind: Deployment
9961001
metadata:
997-
name: {{ $.Release.Name }}-st2sensorcontainer{{ template "hyphenPrefix" .name }}
1002+
name: {{ $.Release.Name }}-{{ $name }}
9981003
labels:
999-
app: st2sensorcontainer{{ template "hyphenPrefix" .name }}
1004+
app: {{ $name }}
10001005
tier: backend
10011006
vendor: stackstorm
10021007
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
@@ -1005,7 +1010,7 @@ metadata:
10051010
spec:
10061011
selector:
10071012
matchLabels:
1008-
app: st2sensorcontainer{{ template "hyphenPrefix" .name }}
1013+
app: {{ $name }}
10091014
release: {{ $.Release.Name }}
10101015
# https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer
10111016
# It is possible to run st2sensorcontainer in HA mode by running one process on each compute instance. Each sensor node needs to be
@@ -1015,7 +1020,7 @@ spec:
10151020
template:
10161021
metadata:
10171022
labels:
1018-
app: st2sensorcontainer{{ template "hyphenPrefix" .name }}
1023+
app: {{ $name }}
10191024
tier: backend
10201025
vendor: stackstorm
10211026
chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
@@ -1028,8 +1033,8 @@ spec:
10281033
{{- if $.Values.st2sensorcontainer.postStartScript }}
10291034
checksum/post-start-script: {{ $.Values.st2sensorcontainer.postStartScript | sha256sum }}
10301035
{{- end }}
1031-
{{- if .annotations }}
1032-
{{- toYaml .annotations | nindent 8 }}
1036+
{{- if $sensor.annotations }}
1037+
{{- toYaml $sensor.annotations | nindent 8 }}
10331038
{{- end }}
10341039
spec:
10351040
imagePullSecrets:
@@ -1046,26 +1051,26 @@ spec:
10461051
{{- include "packs-initContainers" $ | nindent 6 }}
10471052
{{- end }}
10481053
containers:
1049-
- name: st2sensorcontainer{{ template "hyphenPrefix" .name }}
1050-
image: '{{ template "imageRepository" $ }}/st2sensorcontainer:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
1054+
- name: {{ $name }}
1055+
image: '{{ template "imageRepository" $ }}/st2sensorcontainer:{{ tpl ($sensor.image.tag | default $.Values.image.tag) $ }}'
10511056
imagePullPolicy: {{ $.Values.image.pullPolicy }}
1052-
{{- with .readinessProbe }}
1057+
{{- with $sensor.readinessProbe }}
10531058
# Probe to check if app is running. Failure will lead to a pod restart.
10541059
readinessProbe:
10551060
{{- toYaml . | nindent 10 }}
10561061
{{- end }}
1057-
{{- with .livenessProbe }}
1062+
{{- with $sensor.livenessProbe }}
10581063
livenessProbe:
10591064
{{- toYaml . | nindent 10 }}
10601065
{{- end }}
1061-
{{- if .ref }}
1066+
{{- if $sensor.ref }}
10621067
command:
10631068
- /opt/stackstorm/st2/bin/st2sensorcontainer
10641069
- --config-file=/etc/st2/st2.conf
10651070
- --config-file=/etc/st2/st2.docker.conf
10661071
- --config-file=/etc/st2/st2.user.conf
10671072
- --single-sensor-mode
1068-
- --sensor-ref={{ .ref }}
1073+
- --sensor-ref={{ $sensor.ref }}
10691074
{{- end }}
10701075
envFrom:
10711076
- configMapRef:
@@ -1088,8 +1093,8 @@ spec:
10881093
command: ["/bin/bash", "/post-start.sh"]
10891094
{{- end }}
10901095
resources:
1091-
{{- toYaml .resources | nindent 10 }}
1092-
{{- if .serviceAccount.attach }}
1096+
{{- toYaml $sensor.resources | nindent 10 }}
1097+
{{- if $sensor.serviceAccount.attach }}
10931098
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" $ }}
10941099
{{- end }}
10951100
volumes:
@@ -1114,13 +1119,13 @@ spec:
11141119
{{- with $.Values.dnsConfig }}
11151120
dnsConfig: {{- toYaml . | nindent 8 }}
11161121
{{- end }}
1117-
{{- with .nodeSelector }}
1122+
{{- with $sensor.nodeSelector }}
11181123
nodeSelector: {{- toYaml . | nindent 8 }}
11191124
{{- end }}
1120-
{{- with .affinity }}
1125+
{{- with $sensor.affinity }}
11211126
affinity: {{- toYaml . | nindent 8 }}
11221127
{{- end }}
1123-
{{- with .tolerations }}
1128+
{{- with $sensor.tolerations }}
11241129
tolerations: {{- toYaml . | nindent 8 }}
11251130
{{- end }}
11261131
{{- end }}

values.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ st2:
149149
# It is possible to run st2sensorcontainer in HA mode by running one process on each compute instance.
150150
# Each sensor node needs to be provided with proper partition information to share work with other sensor
151151
# nodes so that the same sensor does not run on different nodes.
152+
# Defaults come from st2sensorcontainer (see below), with per-sensor overrides defined here.
152153
sensors:
153154
# Specify default container that executes all sensors.
154155
# To partition sensors with one sensor per node, override st2.packs.sensors.
@@ -531,8 +532,25 @@ st2actionrunner:
531532

532533
# https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer
533534
# Please see st2.packs.sensors for each sensor instance's config.
534-
# This contains settings that are common to all sensor pods.
535+
# This contains default settings for all sensor pods.
535536
st2sensorcontainer:
537+
resources:
538+
requests:
539+
memory: "100Mi"
540+
cpu: "50m"
541+
# Override default image settings (for now, only tag can be overridden)
542+
image: {}
543+
## Note that Helm templating is supported in this block!
544+
#tag: "{{ .Values.image.tag }}"
545+
livenessProbe: {}
546+
readinessProbe: {}
547+
annotations: {}
548+
# Additional advanced settings to control pod/deployment placement
549+
affinity: {}
550+
nodeSelector: {}
551+
tolerations: []
552+
serviceAccount:
553+
attach: false
536554
# postStartScript is optional. It has the contents of a bash script.
537555
# k8s will run the script in the st2 container in parallel with the ENTRYPOINT.
538556
# The pod will not be marked as "running" until this script completes successfully.

0 commit comments

Comments
 (0)