Skip to content

Commit c03f83b

Browse files
fix: fix manual helm chart (#2648) (#2686)
1 parent 842ae65 commit c03f83b

File tree

3 files changed

+140
-11
lines changed

3 files changed

+140
-11
lines changed

deploy/helm/chart/templates/deployment.yaml

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,32 @@ spec:
3939
containers:
4040
- name: {{ $.Release.Name }}-{{ $serviceName | lower }}
4141
image: {{ $serviceSpec.extraPodSpec.mainContainer.image }}
42+
{{- if $serviceSpec.extraPodSpec.mainContainer.workingDir }}
4243
workingDir: {{ $serviceSpec.extraPodSpec.mainContainer.workingDir }}
44+
{{- end }}
4345
{{- if $serviceSpec.extraPodSpec.mainContainer.command }}
4446
command:
4547
{{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 8 }}
48+
{{- else }}
49+
{{- if $serviceSpec.componentType | eq "frontend" }}
50+
command:
51+
- python3
52+
{{- else }}
53+
command:
54+
- /bin/sh
55+
- -c
56+
{{- if not $serviceSpec.extraPodSpec.mainContainer.args }}
57+
{{- fail (printf "spec.services[%s].extraPodSpec.mainContainer.args must be set for non-frontend components" $serviceName) }}
58+
{{- end }}
59+
{{- end }}
4660
{{- end }}
4761
{{- if $serviceSpec.extraPodSpec.mainContainer.args }}
4862
args:
4963
{{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }}
64+
{{- else if $serviceSpec.componentType | eq "frontend" }}
65+
args:
66+
- -m
67+
- dynamo.frontend
5068
{{- end }}
5169
{{ if $serviceSpec.resources }}
5270
resources:
@@ -77,8 +95,10 @@ spec:
7795
name: {{ $serviceSpec.envFromSecret }}
7896
{{- end }}
7997
env:
80-
- name: DYNAMO_PORT
81-
value: "{{ $.Values.dynamoPort | default 8000 }}"
98+
{{- if $.Values.dynamoNamespace }}
99+
- name: DYN_NAMESPACE
100+
value: {{ $.Values.dynamoNamespace }}
101+
{{- end }}
82102
{{- if $.Values.etcdAddr }}
83103
- name: ETCD_ENDPOINTS
84104
value: "{{ $.Values.etcdAddr }}"
@@ -87,9 +107,31 @@ spec:
87107
- name: NATS_SERVER
88108
value: "{{ $.Values.natsAddr }}"
89109
{{- end }}
110+
{{- if $serviceSpec.componentType | eq "frontend" }}
111+
- name: DYNAMO_PORT
112+
value: "{{ $.Values.dynamoPort | default 8000 }}"
113+
- name: DYN_HTTP_PORT
114+
value: "{{ $.Values.dynamoPort | default 8000 }}"
115+
{{- else if $serviceSpec.componentType | eq "worker" }}
116+
- name: DYN_SYSTEM_ENABLED
117+
value: "true"
118+
- name: DYN_SYSTEM_PORT
119+
value: "{{ $.Values.dynamoSystemPort | default 9090 }}"
120+
- name: DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS
121+
value: "[\"generate\"]"
122+
{{- end }}
123+
{{- if $serviceSpec.componentType | eq "frontend" }}
124+
ports:
125+
- name: http
126+
containerPort: {{ $.Values.dynamoPort | default 8000 }}
127+
protocol: TCP
128+
{{- else if $serviceSpec.componentType | eq "worker" }}
90129
ports:
91-
- name: health
92-
containerPort: {{ $.Values.healthPort | default 5000 }}
130+
- name: system
131+
containerPort: {{ $.Values.dynamoSystemPort | default 9090 }}
132+
protocol: TCP
133+
{{- end }}
134+
{{- if and $serviceSpec.componentType (or (eq $serviceSpec.componentType "frontend") (eq $serviceSpec.componentType "worker")) }}
93135
livenessProbe:
94136
{{- if $serviceSpec.livenessProbe }}
95137
{{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
@@ -99,11 +141,21 @@ spec:
99141
timeoutSeconds: 5
100142
failureThreshold: 10
101143
successThreshold: 1
144+
{{- if $serviceSpec.componentType | eq "frontend" }}
145+
httpGet:
146+
path: /health
147+
port: http
148+
{{- else if $serviceSpec.componentType | eq "worker" }}
149+
httpGet:
150+
path: /live
151+
port: system
152+
{{- else }}
102153
httpGet:
103154
path: /healthz
104155
port: health
105156
scheme: HTTP
106157
{{- end }}
158+
{{- end }}
107159
readinessProbe:
108160
{{- if $serviceSpec.readinessProbe }}
109161
{{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
@@ -113,10 +165,23 @@ spec:
113165
timeoutSeconds: 5
114166
failureThreshold: 10
115167
successThreshold: 1
168+
{{- if $serviceSpec.componentType | eq "frontend" }}
169+
exec:
170+
command:
171+
- /bin/sh
172+
- -c
173+
- curl -s http://localhost:${DYNAMO_PORT}/health | jq -e ".status == \"healthy\""
174+
{{- else if $serviceSpec.componentType | eq "worker" }}
175+
httpGet:
176+
path: /health
177+
port: system
178+
{{- else }}
116179
httpGet:
117180
path: /readyz
118181
port: health
119182
scheme: HTTP
120183
{{- end }}
184+
{{- end }}
185+
{{- end }}
121186
{{- end }}
122187
{{- end }}

deploy/helm/chart/templates/grove-podgangset.yaml

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ metadata:
2323
spec:
2424
replicas: 1
2525
template:
26+
terminationDelay: 1h
2627
cliques:
2728
{{- range $serviceName, $serviceSpec := .Values.spec.services }}
2829
- name: {{ $serviceName | lower }}
@@ -64,14 +65,32 @@ spec:
6465
{{- if $serviceSpec.extraPodSpec.mainContainer.command }}
6566
command:
6667
{{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 14 }}
68+
{{- else }}
69+
{{- if $serviceSpec.componentType | eq "frontend" }}
70+
command:
71+
- python3
72+
{{- else }}
73+
command:
74+
- /bin/sh
75+
- -c
76+
{{- if not $serviceSpec.extraPodSpec.mainContainer.args }}
77+
{{- fail (printf "spec.services[%s].extraPodSpec.mainContainer.args must be set for non-frontend components" $serviceName) }}
78+
{{- end }}
79+
{{- end }}
6780
{{- end }}
6881
{{- if $serviceSpec.extraPodSpec.mainContainer.args }}
6982
args:
7083
{{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 14 }}
84+
{{- else if $serviceSpec.componentType | eq "frontend" }}
85+
args:
86+
- -m
87+
- dynamo.frontend
7188
{{- end }}
7289
env:
73-
- name: DYNAMO_PORT
74-
value: "{{ $.Values.dynamoPort | default 8000 }}"
90+
{{- if $.Values.dynamoNamespace }}
91+
- name: DYN_NAMESPACE
92+
value: {{ $.Values.dynamoNamespace }}
93+
{{- end }}
7594
{{- if $.Values.etcdAddr }}
7695
- name: ETCD_ENDPOINTS
7796
value: "{{ $.Values.etcdAddr }}"
@@ -80,41 +99,86 @@ spec:
8099
- name: NATS_SERVER
81100
value: "{{ $.Values.natsAddr }}"
82101
{{- end }}
102+
{{- if $serviceSpec.componentType | eq "frontend" }}
103+
- name: DYNAMO_PORT
104+
value: "{{ $.Values.dynamoPort | default 8000 }}"
105+
- name: DYN_HTTP_PORT
106+
value: "{{ $.Values.dynamoPort | default 8000 }}"
107+
{{- else if $serviceSpec.componentType | eq "worker" }}
108+
- name: DYN_SYSTEM_ENABLED
109+
value: "true"
110+
- name: DYN_SYSTEM_PORT
111+
value: "{{ $.Values.dynamoSystemPort | default 9090 }}"
112+
- name: DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS
113+
value: "[\"generate\"]"
114+
{{- end }}
83115
{{- if $serviceSpec.envFromSecret }}
84116
envFrom:
85117
- secretRef:
86118
name: {{ $serviceSpec.envFromSecret }}
87119
{{- end }}
120+
{{- if $serviceSpec.componentType | eq "frontend" }}
121+
ports:
122+
- name: http
123+
containerPort: {{ $.Values.dynamoPort | default 8000 }}
124+
protocol: TCP
125+
{{- else if $serviceSpec.componentType | eq "worker" }}
88126
ports:
89-
- name: health
90-
containerPort: {{ $.Values.healthPort | default 5000 }}
127+
- name: system
128+
containerPort: {{ $.Values.dynamoSystemPort | default 9090 }}
129+
protocol: TCP
130+
{{- end }}
131+
{{- if and $serviceSpec.componentType (or (eq $serviceSpec.componentType "frontend") (eq $serviceSpec.componentType "worker")) }}
91132
livenessProbe:
92133
{{- if $serviceSpec.livenessProbe }}
93-
{{ $serviceSpec.livenessProbe | toYaml | nindent 14 }}
134+
{{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
94135
{{- else }}
95136
initialDelaySeconds: 60
96137
periodSeconds: 60
97138
timeoutSeconds: 5
98139
failureThreshold: 10
99140
successThreshold: 1
141+
{{- if $serviceSpec.componentType | eq "frontend" }}
142+
httpGet:
143+
path: /health
144+
port: http
145+
{{- else if $serviceSpec.componentType | eq "worker" }}
146+
httpGet:
147+
path: /live
148+
port: system
149+
{{- else }}
100150
httpGet:
101151
path: /healthz
102152
port: health
103153
scheme: HTTP
104154
{{- end }}
155+
{{- end }}
105156
readinessProbe:
106157
{{- if $serviceSpec.readinessProbe }}
107-
{{ $serviceSpec.readinessProbe | toYaml | nindent 14 }}
158+
{{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
108159
{{- else }}
109160
initialDelaySeconds: 60
110161
periodSeconds: 60
111162
timeoutSeconds: 5
112163
failureThreshold: 10
113164
successThreshold: 1
165+
{{- if $serviceSpec.componentType | eq "frontend" }}
166+
exec:
167+
command:
168+
- /bin/sh
169+
- -c
170+
- curl -s http://localhost:${DYNAMO_PORT}/health | jq -e ".status == \"healthy\""
171+
{{- else if $serviceSpec.componentType | eq "worker" }}
172+
httpGet:
173+
path: /health
174+
port: system
175+
{{- else }}
114176
httpGet:
115177
path: /readyz
116178
port: health
117179
scheme: HTTP
118180
{{- end }}
181+
{{- end }}
182+
{{- end }}
119183
{{- end }}
120184
{{- end }}

deploy/helm/chart/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
{{- range $serviceName, $serviceSpec := .Values.spec.services }}
16-
{{- if eq $serviceSpec.componentType "main" }}
16+
{{- if eq $serviceSpec.componentType "frontend" }}
1717
---
1818
apiVersion: v1
1919
kind: Service

0 commit comments

Comments
 (0)