Skip to content

Commit 89b076c

Browse files
committed
use list to pass multiple args to labels helpers
1 parent 13ce605 commit 89b076c

21 files changed

+93
-89
lines changed

templates/_helpers.tpl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,33 @@ Create chart name and version as used by the chart label.
1414

1515
{{/*
1616
Common labels
17-
Usage: "{{ include "stackstorm-ha.labels" "st2servicename" }}"
17+
Usage: "{{ include "stackstorm-ha.labels" (list $ "st2servicename") }}"
1818
*/}}
1919
{{- define "stackstorm-ha.labels" -}}
20+
{{- $root := index . 0 }}
21+
{{- $name := index . 1 }}
2022
{{ include "stackstorm-ha.selectorLabels" . }}
21-
{{- if list "st2web" "ingress" | has . }}
23+
{{- if list "st2web" "ingress" | has $name }}
2224
tier: frontend
23-
{{- else if eq . "st2tests" }}
25+
{{- else if eq $name "st2tests" }}
2426
tier: tests
2527
{{- else }}
2628
tier: backend
2729
{{- end }}
2830
vendor: stackstorm
29-
chart: {{ include "stackstorm-ha.chart" $ }}
30-
heritage: {{ $.Release.Service }}
31+
chart: {{ include "stackstorm-ha.chart" $root }}
32+
heritage: {{ $root.Release.Service }}
3133
{{- end -}}
3234

3335
{{/*
3436
Selector labels
35-
Usage: "{{ include "stackstorm-ha.selectorLabels" "st2servicename" }}"
37+
Usage: "{{ include "stackstorm-ha.selectorLabels" (list $ "st2servicename") }}"
3638
*/}}
3739
{{- define "stackstorm-ha.selectorLabels" -}}
38-
app: {{ . }}
39-
release: {{ $.Release.Name }}
40+
{{- $root := index . 0 }}
41+
{{- $name := index . 1 }}
42+
app: {{ $name }}
43+
release: {{ $root.Release.Name }}
4044
{{- end -}}
4145

4246
{{/*

templates/configmaps_packs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ metadata:
55
name: {{ .Release.Name }}-st2-pack-configs
66
annotations:
77
description: StackStorm pack configs defined in helm values, shipped in (or copied to) '/opt/stackstorm/configs/'
8-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
8+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
99
data:
1010
{{ toYaml .Values.st2.packs.configs | indent 2 }}

templates/configmaps_post-start-script.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
name: {{ $.Release.Name }}-{{ . }}-post-start-script
88
annotations:
99
description: Custom postStart lifecycle event handler script for {{ . }}
10-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
10+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
1111
data:
1212
# k8s calls this script in parallel with starting {{ . }} (ie the same time as ENTRYPOINT)
1313
# The pod will not be marked as "running" until this script completes successfully.

templates/configmaps_rbac.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
name: {{ .Release.Name }}-st2-rbac-roles
77
annotations:
88
description: Custom StackStorm RBAC roles, shipped in '/opt/stackstorm/rbac/roles/'
9-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
9+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
1010
data:
1111
{{- range $filename, $contents := .Values.st2.rbac.roles }}
1212
{{/* to support removing default files, skip files with empty contents */}}
@@ -23,7 +23,7 @@ metadata:
2323
name: {{ .Release.Name }}-st2-rbac-assignments
2424
annotations:
2525
description: Custom StackStorm RBAC role assignments, shipped in '/opt/stackstorm/rbac/assignments/'
26-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
26+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
2727
data:
2828
{{- range $filename, $contents := .Values.st2.rbac.assignments }}
2929
{{/* to support removing default files, skip files with empty contents */}}
@@ -40,7 +40,7 @@ metadata:
4040
name: {{ .Release.Name }}-st2-rbac-mappings
4141
annotations:
4242
description: StackStorm RBAC LDAP groups-to-roles mapping rules, shipped in '/opt/stackstorm/rbac/mappings/'
43-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
43+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
4444
data:
4545
{{- if .Values.st2.rbac.mappings }}
4646
{{ toYaml .Values.st2.rbac.mappings | indent 2 }}

templates/configmaps_st2-conf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: {{ .Release.Name }}-st2-config
66
annotations:
77
description: Custom StackStorm config which will apply settings on top of default st2.conf
8-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
8+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
99
data:
1010
# TODO: Bundle DB/MQ login secrets in dynamic ENV-based st2.secrets.conf, leave custom user-defined settings for st2.user.conf (?)
1111
# Docker/K8s-based st2 config file used for templating service names and common overrides on top of original st2.conf.

templates/configmaps_st2-urls.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: {{ .Release.Name }}-st2-urls
66
annotations:
77
description: StackStorm service URLs, used across entire st2 cluster
8-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
8+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
99
data:
1010
ST2_AUTH_URL: http://{{ .Release.Name }}-st2auth:9100/
1111
ST2_API_URL: http://{{ .Release.Name }}-st2api:9101/

templates/configmaps_st2web.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
name: {{ .Release.Name }}-st2web-config
77
annotations:
88
description: Custom StackStorm Web config which will override defaults
9-
labels: {{- include "stackstorm-ha.labels" "st2" | nindent 4 }}
9+
labels: {{- include "stackstorm-ha.labels" (list $ "st2") | nindent 4 }}
1010
data:
1111
# User-defined st2web config with custom settings to replace default config.js
1212
# See https://github.com/StackStorm/st2web#connecting-to-st2-server for more info

0 commit comments

Comments
 (0)