From 9447f94aab050861e30abe909980f887f0d7dfcc Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Thu, 12 May 2022 17:28:36 -0500 Subject: [PATCH 01/50] Adding override config --- templates/configmaps_overrides.yaml | 16 ++++++++++++++++ templates/deployments.yaml | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 templates/configmaps_overrides.yaml diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml new file mode 100644 index 00000000..a83dca21 --- /dev/null +++ b/templates/configmaps_overrides.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-st2-override-configs + annotations: + description: StackStorm pack configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/configs/overrides' + labels: + app: st2 + tier: backend + vendor: stackstorm + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: +{{ toYaml .Values.st2.override.configs | indent 2 }} \ No newline at end of file diff --git a/templates/deployments.yaml b/templates/deployments.yaml index fa5467b0..3735971d 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1700,6 +1700,7 @@ spec: checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }} checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }} checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }} + checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- if .Values.st2client.postStartScript }} checksum/post-start-script: {{ .Values.st2client.postStartScript | sha256sum }} {{- end }} @@ -1765,6 +1766,8 @@ spec: {{- end }} volumeMounts: {{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }} + - name: st2-overrides-vol + mountPath: /opt/stackstorm/config/overrides/ {{- if .Values.st2.rbac.enabled }} - name: st2-rbac-roles-vol mountPath: /opt/stackstorm/rbac/roles/ @@ -1813,6 +1816,9 @@ spec: path: datastore_key.json {{- end }} {{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }} + - name: st2-overrides-vol + configMap: + name: {{ .Release.Name }}-st2-override-configs {{- if .Values.st2.rbac.enabled }} - name: st2-rbac-roles-vol configMap: From 0a361d2f30fdb813d5b0288924cc02f1483bba68 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 11:35:53 -0500 Subject: [PATCH 02/50] Changing path --- templates/configmaps_overrides.yaml | 2 +- templates/deployments.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index a83dca21..de4adee2 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -4,7 +4,7 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-st2-override-configs annotations: - description: StackStorm pack configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/configs/overrides' + description: StackStorm override configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/overrides' labels: app: st2 tier: backend diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 3735971d..481557e7 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1767,7 +1767,7 @@ spec: volumeMounts: {{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }} - name: st2-overrides-vol - mountPath: /opt/stackstorm/config/overrides/ + mountPath: /opt/stackstorm/overrides/ {{- if .Values.st2.rbac.enabled }} - name: st2-rbac-roles-vol mountPath: /opt/stackstorm/rbac/roles/ From e936cadd4ae63d7d20b427d46912ee60020624dd Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 17:15:40 -0500 Subject: [PATCH 03/50] Updating with working version of overrides --- templates/_helpers.tpl | 17 +++++++++++++++++ templates/configmaps_overrides.yaml | 4 +++- templates/deployments.yaml | 11 +++++++++-- templates/jobs.yaml | 3 +++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 97bc6e67..587de05b 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -210,6 +210,23 @@ define this here as well to simplify comparison with packs-volume-mounts {{- end }} {{- end -}} +#Inserted for override ability to happen via helm charts + +{{- define "stackstorm-ha.override-config-mounts" -}} + {{- if .Values.st2.override.enabled }} +- name: st2-overrides-vol + mountPath: /opt/stackstorm/overrides/ + {{- end }} +{{- end -}} + +{{- define "stackstorm-ha.override-configs" -}} + {{- if .Values.st2.override.enabled }} +- name: st2-overrides-vol + configMap: + name: {{ .Release.Name }}-st2-override-configs + {{- end }} +{{- end -}} + {{/* For custom st2packs-initContainers reduce duplicity by defining them here once Merge packs and virtualenvs from st2 with those from st2packs images diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index de4adee2..9e4de8e3 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -1,3 +1,4 @@ +{{- if .Values.st2.override.enabled }} --- apiVersion: v1 kind: ConfigMap @@ -13,4 +14,5 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: -{{ toYaml .Values.st2.override.configs | indent 2 }} \ No newline at end of file +{{ toYaml .Values.st2.override.configs | indent 2 }} +{{- end }} \ No newline at end of file diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 481557e7..552533b9 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1766,8 +1766,6 @@ spec: {{- end }} volumeMounts: {{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }} - - name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ {{- if .Values.st2.rbac.enabled }} - name: st2-rbac-roles-vol mountPath: /opt/stackstorm/rbac/roles/ @@ -1776,6 +1774,10 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} + {{- if .Values.st2.override.enabled }} + - name: st2-overrides-vol + mountPath: /opt/stackstorm/overrides/ + {{- end }} - name: st2client-config-vol mountPath: /root/.st2/ - name: st2-ssh-key-vol @@ -1830,6 +1832,11 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} + {{- if .Values.st2.override.enabled }} + - name: st2-overrides-vol + configMap: + name: {{ .Release.Name }}-st2-override-configs + {{- end }} - name: st2client-config-vol emptyDir: medium: Memory diff --git a/templates/jobs.yaml b/templates/jobs.yaml index cd06e961..18b43cc4 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -416,6 +416,7 @@ spec: # TODO: Investigate/propose running Helm hook only on condition when ConfigMap or Secret has changed checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }} + checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- if .Values.jobs.annotations }} {{- toYaml .Values.jobs.annotations | nindent 8 }} {{- end }} @@ -474,12 +475,14 @@ spec: {{- end }} {{- end }} volumeMounts: + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" . | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" . | nindent 8 }} # TODO: Find out default resource limits for this specific service (#5) #resources: volumes: + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" . | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" . | nindent 8 }} From 1d1d68c6359fdb0d3beb7abb9482b57108fab90e Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 17:19:38 -0500 Subject: [PATCH 04/50] Adding to values --- values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/values.yaml b/values.yaml index bd530d3e..c721a7d7 100644 --- a/values.yaml +++ b/values.yaml @@ -82,6 +82,8 @@ st2: # for details on how to build this image. # To change this default, and use persistent/shared/writable storage that is available in your cluster, you need to # enable st2.packs.volumes below, adding volume definitions customized for use your cluster's storage provider. + override: + enabled: true packs: # Custom StackStorm pack configs. Each record creates a file in '/opt/stackstorm/configs/' # https://docs.stackstorm.com/reference/pack_configs.html#configuration-file From ae5a170f901e350995fc9b40d9747efefb7166b7 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 17:37:32 -0500 Subject: [PATCH 05/50] Removing duplicate entry --- templates/deployments.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 552533b9..d512784e 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1818,9 +1818,6 @@ spec: path: datastore_key.json {{- end }} {{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }} - - name: st2-overrides-vol - configMap: - name: {{ .Release.Name }}-st2-override-configs {{- if .Values.st2.rbac.enabled }} - name: st2-rbac-roles-vol configMap: From 8a63c4df40b607d862184fb0b64ea60fa48d7d8c Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 20:16:47 -0500 Subject: [PATCH 06/50] Testing what needs to be done with unit tests --- tests/unit/security_context_test.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/security_context_test.yaml b/tests/unit/security_context_test.yaml index c61fbcf3..d502372b 100644 --- a/tests/unit/security_context_test.yaml +++ b/tests/unit/security_context_test.yaml @@ -6,6 +6,7 @@ templates: - jobs.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml @@ -38,6 +39,7 @@ tests: st2chatops: enabled: true st2: + override: { enabled: true } # enable override jobs packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -80,6 +82,7 @@ tests: st2chatops: enabled: true st2: + override: { enabled: true } # enable overrides packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -113,6 +116,7 @@ tests: template: deployments.yaml set: st2: + override: { enabled: true } # enable overrides packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job From 8812a54f6cc8937bc8fc40981bfcca36efbf93e5 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 20:25:54 -0500 Subject: [PATCH 07/50] Adding the configmap for overrides to all unit tests that will need it --- tests/unit/custom_annotations_test.yaml | 1 + tests/unit/dns_test.yaml | 1 + tests/unit/env_test.yaml | 1 + tests/unit/image_pull_test.yaml | 1 + tests/unit/labels_test.yaml | 1 + tests/unit/packs_volumes_test.yaml | 1 + tests/unit/placement_test.yaml | 1 + tests/unit/post_start_script_test.yaml | 1 + tests/unit/resources_test.yaml | 1 + tests/unit/service_account_test.yaml | 1 + tests/unit/st2sensors_test.yaml | 1 + 11 files changed, 11 insertions(+) diff --git a/tests/unit/custom_annotations_test.yaml b/tests/unit/custom_annotations_test.yaml index 7a7ed9b7..87c4d3f5 100644 --- a/tests/unit/custom_annotations_test.yaml +++ b/tests/unit/custom_annotations_test.yaml @@ -9,6 +9,7 @@ templates: - services.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/dns_test.yaml b/tests/unit/dns_test.yaml index b4d1c1bb..733f1338 100644 --- a/tests/unit/dns_test.yaml +++ b/tests/unit/dns_test.yaml @@ -6,6 +6,7 @@ templates: - jobs.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/env_test.yaml b/tests/unit/env_test.yaml index 4bd42f2b..9cc7badf 100644 --- a/tests/unit/env_test.yaml +++ b/tests/unit/env_test.yaml @@ -6,6 +6,7 @@ templates: - jobs.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/image_pull_test.yaml b/tests/unit/image_pull_test.yaml index 6a0ef3ac..ce59058d 100644 --- a/tests/unit/image_pull_test.yaml +++ b/tests/unit/image_pull_test.yaml @@ -7,6 +7,7 @@ templates: - service-account.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/labels_test.yaml b/tests/unit/labels_test.yaml index 09f1dd7d..6457acf2 100644 --- a/tests/unit/labels_test.yaml +++ b/tests/unit/labels_test.yaml @@ -5,6 +5,7 @@ templates: - jobs.yaml - services.yaml + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_post-start-scripts.yaml - configmaps_rbac.yaml diff --git a/tests/unit/packs_volumes_test.yaml b/tests/unit/packs_volumes_test.yaml index abaec6f2..268a2190 100644 --- a/tests/unit/packs_volumes_test.yaml +++ b/tests/unit/packs_volumes_test.yaml @@ -6,6 +6,7 @@ templates: - jobs.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/placement_test.yaml b/tests/unit/placement_test.yaml index 8f583481..483c09b8 100644 --- a/tests/unit/placement_test.yaml +++ b/tests/unit/placement_test.yaml @@ -6,6 +6,7 @@ templates: - jobs.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/post_start_script_test.yaml b/tests/unit/post_start_script_test.yaml index 366cdc6d..d3856b06 100644 --- a/tests/unit/post_start_script_test.yaml +++ b/tests/unit/post_start_script_test.yaml @@ -6,6 +6,7 @@ templates: - configmaps_post-start-script.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/resources_test.yaml b/tests/unit/resources_test.yaml index 35849882..698897a7 100644 --- a/tests/unit/resources_test.yaml +++ b/tests/unit/resources_test.yaml @@ -7,6 +7,7 @@ templates: # No jobs resources yet # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/service_account_test.yaml b/tests/unit/service_account_test.yaml index 3c0e7ebc..52bc261b 100644 --- a/tests/unit/service_account_test.yaml +++ b/tests/unit/service_account_test.yaml @@ -8,6 +8,7 @@ templates: # ServiceAccount doesn't attach to Jobs # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml diff --git a/tests/unit/st2sensors_test.yaml b/tests/unit/st2sensors_test.yaml index a6b68680..adcd8eee 100644 --- a/tests/unit/st2sensors_test.yaml +++ b/tests/unit/st2sensors_test.yaml @@ -5,6 +5,7 @@ templates: - deployments.yaml # included templates must also be listed + - configmaps_overrides.yaml - configmaps_packs.yaml - configmaps_rbac.yaml - configmaps_st2-conf.yaml From 5282abb072c2cce0a662db0217428f1a5b3668e0 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 20:34:10 -0500 Subject: [PATCH 08/50] Removing some of the bits from my original testing --- tests/unit/security_context_test.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unit/security_context_test.yaml b/tests/unit/security_context_test.yaml index d502372b..4462d624 100644 --- a/tests/unit/security_context_test.yaml +++ b/tests/unit/security_context_test.yaml @@ -39,7 +39,6 @@ tests: st2chatops: enabled: true st2: - override: { enabled: true } # enable override jobs packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -82,7 +81,6 @@ tests: st2chatops: enabled: true st2: - override: { enabled: true } # enable overrides packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -116,7 +114,6 @@ tests: template: deployments.yaml set: st2: - override: { enabled: true } # enable overrides packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job From 553bdc6db5083fd66c3116969745eaacbff86e83 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 21:06:50 -0500 Subject: [PATCH 09/50] Adding link to documentation to values file and giving crude example commented out --- values.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/values.yaml b/values.yaml index c721a7d7..cdf339f8 100644 --- a/values.yaml +++ b/values.yaml @@ -74,6 +74,18 @@ st2: user: stanley # templating is allowed for this key ssh_key_file: "/home/{{ .Values.st2.system_user.user }}/.ssh/stanley_rsa" + + # Override definition settings. Eache record creates a file in `/opt/stackstorm/overrides` + # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults + override: + enabled: false + # Note: This needs to be set to enabled for the directory to be made. + #configs: + # _global.yaml: | + # --- + # rules: + # defaults: + # enabled: false # Custom pack configs and image settings. # @@ -82,8 +94,6 @@ st2: # for details on how to build this image. # To change this default, and use persistent/shared/writable storage that is available in your cluster, you need to # enable st2.packs.volumes below, adding volume definitions customized for use your cluster's storage provider. - override: - enabled: true packs: # Custom StackStorm pack configs. Each record creates a file in '/opt/stackstorm/configs/' # https://docs.stackstorm.com/reference/pack_configs.html#configuration-file @@ -92,7 +102,7 @@ st2: core.yaml: | --- # example core pack config yaml - + # # Custom packs images settings. # # For each given st2packs container you can define repository, name, tag and pullPolicy for this image below. @@ -115,8 +125,6 @@ st2: # To use this, set enabled to true, and add cluster-specific volume definitions for at least packs and virtualenvs below. # Please consult the documentation for your cluster's storage solution. # Some generic examples are listed under st2.packs.volumes.packs below. - volumes: - enabled: false packs: {} # mounted to /opt/stackstorm/packs From 8f68ab1d394651e02e54c26e12d1e61a136a7df9 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 21:30:17 -0500 Subject: [PATCH 10/50] Trying to fix values so it is valid --- values.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/values.yaml b/values.yaml index cdf339f8..48d69a3e 100644 --- a/values.yaml +++ b/values.yaml @@ -77,15 +77,14 @@ st2: # Override definition settings. Eache record creates a file in `/opt/stackstorm/overrides` # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults + #configs: + # _global.yaml: | + # --- + # rules: + # defaults: + # enabled: false # This will disable all rules globally. override: - enabled: false - # Note: This needs to be set to enabled for the directory to be made. - #configs: - # _global.yaml: | - # --- - # rules: - # defaults: - # enabled: false + enabled: true # Custom pack configs and image settings. # From 6633a4c870b36e6ab981074b0f58a63e08087222 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 21:34:38 -0500 Subject: [PATCH 11/50] Fixing values to just link to document for overrides and putting just the override node in --- values.yaml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/values.yaml b/values.yaml index 48d69a3e..01b8fb96 100644 --- a/values.yaml +++ b/values.yaml @@ -67,24 +67,16 @@ st2: config: | [api] allow_origin = '*' - + + #Override Definitions can be added here. + # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults + override: # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. # If you change the user, you must provide a customized st2actionrunner image that includes your user. system_user: user: stanley # templating is allowed for this key ssh_key_file: "/home/{{ .Values.st2.system_user.user }}/.ssh/stanley_rsa" - - # Override definition settings. Eache record creates a file in `/opt/stackstorm/overrides` - # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults - #configs: - # _global.yaml: | - # --- - # rules: - # defaults: - # enabled: false # This will disable all rules globally. - override: - enabled: true # Custom pack configs and image settings. # @@ -101,7 +93,7 @@ st2: core.yaml: | --- # example core pack config yaml - # + # Custom packs images settings. # # For each given st2packs container you can define repository, name, tag and pullPolicy for this image below. @@ -124,6 +116,8 @@ st2: # To use this, set enabled to true, and add cluster-specific volume definitions for at least packs and virtualenvs below. # Please consult the documentation for your cluster's storage solution. # Some generic examples are listed under st2.packs.volumes.packs below. + volumes: + enabled: false packs: {} # mounted to /opt/stackstorm/packs @@ -1082,4 +1076,4 @@ external-dns: provider: aws aws: zoneType: "public" - domainFilters: [] + domainFilters: [] \ No newline at end of file From 6d9a6e25166b3ee0a20b0e3a77042b42ce2a713e Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Fri, 13 May 2022 21:36:36 -0500 Subject: [PATCH 12/50] Setting to disabled --- values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/values.yaml b/values.yaml index 01b8fb96..5626d594 100644 --- a/values.yaml +++ b/values.yaml @@ -71,6 +71,7 @@ st2: #Override Definitions can be added here. # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults override: + enabled: false # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. # If you change the user, you must provide a customized st2actionrunner image that includes your user. system_user: From 0bc0a6633493bbab153442847fea89ab4181c14e Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 12:33:48 -0500 Subject: [PATCH 13/50] Adding commented example, override to overrides and new lines --- templates/configmaps_overrides.yaml | 6 +++--- values.yaml | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index 9e4de8e3..cbfa4f08 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -1,4 +1,4 @@ -{{- if .Values.st2.override.enabled }} +{{- if .Values.st2.overrides.enabled }} --- apiVersion: v1 kind: ConfigMap @@ -14,5 +14,5 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: -{{ toYaml .Values.st2.override.configs | indent 2 }} -{{- end }} \ No newline at end of file +{{ toYaml .Values.st2.overrides.configs | indent 2 }} +{{- end }} diff --git a/values.yaml b/values.yaml index 5626d594..bab9e6e4 100644 --- a/values.yaml +++ b/values.yaml @@ -69,8 +69,21 @@ st2: allow_origin = '*' #Override Definitions can be added here. + # overrides: + # enabled: true + # configs: + # _global.yaml: | + # --- + # rules: + # defaults: + # enabled: true + # packA.yaml: | + # --- + # rules: + # rule.name: + # enabled: false # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults - override: + overrides: enabled: false # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. # If you change the user, you must provide a customized st2actionrunner image that includes your user. @@ -1077,4 +1090,5 @@ external-dns: provider: aws aws: zoneType: "public" - domainFilters: [] \ No newline at end of file + domainFilters: [] + \ No newline at end of file From 95ccd40e69a66b7c5a2a541a7a001e30ad9ca8ab Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 12:47:02 -0500 Subject: [PATCH 14/50] Override to overrides in a few more places. --- templates/_helpers.tpl | 4 ++-- templates/deployments.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 587de05b..b563fd98 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -213,14 +213,14 @@ define this here as well to simplify comparison with packs-volume-mounts #Inserted for override ability to happen via helm charts {{- define "stackstorm-ha.override-config-mounts" -}} - {{- if .Values.st2.override.enabled }} + {{- if .Values.st2.overrides.enabled }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} {{- end -}} {{- define "stackstorm-ha.override-configs" -}} - {{- if .Values.st2.override.enabled }} + {{- if .Values.st2.overrides.enabled }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs diff --git a/templates/deployments.yaml b/templates/deployments.yaml index d512784e..614660b6 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1774,7 +1774,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- if .Values.st2.override.enabled }} + {{- if .Values.st2.overrides.enabled }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} @@ -1829,7 +1829,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- if .Values.st2.override.enabled }} + {{- if .Values.st2.overrides.enabled }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs From 35f7955925d91a87b9222dfb07e58619c25756de Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 15:30:17 -0500 Subject: [PATCH 15/50] Changing so there is no enabled switch, if .Values.overrides.configs exists it enables --- templates/_helpers.tpl | 4 ++-- templates/configmaps_overrides.yaml | 2 +- templates/deployments.yaml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index b563fd98..f960372e 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -213,14 +213,14 @@ define this here as well to simplify comparison with packs-volume-mounts #Inserted for override ability to happen via helm charts {{- define "stackstorm-ha.override-config-mounts" -}} - {{- if .Values.st2.overrides.enabled }} + {{- if .Values.st2.overrides.configs }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} {{- end -}} {{- define "stackstorm-ha.override-configs" -}} - {{- if .Values.st2.overrides.enabled }} + {{- if .Values.st2.overrides.configs }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index cbfa4f08..3269c46d 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -1,4 +1,4 @@ -{{- if .Values.st2.overrides.enabled }} +{{- if .Values.st2.overrides.configs }} --- apiVersion: v1 kind: ConfigMap diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 614660b6..442a40c7 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1774,7 +1774,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- if .Values.st2.overrides.enabled }} + {{- if .Values.st2.overrides.configs }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} @@ -1829,7 +1829,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- if .Values.st2.overrides.enabled }} + {{- if .Values.st2.overrides.configs }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs From 3e87f0e2fbf1c24a94c68f0b030e71721e1264e7 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 21:13:27 -0500 Subject: [PATCH 16/50] Removing theh "configs" layer in helm chart so it is just the "overrides" array --- templates/configmaps_overrides.yaml | 4 ++-- templates/deployments.yaml | 4 ++-- values.yaml | 6 +----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index 3269c46d..2e67c8ab 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -1,4 +1,4 @@ -{{- if .Values.st2.overrides.configs }} +{{- if .Values.st2.overrides }} --- apiVersion: v1 kind: ConfigMap @@ -14,5 +14,5 @@ metadata: release: {{ .Release.Name }} heritage: {{ .Release.Service }} data: -{{ toYaml .Values.st2.overrides.configs | indent 2 }} +{{ toYaml .Values.st2.overrides | indent 2 }} {{- end }} diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 442a40c7..3dfaa965 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1774,7 +1774,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} @@ -1829,7 +1829,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs diff --git a/values.yaml b/values.yaml index bab9e6e4..3e93ae88 100644 --- a/values.yaml +++ b/values.yaml @@ -70,8 +70,6 @@ st2: #Override Definitions can be added here. # overrides: - # enabled: true - # configs: # _global.yaml: | # --- # rules: @@ -83,8 +81,7 @@ st2: # rule.name: # enabled: false # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults - overrides: - enabled: false + overrides: {} # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. # If you change the user, you must provide a customized st2actionrunner image that includes your user. system_user: @@ -1091,4 +1088,3 @@ external-dns: aws: zoneType: "public" domainFilters: [] - \ No newline at end of file From 78245862b223e7023e11cbe08bdda36a90e9e382 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 22:47:37 -0500 Subject: [PATCH 17/50] Update templates/_helpers.tpl Co-authored-by: Jacob Floyd --- templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index f960372e..69114446 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -220,7 +220,7 @@ define this here as well to simplify comparison with packs-volume-mounts {{- end -}} {{- define "stackstorm-ha.override-configs" -}} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs From 4d34bfef4931fb0a21094213a4c4426ab3a1b827 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 22:47:56 -0500 Subject: [PATCH 18/50] Update values.yaml Co-authored-by: Jacob Floyd --- values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/values.yaml b/values.yaml index 3e93ae88..b20fb478 100644 --- a/values.yaml +++ b/values.yaml @@ -76,10 +76,10 @@ st2: # defaults: # enabled: true # packA.yaml: | - # --- - # rules: - # rule.name: - # enabled: false + # --- + # rules: + # rule.name: + # enabled: false # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults overrides: {} # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. From 01f6f7ff28a244d055640b80b6d6717be6c9adc5 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Sat, 14 May 2022 22:48:04 -0500 Subject: [PATCH 19/50] Update templates/_helpers.tpl Co-authored-by: Jacob Floyd --- templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 69114446..3345f5ee 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -213,7 +213,7 @@ define this here as well to simplify comparison with packs-volume-mounts #Inserted for override ability to happen via helm charts {{- define "stackstorm-ha.override-config-mounts" -}} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} From c95c13b4c60582ff498da7ba18bff37f2f5a6bb4 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 12:32:55 -0500 Subject: [PATCH 20/50] Using helper templates everywhere and adding if overrides for checksums --- templates/deployments.yaml | 9 ++++----- templates/jobs.yaml | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 3dfaa965..bb88bd48 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1700,7 +1700,9 @@ spec: checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }} checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }} checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }} + {{- if .Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if .Values.st2client.postStartScript }} checksum/post-start-script: {{ .Values.st2client.postStartScript | sha256sum }} {{- end }} @@ -1775,8 +1777,7 @@ spec: mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} {{- if .Values.st2.overrides }} - - name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} {{- end }} - name: st2client-config-vol mountPath: /root/.st2/ @@ -1830,9 +1831,7 @@ spec: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} {{- if .Values.st2.overrides }} - - name: st2-overrides-vol - configMap: - name: {{ .Release.Name }}-st2-override-configs + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} {{- end }} - name: st2client-config-vol emptyDir: diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 18b43cc4..e21e4950 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -416,7 +416,9 @@ spec: # TODO: Investigate/propose running Helm hook only on condition when ConfigMap or Secret has changed checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }} + {{- if .Values.jobs.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if .Values.jobs.annotations }} {{- toYaml .Values.jobs.annotations | nindent 8 }} {{- end }} @@ -543,6 +545,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 .Values.st2.overrides }} + checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if $.Values.jobs.annotations }} {{- toYaml $.Values.jobs.annotations | nindent 8 }} {{- end }} @@ -608,6 +613,7 @@ spec: volumeMounts: - name: st2client-config-vol mountPath: /root/.st2/ + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }} @@ -618,6 +624,7 @@ spec: - name: st2client-config-vol emptyDir: medium: Memory + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }} From cc9e28b8ca0e1c33292569e4a7e66d2ac9695081 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 13:34:27 -0500 Subject: [PATCH 21/50] Fixing helper template and adjusting deployments.yaml --- templates/_helpers.tpl | 4 ++-- templates/deployments.yaml | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index f960372e..3345f5ee 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -213,14 +213,14 @@ define this here as well to simplify comparison with packs-volume-mounts #Inserted for override ability to happen via helm charts {{- define "stackstorm-ha.override-config-mounts" -}} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} {{- end -}} {{- define "stackstorm-ha.override-configs" -}} - {{- if .Values.st2.overrides.configs }} + {{- if .Values.st2.overrides }} - name: st2-overrides-vol configMap: name: {{ .Release.Name }}-st2-override-configs diff --git a/templates/deployments.yaml b/templates/deployments.yaml index bb88bd48..51c92e49 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1776,9 +1776,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- if .Values.st2.overrides }} - {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} - {{- end }} + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} - name: st2client-config-vol mountPath: /root/.st2/ - name: st2-ssh-key-vol @@ -1830,9 +1828,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- if .Values.st2.overrides }} - {{- include "stackstorm-ha.override-configs" . | nindent 8 }} - {{- end }} + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} - name: st2client-config-vol emptyDir: medium: Memory From 5fff67a2a26c7ddb97123b54e498ce3a48acb0e2 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 12:32:55 -0500 Subject: [PATCH 22/50] Using helper templates everywhere and adding if overrides for checksums --- templates/deployments.yaml | 9 ++++----- templates/jobs.yaml | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 3dfaa965..bb88bd48 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1700,7 +1700,9 @@ spec: checksum/auth: {{ include (print $.Template.BasePath "/secrets_st2auth.yaml") . | sha256sum }} checksum/ssh: {{ include (print $.Template.BasePath "/secrets_ssh.yaml") . | sha256sum }} checksum/datastore-key: {{ include (print $.Template.BasePath "/secrets_datastore_crypto_key.yaml") . | sha256sum }} + {{- if .Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if .Values.st2client.postStartScript }} checksum/post-start-script: {{ .Values.st2client.postStartScript | sha256sum }} {{- end }} @@ -1775,8 +1777,7 @@ spec: mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} {{- if .Values.st2.overrides }} - - name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} {{- end }} - name: st2client-config-vol mountPath: /root/.st2/ @@ -1830,9 +1831,7 @@ spec: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} {{- if .Values.st2.overrides }} - - name: st2-overrides-vol - configMap: - name: {{ .Release.Name }}-st2-override-configs + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} {{- end }} - name: st2client-config-vol emptyDir: diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 18b43cc4..e21e4950 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -416,7 +416,9 @@ spec: # TODO: Investigate/propose running Helm hook only on condition when ConfigMap or Secret has changed checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }} + {{- if .Values.jobs.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if .Values.jobs.annotations }} {{- toYaml .Values.jobs.annotations | nindent 8 }} {{- end }} @@ -543,6 +545,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 .Values.st2.overrides }} + checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + {{- end }} {{- if $.Values.jobs.annotations }} {{- toYaml $.Values.jobs.annotations | nindent 8 }} {{- end }} @@ -608,6 +613,7 @@ spec: volumeMounts: - name: st2client-config-vol mountPath: /root/.st2/ + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }} @@ -618,6 +624,7 @@ spec: - name: st2client-config-vol emptyDir: medium: Memory + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }} From 154c87a611a49afe25359a2052c9b01ea51ad38a Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 13:34:27 -0500 Subject: [PATCH 23/50] Fixing helper template and adjusting deployments.yaml --- templates/deployments.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index bb88bd48..51c92e49 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1776,9 +1776,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- if .Values.st2.overrides }} - {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} - {{- end }} + {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} - name: st2client-config-vol mountPath: /root/.st2/ - name: st2-ssh-key-vol @@ -1830,9 +1828,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- if .Values.st2.overrides }} - {{- include "stackstorm-ha.override-configs" . | nindent 8 }} - {{- end }} + {{- include "stackstorm-ha.override-configs" . | nindent 8 }} - name: st2client-config-vol emptyDir: medium: Memory From 6f8aa75ab02030d340e992e9058f7cbb31d13e76 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 14:08:27 -0500 Subject: [PATCH 24/50] TEsting test --- tests/unit/dns_test.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/dns_test.yaml b/tests/unit/dns_test.yaml index 733f1338..1d00c9d4 100644 --- a/tests/unit/dns_test.yaml +++ b/tests/unit/dns_test.yaml @@ -24,7 +24,8 @@ tests: - deployments.yaml - jobs.yaml set: - st2: + st2: + overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -55,7 +56,8 @@ tests: - name: ndots value: "2" - name: edns0 - st2: + st2: + overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: From 32c27c07dca909702cecee15e014f31ab00675e3 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 14:14:33 -0500 Subject: [PATCH 25/50] Adjusting jobs.yaml --- templates/jobs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index e21e4950..cafad901 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -545,7 +545,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} - {{- if .Values.st2.overrides }} + {{- if $.Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} From d33d20214fe8b05c3307329c3390e24c50005435 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 15:22:51 -0500 Subject: [PATCH 26/50] Fixing if overrides blocks for checksums --- templates/jobs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index cafad901..9c1f27f2 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -416,7 +416,7 @@ spec: # TODO: Investigate/propose running Helm hook only on condition when ConfigMap or Secret has changed checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }} - {{- if .Values.jobs.overrides }} + {{- if .Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if .Values.jobs.annotations }} @@ -545,7 +545,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} - {{- if $.Values.st2.overrides }} + {{- if .Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} From f811e91db2bbb67a85f9041dadcb84cce85447b7 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Mon, 16 May 2022 15:27:36 -0500 Subject: [PATCH 27/50] Testing some changes --- templates/jobs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 9c1f27f2..de2b3e7d 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -545,7 +545,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} - {{- if .Values.st2.overrides }} + {{- if .Values.st2.overrides -}} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} From c704d1f7fe5764d2e586f74bff2f76d1df402c32 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 22:40:24 -0500 Subject: [PATCH 28/50] Adjusting --- tests/unit/dns_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/dns_test.yaml b/tests/unit/dns_test.yaml index 1d00c9d4..3df5934e 100644 --- a/tests/unit/dns_test.yaml +++ b/tests/unit/dns_test.yaml @@ -25,7 +25,7 @@ tests: - jobs.yaml set: st2: - overrides: {} + overrides: { } packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -57,7 +57,7 @@ tests: value: "2" - name: edns0 st2: - overrides: {} + overrides: { } packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: From e2e8c1b7852c9ebb25a6c9cce5df3a2d1eeaa7db Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 22:48:09 -0500 Subject: [PATCH 29/50] Changes again --- templates/jobs.yaml | 2 +- tests/unit/dns_test.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index de2b3e7d..9c1f27f2 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -545,7 +545,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} - {{- if .Values.st2.overrides -}} + {{- if .Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} diff --git a/tests/unit/dns_test.yaml b/tests/unit/dns_test.yaml index 3df5934e..1d00c9d4 100644 --- a/tests/unit/dns_test.yaml +++ b/tests/unit/dns_test.yaml @@ -25,7 +25,7 @@ tests: - jobs.yaml set: st2: - overrides: { } + overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -57,7 +57,7 @@ tests: value: "2" - name: edns0 st2: - overrides: { } + overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: From 8b626c910b70f5c7e4466a48a44d2fd78b085223 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 22:51:02 -0500 Subject: [PATCH 30/50] test --- templates/jobs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 9c1f27f2..7bc32e68 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -545,7 +545,7 @@ spec: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} - {{- if .Values.st2.overrides }} + {{- if $.Values.st2.overrides }} checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} From a69ba27dc2832b167fb13754e7dea83303e46878 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 22:52:59 -0500 Subject: [PATCH 31/50] no message --- templates/jobs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 7bc32e68..6b2c1a1d 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -613,7 +613,7 @@ spec: volumeMounts: - name: st2client-config-vol mountPath: /root/.st2/ - {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} + {{- include "stackstorm-ha.override-config-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }} @@ -624,7 +624,7 @@ spec: - name: st2client-config-vol emptyDir: medium: Memory - {{- include "stackstorm-ha.override-configs" . | nindent 8 }} + {{- include "stackstorm-ha.override-configs" $ | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }} From b612df98617d720438ffc9f81a182de73bc551db Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:32:11 -0500 Subject: [PATCH 32/50] Adding unit test for overrides --- tests/unit/overrides_test.yaml | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/unit/overrides_test.yaml diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml new file mode 100644 index 00000000..6ddfcfd1 --- /dev/null +++ b/tests/unit/overrides_test.yaml @@ -0,0 +1,85 @@ +--- +suite: Image Pull +templates: + # primary template files + - deployments.yaml + - jobs.yaml + - service-account.yaml + + # included templates must also be listed + - configmaps_overrides.yaml + - configmaps_packs.yaml + - configmaps_rbac.yaml + - configmaps_st2-conf.yaml + - configmaps_st2-urls.yaml + - configmaps_st2web.yaml + - secrets_datastore_crypto_key.yaml + - secrets_ssh.yaml + - secrets_st2apikeys.yaml + - secrets_st2auth.yaml + - secrets_st2chatops.yaml + +tests: + - it: Jobs without st2.packs.images or st2.packs.volumes + template: jobs.yaml + set: + st2: + overrides: #Enabling the override mounts in register-content job. + _global.yaml: | + --- + rules: + defaults: + enabled: false + rbac: { enabled: true } # enable rbac job + packs: + images: [] # no extra packs to load + volumes: + enabled: false + configs: {} # has one core.yaml config file by default (dicts get merged) + jobs: + extra_hooks: &extra_hooks_jobs + - name: upgrade-warning + hook: pre-upgrade, pre-rollback + hook_weight: -5 + command: ["st2", "run", "--tail", "custom_pack.warn_about_upgrade"] + release: + name: st2ha + asserts: + - hasDocuments: + count: 5 + + - contains: &override_vol + path: spec.template.spec.volumes + content: + name: st2-overrides-vol + <<: *override_volume + + - contains: &override_vol_mnt + path: spec.template.spec.containers[0].volumeMounts + content: + name: st2-overrides-vol + mountPath: /opt/stackstorm/overrides + <<: *override_mnt + + - notContains: *override_volume + - notContains: *override_mnt + + - contains: *override_mnt + documentIndex: 3 # register_content + - contains: *override_volume + documentIndex: 3 # register_content + + - notContains: *override_volume + documentIndex: 0 + - notContains: *override_mnt + documentIndex: 0 + + - notContains: *override_volume + documentIndex: 1 + - notContains: *override_mnt + documentIndex: 1 + + - notContains: *override_volume + documentIndex: 2 + - notContains: *override_mnt + documentIndex: 2 From 74c0a66b04f9dd0173326c45b4df997295cfa83e Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:33:43 -0500 Subject: [PATCH 33/50] Changing test --- tests/unit/overrides_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 6ddfcfd1..1cab0dfd 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -52,14 +52,14 @@ tests: path: spec.template.spec.volumes content: name: st2-overrides-vol - <<: *override_volume + <<: *override_vol - contains: &override_vol_mnt path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol mountPath: /opt/stackstorm/overrides - <<: *override_mnt + <<: *override_vol_mnt - notContains: *override_volume - notContains: *override_mnt From 02efdfc03e0ff71e535d9ff11204683844539f52 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:35:48 -0500 Subject: [PATCH 34/50] no message --- tests/unit/overrides_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 1cab0dfd..ada5cf55 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -54,7 +54,7 @@ tests: name: st2-overrides-vol <<: *override_vol - - contains: &override_vol_mnt + - contains: &override_vol_mnt path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol From 51571b5ac71646b2d398ef8cee4cc6b05715d5c3 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:37:36 -0500 Subject: [PATCH 35/50] no message --- tests/unit/overrides_test.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index ada5cf55..abbb322e 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -61,25 +61,25 @@ tests: mountPath: /opt/stackstorm/overrides <<: *override_vol_mnt - - notContains: *override_volume - - notContains: *override_mnt + - notContains: *override_vol + - notContains: *override_vol_mnt - - contains: *override_mnt + - contains: *override_vol_mnt documentIndex: 3 # register_content - - contains: *override_volume + - contains: *override_vol documentIndex: 3 # register_content - - notContains: *override_volume + - notContains: *override_vol documentIndex: 0 - - notContains: *override_mnt + - notContains: *override_vol_mnt documentIndex: 0 - - notContains: *override_volume + - notContains: *override_vol documentIndex: 1 - - notContains: *override_mnt + - notContains: *override_vol_mnt documentIndex: 1 - - notContains: *override_volume + - notContains: *override_vol documentIndex: 2 - - notContains: *override_mnt + - notContains: *override_vol_mnt documentIndex: 2 From 2df02f8a9e0ba03629a6b88ecf34f5efa88349a7 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:42:30 -0500 Subject: [PATCH 36/50] no message --- tests/unit/overrides_test.yaml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index abbb322e..3d665d1d 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -48,38 +48,31 @@ tests: - hasDocuments: count: 5 - - contains: &override_vol + - contains: &override_volume path: spec.template.spec.volumes content: name: st2-overrides-vol - <<: *override_vol + documentIndex: 3 # register_content + - - contains: &override_vol_mnt + - contains: &override_mnt path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol mountPath: /opt/stackstorm/overrides - <<: *override_vol_mnt - - - notContains: *override_vol - - notContains: *override_vol_mnt - - - contains: *override_vol_mnt - documentIndex: 3 # register_content - - contains: *override_vol documentIndex: 3 # register_content - - notContains: *override_vol + - notContains: *override_volume documentIndex: 0 - - notContains: *override_vol_mnt + - notContains: *override_mnt documentIndex: 0 - - notContains: *override_vol + - notContains: *override_volume documentIndex: 1 - - notContains: *override_vol_mnt + - notContains: *override_mnt documentIndex: 1 - - notContains: *override_vol + - notContains: *override_volume documentIndex: 2 - - notContains: *override_vol_mnt + - notContains: *override_mnt documentIndex: 2 From e0891258453e6403f4e6c99809fa812e3740fbcf Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:51:02 -0500 Subject: [PATCH 37/50] Adjusting override test and jobs.yaml --- templates/jobs.yaml | 2 +- tests/unit/overrides_test.yaml | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/templates/jobs.yaml b/templates/jobs.yaml index 6b2c1a1d..ee41cc93 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -546,7 +546,7 @@ spec: checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} {{- if $.Values.st2.overrides }} - checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") . | sha256sum }} + checksum/overrides: {{ include (print $.Template.BasePath "/configmaps_overrides.yaml") $ | sha256sum }} {{- end }} {{- if $.Values.jobs.annotations }} {{- toYaml $.Values.jobs.annotations | nindent 8 }} diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 3d665d1d..658ee5dc 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -1,5 +1,5 @@ --- -suite: Image Pull +suite: Override check templates: # primary template files - deployments.yaml @@ -20,7 +20,7 @@ templates: - secrets_st2chatops.yaml tests: - - it: Jobs without st2.packs.images or st2.packs.volumes + - it: Jobs with overrides mounted template: jobs.yaml set: st2: @@ -31,11 +31,7 @@ tests: defaults: enabled: false rbac: { enabled: true } # enable rbac job - packs: - images: [] # no extra packs to load - volumes: - enabled: false - configs: {} # has one core.yaml config file by default (dicts get merged) + packs: { sensors: [] } # ensure only 1 sensor jobs: extra_hooks: &extra_hooks_jobs - name: upgrade-warning From 10f28cda9f5e4acfe2970b08fc8b2a30051ae672 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Mon, 16 May 2022 23:59:11 -0500 Subject: [PATCH 38/50] Adjusting test for jobs --- tests/unit/overrides_test.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 658ee5dc..9698fe8c 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -48,6 +48,8 @@ tests: path: spec.template.spec.volumes content: name: st2-overrides-vol + configMap: + name: st2ha-st2-override-configs documentIndex: 3 # register_content @@ -55,7 +57,7 @@ tests: path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides + mountPath: /opt/stackstorm/overrides/ documentIndex: 3 # register_content - notContains: *override_volume @@ -72,3 +74,4 @@ tests: documentIndex: 2 - notContains: *override_mnt documentIndex: 2 + \ No newline at end of file From 0c5022be41bd8616aab42e3a49e27a3572b3deaa Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Tue, 17 May 2022 00:05:28 -0500 Subject: [PATCH 39/50] Adding deployment test --- tests/unit/overrides_test.yaml | 85 +++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 9698fe8c..362c78cd 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -74,4 +74,87 @@ tests: documentIndex: 2 - notContains: *override_mnt documentIndex: 2 - \ No newline at end of file + + - it: Deployments with overrides + template: deployments.yaml + set: + st2: + overrides: #Enabling the override mounts in register-content job. + _global.yaml: | + --- + rules: + defaults: + enabled: false + packs: + sensors: [] # ensure only 1 sensor + images: [] # no extra packs to load + volumes: + enabled: false + configs: {} # has one core.yaml config file by default (dicts get merged) + st2chatops: + enabled: true + release: + name: st2ha + asserts: + - hasDocuments: + count: 14 + + + - contains: *override_volume # always included + documentIndex: 12 # st2client + - contains: *override_mnt # always included + documentIndex: 12 # st2client + + + - notContains: *override_volume + documentIndex: 1 + - notContains: *override_mnt + documentIndex: 1 # st2api + - notContains: *override_volume # only contains if volumes.enabled + documentIndex: 10 # st2actionrunner + - notContains: *override_mnt # only contains if volumes.enabled + documentIndex: 10 # st2actionrunner + - notContains: *override_volume + documentIndex: 0 + - notContains: *override_mnt + documentIndex: 0 + - notContains: *override_volume + documentIndex: 2 + - notContains: *override_mnt + documentIndex: 2 + - notContains: *override_volume + documentIndex: 3 + - notContains: *override_mnt + documentIndex: 3 + - notContains: *override_volume + documentIndex: 4 + - notContains: *override_mnt + documentIndex: 4 + - notContains: *override_volume + documentIndex: 5 + - notContains: *override_mnt + documentIndex: 5 + - notContains: *override_volume + documentIndex: 6 + - notContains: *override_mnt + documentIndex: 6 + - notContains: *override_volume + documentIndex: 7 + - notContains: *override_mnt + documentIndex: 7 + - notContains: *override_volume + documentIndex: 8 + - notContains: *override_mnt + documentIndex: 8 + - notContains: *override_volume # never + documentIndex: 9 # st2sensorcontainer + - notContains: *override_mnt # never + documentIndex: 9 # st2sensorcontainer + - notContains: *override_volume + documentIndex: 11 + - notContains: *override_mnt + documentIndex: 11 + - notContains: *override_volume + documentIndex: 13 + - notContains: *override_mnt + documentIndex: 13 From adcf0fe6c328fa8343b99aad0a62ab4ea73a6283 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FS41I5S\\Curtis" Date: Tue, 17 May 2022 00:21:46 -0500 Subject: [PATCH 40/50] REmoving bits I was using for testing. --- tests/unit/dns_test.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/unit/dns_test.yaml b/tests/unit/dns_test.yaml index 1d00c9d4..027a7147 100644 --- a/tests/unit/dns_test.yaml +++ b/tests/unit/dns_test.yaml @@ -25,7 +25,6 @@ tests: - jobs.yaml set: st2: - overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: @@ -57,7 +56,6 @@ tests: value: "2" - name: edns0 st2: - overrides: {} packs: { sensors: [] } # ensure only 1 sensor rbac: { enabled: true } # enable rbac job jobs: From 95edcc3aae90eeff448663e23fd60e960d451b82 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 11:38:20 -0500 Subject: [PATCH 41/50] Updating things from override to overrides --- templates/_helpers.tpl | 4 ++-- templates/configmaps_overrides.yaml | 2 +- templates/deployments.yaml | 4 ++-- templates/jobs.yaml | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 3345f5ee..42d89880 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -212,14 +212,14 @@ define this here as well to simplify comparison with packs-volume-mounts #Inserted for override ability to happen via helm charts -{{- define "stackstorm-ha.override-config-mounts" -}} +{{- define "stackstorm-ha.overrides-config-mounts" -}} {{- if .Values.st2.overrides }} - name: st2-overrides-vol mountPath: /opt/stackstorm/overrides/ {{- end }} {{- end -}} -{{- define "stackstorm-ha.override-configs" -}} +{{- define "stackstorm-ha.overrides-configs" -}} {{- if .Values.st2.overrides }} - name: st2-overrides-vol configMap: diff --git a/templates/configmaps_overrides.yaml b/templates/configmaps_overrides.yaml index 2e67c8ab..90c4536c 100644 --- a/templates/configmaps_overrides.yaml +++ b/templates/configmaps_overrides.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-st2-override-configs + name: {{ .Release.Name }}-st2-overrides-configs annotations: description: StackStorm override configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/overrides' labels: diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 51c92e49..8c686a72 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -1776,7 +1776,7 @@ spec: - name: st2-rbac-mappings-vol mountPath: /opt/stackstorm/rbac/mappings/ {{- end }} - {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} + {{- include "stackstorm-ha.overrides-config-mounts" . | nindent 8 }} - name: st2client-config-vol mountPath: /root/.st2/ - name: st2-ssh-key-vol @@ -1828,7 +1828,7 @@ spec: configMap: name: {{ .Release.Name }}-st2-rbac-mappings {{- end }} - {{- include "stackstorm-ha.override-configs" . | nindent 8 }} + {{- include "stackstorm-ha.overrides-configs" . | nindent 8 }} - name: st2client-config-vol emptyDir: medium: Memory diff --git a/templates/jobs.yaml b/templates/jobs.yaml index ee41cc93..e23791dc 100644 --- a/templates/jobs.yaml +++ b/templates/jobs.yaml @@ -477,14 +477,14 @@ spec: {{- end }} {{- end }} volumeMounts: - {{- include "stackstorm-ha.override-config-mounts" . | nindent 8 }} + {{- include "stackstorm-ha.overrides-config-mounts" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" . | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" . | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" . | nindent 8 }} # TODO: Find out default resource limits for this specific service (#5) #resources: volumes: - {{- include "stackstorm-ha.override-configs" . | nindent 8 }} + {{- include "stackstorm-ha.overrides-configs" . | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" . | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" . | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" . | nindent 8 }} @@ -613,7 +613,7 @@ spec: volumeMounts: - name: st2client-config-vol mountPath: /root/.st2/ - {{- include "stackstorm-ha.override-config-mounts" $ | nindent 8 }} + {{- include "stackstorm-ha.overrides-config-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume-mounts" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volume-mounts-for-register-job" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume-mount" $ | nindent 8 }} @@ -624,7 +624,7 @@ spec: - name: st2client-config-vol emptyDir: medium: Memory - {{- include "stackstorm-ha.override-configs" $ | nindent 8 }} + {{- include "stackstorm-ha.overrides-configs" $ | nindent 8 }} {{- include "stackstorm-ha.st2-config-volume" $ | nindent 8 }} {{- include "stackstorm-ha.packs-volumes" $ | nindent 8 }} {{- include "stackstorm-ha.pack-configs-volume" $ | nindent 8 }} From 2dc8d402f834c4186e6558b68a722f737c0bed3d Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 12:43:18 -0500 Subject: [PATCH 42/50] Update tests/unit/overrides_test.yaml Co-authored-by: Jacob Floyd --- tests/unit/overrides_test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 362c78cd..9028e52b 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -44,20 +44,20 @@ tests: - hasDocuments: count: 5 - - contains: &override_volume + - contains: &overrides_volume path: spec.template.spec.volumes content: name: st2-overrides-vol configMap: - name: st2ha-st2-override-configs + name: st2ha-st2-overrides-configs documentIndex: 3 # register_content - - contains: &override_mnt + - contains: &overrides_mnt path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ + mountPath: /opt/stackstorm/overrides documentIndex: 3 # register_content - notContains: *override_volume From b46ba925f39991af2b2c0bfb11d3655a501e03ce Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 13:24:36 -0500 Subject: [PATCH 43/50] Adjusting test --- tests/unit/overrides_test.yaml | 76 ++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 9028e52b..c4eb9f40 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -59,21 +59,25 @@ tests: name: st2-overrides-vol mountPath: /opt/stackstorm/overrides documentIndex: 3 # register_content + + - contains: *overrides_mnt + documentIndex: 4 #Extra_jobs + - contains: *overrides_volume + documentIndex: 4 #extra_jobs - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 0 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 0 - - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 1 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 1 - - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 2 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 2 + - it: Deployments with overrides template: deployments.yaml @@ -100,61 +104,61 @@ tests: count: 14 - - contains: *override_volume # always included + - contains: *overrides_volume # always included documentIndex: 12 # st2client - - contains: *override_mnt # always included + - contains: *overrides_mnt # always included documentIndex: 12 # st2client - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 1 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 1 # st2api - - notContains: *override_volume # only contains if volumes.enabled + - notContains: *overrides_volume # only contains if volumes.enabled documentIndex: 10 # st2actionrunner - - notContains: *override_mnt # only contains if volumes.enabled + - notContains: *overrides_mnt # only contains if volumes.enabled documentIndex: 10 # st2actionrunner - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 0 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 0 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 2 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 2 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 3 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 3 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 4 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 4 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 5 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 5 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 6 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 6 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 7 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 7 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 8 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 8 - - notContains: *override_volume # never + - notContains: *overrides_volume # never documentIndex: 9 # st2sensorcontainer - - notContains: *override_mnt # never + - notContains: *overrides_mnt # never documentIndex: 9 # st2sensorcontainer - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 11 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 11 - - notContains: *override_volume + - notContains: *overrides_volume documentIndex: 13 - - notContains: *override_mnt + - notContains: *overrides_mnt documentIndex: 13 From c1b1561fc24d7c30e4592a8db5e4d5a298a70acc Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 13:34:54 -0500 Subject: [PATCH 44/50] Adjusting helper --- templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 42d89880..bab839e1 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -223,7 +223,7 @@ define this here as well to simplify comparison with packs-volume-mounts {{- if .Values.st2.overrides }} - name: st2-overrides-vol configMap: - name: {{ .Release.Name }}-st2-override-configs + name: {{ .Release.Name }}-st2-overrides-configs {{- end }} {{- end -}} From 4e19d803691f39ef364ccd924508a1ddd24ecc0e Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 13:39:43 -0500 Subject: [PATCH 45/50] Adding trailing slash to mountpoint --- tests/unit/overrides_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index c4eb9f40..2cdfc219 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -57,7 +57,7 @@ tests: path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides + mountPath: /opt/stackstorm/overrides/ documentIndex: 3 # register_content - contains: *overrides_mnt From 89e505afeaa1c6eaab83e5e30dae1bcc97c1ec18 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 14:18:20 -0500 Subject: [PATCH 46/50] Apply suggestions from code review --- tests/unit/overrides_test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index 2cdfc219..b562750c 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -1,5 +1,5 @@ --- -suite: Override check +suite: Overrides check templates: # primary template files - deployments.yaml @@ -24,7 +24,7 @@ tests: template: jobs.yaml set: st2: - overrides: #Enabling the override mounts in register-content job. + overrides: #Enabling the overrides mounts in register-content job. _global.yaml: | --- rules: @@ -114,9 +114,9 @@ tests: documentIndex: 1 - notContains: *overrides_mnt documentIndex: 1 # st2api - - notContains: *overrides_volume # only contains if volumes.enabled + - notContains: *overrides_volume documentIndex: 10 # st2actionrunner - - notContains: *overrides_mnt # only contains if volumes.enabled + - notContains: *overrides_mnt documentIndex: 10 # st2actionrunner - notContains: *overrides_volume documentIndex: 0 From bf981fb526d877a057ec5f1a6ae105e5410a8672 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 15:53:31 -0500 Subject: [PATCH 47/50] Adjusting changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c144fe..19cc9045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Switch st2 to `v3.7` as a new default stable version (#274) * Upgrade MongoDB `v4.0` -> `v4.4` as 4.0 has reached its EOL. (#304) * Migrate from `python 3.6` `Ubuntu Bionic` to `python 3.8` `Ubuntu Focal` as a base StackStorm OS (StackStorm/st2-dockerfiles#54) +* Add support for use of overrides that are available in `v3.7` of st2 via helm charts. (#306) ## v0.90.0 * Advanced Feature: Make securityContext (on Deployments/Jobs) and podSecurityContext (on Pods) configurable. This allows dropping all capabilities, for example. You can override the securityContext for `st2actionrunner`, `st2sensorcontainer`, and `st2client` if your actions or sensors need, for example, additional capabilites that the rest of StackStorm does not need. (#271) (by @cognifloyd) From c5cfc2c520df0b430043919c29b92d15b0133f6f Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 16:28:30 -0500 Subject: [PATCH 48/50] Changing mountpath to remove trailing slash --- templates/_helpers.tpl | 2 +- tests/unit/overrides_test.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index bab839e1..dd5ce49a 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -215,7 +215,7 @@ define this here as well to simplify comparison with packs-volume-mounts {{- define "stackstorm-ha.overrides-config-mounts" -}} {{- if .Values.st2.overrides }} - name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ + mountPath: /opt/stackstorm/overrides {{- end }} {{- end -}} diff --git a/tests/unit/overrides_test.yaml b/tests/unit/overrides_test.yaml index b562750c..60da9b4c 100644 --- a/tests/unit/overrides_test.yaml +++ b/tests/unit/overrides_test.yaml @@ -57,7 +57,7 @@ tests: path: spec.template.spec.containers[0].volumeMounts content: name: st2-overrides-vol - mountPath: /opt/stackstorm/overrides/ + mountPath: /opt/stackstorm/overrides documentIndex: 3 # register_content - contains: *overrides_mnt From 785d48f3605329d9a8e51e37b33940e797930e70 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 17:03:29 -0500 Subject: [PATCH 49/50] Updating values.yaml to have the exmaple more consistent iwth others with proper spacing --- values.yaml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/values.yaml b/values.yaml index b20fb478..8fb17680 100644 --- a/values.yaml +++ b/values.yaml @@ -68,20 +68,24 @@ st2: [api] allow_origin = '*' - #Override Definitions can be added here. + #Override Definitions can be added here. Overrides can be used to disable rules/actions/sensors either individually + #on a per pack level. _global.yaml is the global file for adjusting overrides, however you can create a pack_name.yaml + #to define what happens to rules for a pack. You can set everything to enabled/disabled with the defaults option or specify + #individual rule names! See documentation for more examples! https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults + overrides: {} # overrides: # _global.yaml: | - # --- - # rules: - # defaults: - # enabled: true - # packA.yaml: | - # --- - # rules: - # rule.name: - # enabled: false - # https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults - overrides: {} + # --- + # rules: + # defaults: + # enabled: true + # packA.yaml: | + # --- + # rules: + # rule.name: + # enabled: false + + # This mirrors the [system_user] section of st2.conf, but makes the values available for helm templating. # If you change the user, you must provide a customized st2actionrunner image that includes your user. system_user: From 903b1552e7308ff266eaefe8b09d46bb98aba850 Mon Sep 17 00:00:00 2001 From: Curtis Wilson Date: Tue, 17 May 2022 17:12:26 -0500 Subject: [PATCH 50/50] Fixing spacing --- values.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/values.yaml b/values.yaml index 8fb17680..6dc4a8c0 100644 --- a/values.yaml +++ b/values.yaml @@ -68,10 +68,8 @@ st2: [api] allow_origin = '*' - #Override Definitions can be added here. Overrides can be used to disable rules/actions/sensors either individually - #on a per pack level. _global.yaml is the global file for adjusting overrides, however you can create a pack_name.yaml - #to define what happens to rules for a pack. You can set everything to enabled/disabled with the defaults option or specify - #individual rule names! See documentation for more examples! https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults + #Override Definitions can be added here. + #https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults overrides: {} # overrides: # _global.yaml: |