@@ -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 :
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 }}
0 commit comments