Skip to content

Commit 8259d68

Browse files
authored
Merge pull request #248 from cognifloyd/empty-default-rbac-files
Allow excluding default/sample RBAC files in values
2 parents b7fa4ab + 804b827 commit 8259d68

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Explicitly differentiate sensor modes: `all-sensors-in-one-pod` vs `one-sensor-per-pod`. Exposes the mode in new `stackstorm/sensor-mode` annotation. (#222) (by @cognifloyd)
55
* Allow adding custom env variables to any Deployment or Job. (#120) (by @AngryDeveloper)
66
* Template the contents of st2.config and the values in st2chatops.env. This allows adding secrets defined elsewhere in values. (#249) (by @cognifloyd)
7+
* Set default/sample RBAC config files to "" (empty string) to prevent adding them. This is needed because they cannot be removed by overriding the roles/mappings values. (#247) (by @cognifloyd)
78

89
## v0.70.0
910
* New feature: Shared packs volumes `st2.packs.volumes`. Allow using cluster-specific persistent volumes to store packs, virtualenvs, and (optionally) configs. This enables using `st2 pack install`. It even works with `st2packs` images in `st2.packs.images`. (#199) (by @cognifloyd)

templates/configmaps_rbac.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ metadata:
1414
release: {{ .Release.Name }}
1515
heritage: {{ .Release.Service }}
1616
data:
17-
{{ toYaml .Values.st2.rbac.roles | indent 2 }}
17+
{{- range $filename, $contents := .Values.st2.rbac.roles }}
18+
{{/* to support removing default files, skip files with empty contents */}}
19+
{{- if $contents }}
20+
{{ $filename }}: |
21+
{{- $contents | nindent 4 }}
22+
{{- end }}
23+
{{- end }}
1824

1925
---
2026
apiVersion: v1
@@ -31,7 +37,13 @@ metadata:
3137
release: {{ .Release.Name }}
3238
heritage: {{ .Release.Service }}
3339
data:
34-
{{ toYaml .Values.st2.rbac.assignments | indent 2 }}
40+
{{- range $filename, $contents := .Values.st2.rbac.assignments }}
41+
{{/* to support removing default files, skip files with empty contents */}}
42+
{{- if $contents }}
43+
{{ $filename }}: |
44+
{{- $contents | nindent 4 }}
45+
{{- end }}
46+
{{- end }}
3547

3648
---
3749
apiVersion: v1

values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ st2:
208208
# Custom StackStorm RBAC roles, shipped in '/opt/stackstorm/rbac/roles/'
209209
# See https://docs.stackstorm.com/rbac.html#defining-roles-and-permission-grants
210210
roles:
211+
# TIP: set files to an empty string to remove them (sample.yaml: "")
211212
sample.yaml: |
212213
# sample RBAC role file, see https://docs.stackstorm.com/rbac.html#defining-roles-and-permission-grants
213214
---
@@ -217,6 +218,7 @@ st2:
217218
# Custom StackStorm RBAC role assignments, shipped in '/opt/stackstorm/rbac/assignments/'
218219
# See: https://docs.stackstorm.com/rbac.html#defining-user-role-assignments
219220
assignments:
221+
# TIP: set files to an empty string to remove them (st2admin.yaml: "")
220222
st2admin.yaml: |
221223
---
222224
username: st2admin

0 commit comments

Comments
 (0)