Skip to content

Commit dfca6bb

Browse files
authored
Enable conditional rendering for service definitions (#856)
* Enable conditional rendering for service definitions
1 parent 2a7efdd commit dfca6bb

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

charts/temporal/templates/server-service.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{- if $.Values.server.enabled }}
22
{{- range $service := (list "frontend" "internal-frontend") }}
33
{{- $serviceValues := index $.Values.server $service }}
4+
{{- if or (not (hasKey $serviceValues "enabled")) $serviceValues.enabled }}
45
apiVersion: v1
56
kind: Service
67
metadata:
@@ -39,6 +40,7 @@ spec:
3940
---
4041
{{- end }}
4142
{{- end }}
43+
{{- end }}
4244

4345
{{- if $.Values.server.enabled }}
4446
{{- range $service := (list "frontend" "internal-frontend" "matching" "history" "worker") }}
@@ -99,4 +101,4 @@ spec:
99101
---
100102
{{- end }}
101103
{{- end }}
102-
{{- end }}
104+
{{- end }}

charts/temporal/tests/server_service_test.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,40 @@ tests:
5151
containsDocument:
5252
kind: Service
5353
apiVersion: v1
54+
- it: doesn't create frontend services when frontend is disabled
55+
template: templates/server-service.yaml
56+
set:
57+
server:
58+
frontend:
59+
enabled: false
60+
asserts:
61+
- not: true
62+
containsDocument:
63+
kind: Service
64+
apiVersion: v1
65+
name: RELEASE-NAME-temporal-frontend
66+
- not: true
67+
containsDocument:
68+
kind: Service
69+
apiVersion: v1
70+
name: RELEASE-NAME-temporal-frontend-headless
71+
- it: doesn't create internal-frontend services when internal-frontend is disabled
72+
template: templates/server-service.yaml
73+
set:
74+
server:
75+
internal-frontend:
76+
enabled: false
77+
asserts:
78+
- not: true
79+
containsDocument:
80+
kind: Service
81+
apiVersion: v1
82+
name: RELEASE-NAME-temporal-internal-frontend
83+
- not: true
84+
containsDocument:
85+
kind: Service
86+
apiVersion: v1
87+
name: RELEASE-NAME-temporal-internal-frontend-headless
5488
- it: app protocol default in frontend service
5589
template: templates/server-service.yaml
5690
documentSelector:

0 commit comments

Comments
 (0)