Skip to content

Commit

Permalink
Merge branch 'master' into feature/pull-policy
Browse files Browse the repository at this point in the history
  • Loading branch information
cognifloyd authored Apr 11, 2024
2 parents 8014b31 + b278850 commit fabbea9
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 27 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## In Development
## Development
* Fix syntax with ensure-packs-volumes-are-writable job (#403) (by @skiedude)
* Add securityContext support to custom st2packs images, extra_hooks jobs; Also fallback to st2actionrunner securityContext for misc init container jobs and pods. (#410) (by @cognifloyd)
* Stop generating the DataStore Secret (#385) and checksum labels (#391) when existing secret provided or disabled (by @bmarick)
* Stop generating the checksum labels for Auth Secret (#392) when existing secret provided or disabled (by @bmarick)

## v1.0.0
* Bump to latest CircleCI orb versions ([email protected] and [email protected] by @ZoeLeah)
* Remove unsupported k8s Versions (1.24.x and 1.25.x by @ZoeLeah)
* Update and add new K8s versions (1.28.3, 1.27.7 and 1.26.10 by @ZoeLeah)
Expand Down
2 changes: 1 addition & 1 deletion Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
# StackStorm version which refers to Docker images tag
appVersion: "3.8"
name: stackstorm-ha
version: 0.110.0
version: 1.0.0
description: StackStorm K8s Helm Chart, optimized for running StackStorm in HA environment.
home: https://stackstorm.com/
icon: https://landscape.cncf.io/logos/stack-storm.svg
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ NOTE: With care, `st2packs` images can be used with `volumes`. Just make sure to
If a pack is installed via an `st2packs` image and then it gets updated with `st2 pack install`, a subsequent `helm upgrade` will revert back to the version in the `st2packs` image.

#### Configure the storage volumes
Enable the `st2.packs.voluems` section of Helm values and add volume definitions for both `packs` and `virtualenvs`.
Enable the `st2.packs.volumes` section of Helm values and add volume definitions for both `packs` and `virtualenvs`.
Each of the volume definitions should be customized for your cluster and storage solution.

For example, to use persistentVolumeClaims:
Expand Down Expand Up @@ -369,3 +369,11 @@ This approach allows not only extending sub-chart with custom objects and templa
but also adds flexibility to include many sub-chart dependencies and pin versions as well as include all the sub-chart values in one single place.
This approach is infra-as-code friendly and more reproducible. See official Helm documentation about
[Subcharts](https://helm.sh/docs/chart_template_guide/#subcharts-and-global-values) and [Dependencies](https://helm.sh/docs/developing_charts/#managing-dependencies-manually-via-the-charts-directory).

## Releasing information
In order to create a release, the steps are as follows:
1. Create a pull request by updating [CHANGELOG.md](./CHANGELOG.md) by replacing the "In Development" heading with the new version, and [Chart.yaml](./Chart.yaml) by replacing the `version` value.
2. Once the pull request is merged, create and push the matching tag (for example, if you are creating release `v1.0.0`, then the tag should also be `v1.0.0`).
3. After the tag is pushed, create the corresponding [release](https://github.com/StackStorm/stackstorm-k8s/releases).
4. After the release is created, switch to the `gh-pages` branch, and generate the updated [Helm index](https://helm.sh/docs/helm/helm_repo_index/), [package](https://helm.sh/docs/helm/helm_package/) and [provenance](https://helm.sh/docs/topics/provenance/).
5. After committing and pushing the changes in the previous step, verify that the new release is present on [ArtifactHub](https://artifacthub.io/packages/helm/stackstorm/stackstorm-ha).
9 changes: 6 additions & 3 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ Merge packs and virtualenvs from st2 with those from st2packs images
- |
/bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
/bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
{{- with $.Values.securityContext }}
{{- with .securityContext | default $.Values.st2actionrunner.securityContext | default $.Values.securityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Expand All @@ -367,7 +368,8 @@ Merge packs and virtualenvs from st2 with those from st2packs images
- |
/bin/cp -aR /opt/stackstorm/packs/. /opt/stackstorm/packs-shared &&
/bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared
{{- with .Values.securityContext }}
{{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Expand All @@ -386,7 +388,8 @@ Merge packs and virtualenvs from st2 with those from st2packs images
- '-ec'
- |
/bin/cp -aR /opt/stackstorm/configs/. /opt/stackstorm/configs-shared
{{- with .Values.securityContext }}
{{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Expand Down
36 changes: 27 additions & 9 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ spec:
labels: {{- include "stackstorm-ha.labels" (list $ "st2auth") | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
{{- if not .Values.st2.existingAuthSecret }}
checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2auth.postStartScript }}
checksum/post-start-script: {{ .Values.st2auth.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -164,7 +166,9 @@ spec:
labels: {{- include "stackstorm-ha.labels" (list $ "st2api") | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2api.postStartScript }}
checksum/post-start-script: {{ .Values.st2api.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -428,7 +432,7 @@ spec:
- name: st2web
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2web:{{ tpl (.Values.st2web.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2web.securityContext }}
{{- with .Values.st2web.securityContext | default .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
ports:
Expand Down Expand Up @@ -515,7 +519,7 @@ spec:
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with default .Values.podSecurityContext .Values.st2client.podSecurityContext }}
{{- with .Values.st2web.podSecurityContext | default .Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2web.nodeSelector }}
Expand Down Expand Up @@ -548,7 +552,9 @@ spec:
labels: {{- include "stackstorm-ha.labels" (list $ "st2rulesengine") | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2rulesengine.postStartScript }}
checksum/post-start-script: {{ .Values.st2rulesengine.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -769,7 +775,9 @@ spec:
labels: {{- include "stackstorm-ha.labels" (list $ "st2workflowengine") | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2workflowengine.postStartScript }}
checksum/post-start-script: {{ .Values.st2workflowengine.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -886,7 +894,9 @@ spec:
labels: {{- include "stackstorm-ha.labels" (list $ "st2scheduler") | nindent 8 }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2scheduler.postStartScript }}
checksum/post-start-script: {{ .Values.st2scheduler.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -1137,7 +1147,9 @@ spec:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }}
checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }}
{{- if and (ne "disable" (default "" $.Values.st2.datastore_crypto_key)) (not $.Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") $ | sha256sum }}
{{- end }}
{{- if $.Values.st2sensorcontainer.postStartScript }}
checksum/post-start-script: {{ $.Values.st2sensorcontainer.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -1188,7 +1200,7 @@ spec:
- name: {{ $name }}
image: '{{ template "stackstorm-ha.imageRepository" $ }}/st2sensorcontainer:{{ tpl ($sensor.image.tag | default $.Values.image.tag) $ }}'
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with default $.Values.securityContext $sensor.securityContext }}
{{- with $sensor.securityContext | default $.Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
{{- with $sensor.readinessProbe }}
Expand Down Expand Up @@ -1283,7 +1295,7 @@ spec:
{{- with $.Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with default $.Values.podSecurityContext $sensor.podSecurityContext }}
{{- with $sensor.podSecurityContext | default $.Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with $sensor.nodeSelector }}
Expand Down Expand Up @@ -1319,7 +1331,9 @@ spec:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2actionrunner.postStartScript }}
checksum/post-start-script: {{ .Values.st2actionrunner.postStartScript | sha256sum }}
{{- end }}
Expand Down Expand Up @@ -1354,7 +1368,7 @@ spec:
image: '{{ .image.repository | default (include "stackstorm-ha.imageRepository" $) }}/{{ .image.name | default "st2actionrunner" }}:{{ tpl (.image.tag | default $.Values.image.tag) $ }}'
{{- end }}
imagePullPolicy: {{ .Values.st2actionrunner.image.pullPolicy | default .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2actionrunner.securityContext }}
{{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
# TODO: Add liveness/readiness probes (#3)
Expand Down Expand Up @@ -1437,7 +1451,7 @@ spec:
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with default .Values.podSecurityContext .Values.st2actionrunner.podSecurityContext }}
{{- with .Values.st2actionrunner.podSecurityContext | default .Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2actionrunner.nodeSelector }}
Expand Down Expand Up @@ -1573,9 +1587,13 @@ spec:
checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }}
checksum/rbac: {{ include (print $.Template.BasePath "/configmaps_rbac.yaml") . | sha256sum }}
checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }}
{{- if not .Values.st2.existingAuthSecret }}
checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }}
{{- end }}
checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }}
{{- if and (ne "disable" (default "" .Values.st2.datastore_crypto_key)) (not .Values.st2.existingDatastoreSecret) }}
checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.st2.overrides }}
checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }}
{{- end }}
Expand All @@ -1601,7 +1619,7 @@ spec:
- name: generate-st2client-config
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default (.Values.st2actionrunner.image.tag | default .Values.image.tag)) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
{{- with .Values.st2client.securityContext | default .Values.st2actionrunner.securityContext | default .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
Expand All @@ -1628,7 +1646,7 @@ spec:
- name: st2client
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.st2client.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with default .Values.securityContext .Values.st2actionrunner.securityContext }}
{{- with .Values.st2client.securityContext | default .Values.st2actionrunner.securityContext | default .Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
env:
Expand Down Expand Up @@ -1729,7 +1747,7 @@ spec:
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with default .Values.podSecurityContext .Values.st2client.podSecurityContext }}
{{- with .Values.st2client.podSecurityContext | default .Values.st2actionrunner.podSecurityContext | default .Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.st2client.nodeSelector }}
Expand Down
18 changes: 11 additions & 7 deletions templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ spec:
- name: st2-register-content-custom-init
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.jobs.image.tag | default (.Values.st2actionrunner.image.tag | default .Values.image.tag)) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
{{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
command: {{- toYaml $.Values.jobs.preRegisterContentCommand | nindent 8 }}
Expand All @@ -426,7 +427,8 @@ spec:
- name: st2-register-content
image: '{{ template "stackstorm-ha.imageRepository" . }}/st2actionrunner:{{ tpl (.Values.jobs.image.tag | default (.Values.st2actionrunner.image.tag | default .Values.image.tag)) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.securityContext }}
{{- with .Values.st2actionrunner.securityContext | default .Values.securityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
command:
Expand Down Expand Up @@ -471,7 +473,8 @@ spec:
{{- with .Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podSecurityContext }}
{{- with .Values.st2actionrunner.podSecurityContext | default .Values.podSecurityContext }}
{{/* st2actionrunner is likely the most permissive so use that if defined. */}}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
Expand Down Expand Up @@ -541,7 +544,7 @@ spec:
and then delete this st2canary pod manually.
INTRO
function __handle_error__(){
function __handle_error__ {
cat <<- 'FAIL'
ERROR: One or more volumes in st2.packs.volumes (from helm values) does not meet
StackStorm's shared volumes requirements!
Expand Down Expand Up @@ -578,6 +581,7 @@ spec:
{{- toYaml $.Values.st2.packs.volumes.configs | nindent 10 }}
{{- end }}
# st2canary job does not support extra_volumes. Let us know if you need this.
restartPolicy: Never
{{- if $.Values.dnsPolicy }}
dnsPolicy: {{ $.Values.dnsPolicy }}
{{- end }}
Expand Down Expand Up @@ -641,7 +645,7 @@ spec:
- name: generate-st2client-config
image: '{{ template "stackstorm-ha.imageRepository" $ }}/st2actionrunner:{{ tpl ($.Values.jobs.image.tag | default ($.Values.st2actionrunner.image.tag | default $.Values.image.tag)) $ }}'
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with $.Values.securityContext }}
{{- with $.Values.st2actionrunner.securityContext | default $.Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
envFrom:
Expand All @@ -668,7 +672,7 @@ spec:
- name: {{ $name }}
image: '{{ template "stackstorm-ha.imageRepository" $ }}/st2actionrunner:{{ tpl ($.Values.jobs.image.tag | default ($.Values.st2actionrunner.image.tag | default $.Values.image.tag)) $ }}'
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- with $.Values.securityContext }}
{{- with .securityContext | default $.Values.st2actionrunner.securityContext | default $.Values.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
{{- if $.Values.jobs.env }}
Expand Down Expand Up @@ -718,7 +722,7 @@ spec:
{{- with $.Values.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.podSecurityContext }}
{{- with .podSecurityContext | default $.Values.st2actionrunner.podSecurityContext | default $.Values.podSecurityContext }}
securityContext: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.jobs.nodeSelector }}
Expand Down
Loading

0 comments on commit fabbea9

Please sign in to comment.