Skip to content

Commit 835836d

Browse files
authored
Merge pull request #182 from hnanchahal/master
Refactor Helm templates to configure LDAP/RBAC as OSS, remove Enterprise (v3.4)
2 parents 049ec74 + 4106485 commit 835836d

25 files changed

+144
-304
lines changed

.circleci/config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ jobs:
8484
name: Helm install stackstorm-ha chart
8585
command: helm install --timeout 10m0s --debug --wait --name-template stackstorm-ha .
8686
- run:
87-
# once https://github.com/helm/community/pull/165 is merged we will need to add the parallelism flag back into the
88-
# below command
8987
name: Helm test
9088
command: helm test stackstorm-ha
89+
- run:
90+
name: Helm upgrade with RBAC enabled
91+
command: helm upgrade --set st2.rbac.enabled=true --timeout 5m0s --debug --wait stackstorm-ha .
92+
- run:
93+
name: Helm test with RBAC enabled
94+
command: helm test stackstorm-ha
9195
- run:
9296
when: always
9397
name: Show created K8s resources

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## In Development
44
* Change st2packs definition to a list, to support multiple st2packs containers (#166) (by @moonrail)
5+
* Enabled RBAC/LDAP configuration for OSS version, removed enterprise flags (#182) (by @hnanchahal)
56

67
## v0.52.0
78
* Improve resource allocation and scheduling by adding resources requests cpu/memory values for st2 Pods (#179)

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
# StackStorm version which refers to Docker images tag
3-
appVersion: 3.4dev
3+
appVersion: "3.4dev"
44
name: stackstorm-ha
55
version: 0.52.0
66
description: StackStorm K8s Helm Chart, optimized for running StackStorm in HA environment.
@@ -25,7 +25,7 @@ maintainers:
2525
url: https://github.com/armab
2626
details:
2727
This Helm chart is a fully installable app that codifies StackStorm cluster deployment optimized for HA and K8s environment.
28-
RabbitMQ-HA, MongoDB-HA clusters and coordination backend st2 relies on will be deployed as 3rd party chart dependencies.
28+
RabbitMQ-HA, MongoDB-HA clusters and Redis coordination backend st2 relies on will be deployed as 3rd party chart dependencies.
2929
For configuration details please check default values.yaml and README.
3030
dependencies:
3131
- name: rabbitmq

templates/NOTES.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Congratulations! You have just deployed StackStorm {{ if .Values.enterprise.enabled }}Enterprise {{ end }}HA!
1+
Congratulations! You have just deployed StackStorm HA!
22

33
███████╗████████╗██████╗ ██╗ ██╗ █████╗ ██████╗ ██╗ ██╗
44
██╔════╝╚══██╔══╝╚════██╗ ██║ ██║██╔══██╗ ██╔═══██╗██║ ██╔╝
@@ -11,20 +11,20 @@ Congratulations! You have just deployed StackStorm {{ if .Values.enterprise.enab
1111
{{- if contains "LoadBalancer" .Values.st2web.service.type }}
1212

1313
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14-
Watch the status with "kubectl get service {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'"
14+
Watch the status with "kubectl get service {{ .Release.Name }}-st2web -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'"
1515

16-
export ST2WEB_IP=$(kubectl get service {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
16+
export ST2WEB_IP=$(kubectl get service {{ .Release.Name }}-st2web -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
1717
echo https://${ST2WEB_IP}/
1818

1919
{{- else if contains "ClusterIP" .Values.st2web.service.type }}
2020

2121
echo http://127.0.0.1:8080
22-
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }} 8080:80
22+
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ .Release.Name }}-st2web 8080:80
2323

2424
{{- else if contains "NodePort" .Values.st2web.service.type }}
2525

2626
export ST2WEB_IP=$(minikube ip 2>/dev/null || kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
27-
export ST2WEB_PORT="$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-st2web{{ template "enterpriseSuffix" . }})"
27+
export ST2WEB_PORT="$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-st2web)"
2828
echo http://${ST2WEB_IP}:${ST2WEB_PORT}/
2929

3030
{{- end }}

templates/_helpers.tpl

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,9 @@
33
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
44
{{- end -}}
55

6-
# Image pull secret used to access private docker.stackstorm.com Docker registry with Enterprise images
7-
{{- define "imagePullSecret" }}
8-
{{- if required "Missing context '.Values.enterprise.enabled'!" .Values.enterprise.enabled -}}
9-
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" "docker.stackstorm.com" (printf "%s:%s" .Values.enterprise.license .Values.enterprise.license | b64enc) | b64enc }}
10-
{{- end -}}
11-
{{- end }}
12-
13-
# Generate support method used in labels. This is based on community/enterprise
14-
{{- define "supportMethod" -}}
15-
{{- if required "Missing context '.Values.enterprise.enabled'!" .Values.enterprise.enabled -}}
16-
enterprise
17-
{{- else -}}
18-
community
19-
{{- end -}}
20-
{{- end }}
21-
22-
# Generate Docker image repository: Private 'docker.stackstorm.com' for Enterprise vs Public Docker Hub 'stackstorm' for FOSS version
6+
# Generate Docker image repository: Public Docker Hub 'stackstorm' for FOSS version
237
{{- define "imageRepository" -}}
24-
{{- if required "Missing context '.Values.enterprise.enabled'!" .Values.enterprise.enabled -}}
25-
docker.stackstorm.com
26-
{{- else if .Values.image.repository -}}
8+
{{- if .Values.image.repository -}}
279
{{ .Values.image.repository }}
2810
{{- else -}}
2911
stackstorm
@@ -37,11 +19,6 @@ Create the name of the stackstorm-ha service account to use
3719
{{- default .Chart.Name .Values.serviceAccount.serviceAccountName -}}
3820
{{- end -}}
3921

40-
# Generate '-enterprise' suffix only when it's needed for resource names, docker images, etc
41-
{{- define "enterpriseSuffix" -}}
42-
{{ if required "Missing context '.Values.enterprise.enabled'!" .Values.enterprise.enabled }}-enterprise{{ end }}
43-
{{- end -}}
44-
4522
# Generate '-' prefix only when the variable is defined
4623
{{- define "hyphenPrefix" -}}
4724
{{ if . }}-{{ . }}{{end}}
@@ -160,7 +137,7 @@ Create the name of the stackstorm-ha service account to use
160137
{{- end }}
161138
# System packs
162139
- name: st2-system-packs
163-
image: "{{ template "imageRepository" . }}/st2actionrunner{{ template "enterpriseSuffix" . }}:{{ .Chart.AppVersion }}"
140+
image: "{{ template "imageRepository" . }}/st2actionrunner:{{ .Chart.AppVersion }}"
164141
imagePullPolicy: {{ .Values.image.pullPolicy }}
165142
volumeMounts:
166143
- name: st2-packs-vol

templates/configmaps_packs.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ metadata:
99
app: st2
1010
tier: backend
1111
vendor: stackstorm
12-
support: {{ template "supportMethod" . }}
1312
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1413
release: {{ .Release.Name }}
1514
heritage: {{ .Release.Service }}

templates/configmaps_rbac.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if .Values.enterprise.enabled }}
1+
{{- if .Values.st2.rbac.enabled }}
22
---
33
apiVersion: v1
44
kind: ConfigMap
@@ -10,12 +10,11 @@ metadata:
1010
app: st2
1111
tier: backend
1212
vendor: stackstorm
13-
support: enterprise
1413
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1514
release: {{ .Release.Name }}
1615
heritage: {{ .Release.Service }}
1716
data:
18-
{{ toYaml .Values.enterprise.rbac.roles | indent 2 }}
17+
{{ toYaml .Values.st2.rbac.roles | indent 2 }}
1918

2019
---
2120
apiVersion: v1
@@ -28,12 +27,11 @@ metadata:
2827
app: st2
2928
tier: backend
3029
vendor: stackstorm
31-
support: enterprise
3230
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
3331
release: {{ .Release.Name }}
3432
heritage: {{ .Release.Service }}
3533
data:
36-
{{ toYaml .Values.enterprise.rbac.assignments | indent 2 }}
34+
{{ toYaml .Values.st2.rbac.assignments | indent 2 }}
3735

3836
---
3937
apiVersion: v1
@@ -46,14 +44,13 @@ metadata:
4644
app: st2
4745
tier: backend
4846
vendor: stackstorm
49-
support: enterprise
5047
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
5148
release: {{ .Release.Name }}
5249
heritage: {{ .Release.Service }}
5350
data:
54-
{{- if .Values.enterprise.rbac.mappings }}
55-
{{ toYaml .Values.enterprise.rbac.mappings | indent 2 }}
51+
{{- if .Values.st2.rbac.mappings }}
52+
{{ toYaml .Values.st2.rbac.mappings | indent 2 }}
5653
{{ else }}
5754
{}
5855
{{ end }}
59-
{{ end }}
56+
{{- end }}

templates/configmaps_st2-conf.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ metadata:
99
app: st2
1010
tier: backend
1111
vendor: stackstorm
12-
support: {{ template "supportMethod" . }}
1312
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1413
release: {{ .Release.Name }}
1514
heritage: {{ .Release.Service }}
@@ -19,7 +18,7 @@ data:
1918
# The order of merging: st2.conf < st2.docker.conf < st2.user.conf
2019
st2.docker.conf: |
2120
[auth]
22-
api_url = http://{{ .Release.Name }}-st2api{{ template "enterpriseSuffix" . }}:9101/
21+
api_url = http://{{ .Release.Name }}-st2api:9101/
2322
{{- if index .Values "redis" "enabled" }}
2423
[coordination]
2524
url = redis://{{ template "redis-nodes" $ }}
@@ -44,8 +43,14 @@ data:
4443
[keyvalue]
4544
encryption_key_path = /etc/st2/keys/datastore_key.json
4645
{{- end }}
46+
{{- if .Values.st2.rbac.enabled }}
47+
[rbac]
48+
enable = True
49+
backend = default
50+
{{- end }}
4751
4852
# User-defined st2 config with custom settings applied on top of everything else.
4953
# The order of merging: st2.conf < st2.docker.conf < st2.user.conf
5054
st2.user.conf: |
5155
{{ .Values.st2.config | indent 4 }}
56+

templates/configmaps_st2-urls.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ metadata:
99
app: st2
1010
tier: backend
1111
vendor: stackstorm
12-
support: {{ template "supportMethod" . }}
1312
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1413
release: {{ .Release.Name }}
1514
heritage: {{ .Release.Service }}
1615
data:
17-
ST2_AUTH_URL: http://{{ .Release.Name }}-st2auth{{ template "enterpriseSuffix" . }}:9100/
18-
ST2_API_URL: http://{{ .Release.Name }}-st2api{{ template "enterpriseSuffix" . }}:9101/
19-
ST2_STREAM_URL: http://{{ .Release.Name }}-st2stream{{ template "enterpriseSuffix" . }}:9102/
16+
ST2_AUTH_URL: http://{{ .Release.Name }}-st2auth:9100/
17+
ST2_API_URL: http://{{ .Release.Name }}-st2api:9101/
18+
ST2_STREAM_URL: http://{{ .Release.Name }}-st2stream:9102/

templates/configmaps_st2web.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ metadata:
1010
app: st2
1111
tier: backend
1212
vendor: stackstorm
13-
support: {{ template "supportMethod" . }}
1413
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
1514
release: {{ .Release.Name }}
1615
heritage: {{ .Release.Service }}

0 commit comments

Comments
 (0)