Unverified Commit 266265ea authored by julienmancuso's avatar julienmancuso Committed by GitHub
Browse files

fix: fix manual helm chart (#2648)

parent 05913af5
...@@ -39,14 +39,32 @@ spec: ...@@ -39,14 +39,32 @@ spec:
containers: containers:
- name: {{ $.Release.Name }}-{{ $serviceName | lower }} - name: {{ $.Release.Name }}-{{ $serviceName | lower }}
image: {{ $serviceSpec.extraPodSpec.mainContainer.image }} image: {{ $serviceSpec.extraPodSpec.mainContainer.image }}
{{- if $serviceSpec.extraPodSpec.mainContainer.workingDir }}
workingDir: {{ $serviceSpec.extraPodSpec.mainContainer.workingDir }} workingDir: {{ $serviceSpec.extraPodSpec.mainContainer.workingDir }}
{{- end }}
{{- if $serviceSpec.extraPodSpec.mainContainer.command }} {{- if $serviceSpec.extraPodSpec.mainContainer.command }}
command: command:
{{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 8 }} {{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 8 }}
{{- else }}
{{- if $serviceSpec.componentType | eq "frontend" }}
command:
- python3
{{- else }}
command:
- /bin/sh
- -c
{{- if not $serviceSpec.extraPodSpec.mainContainer.args }}
{{- fail (printf "spec.services[%s].extraPodSpec.mainContainer.args must be set for non-frontend components" $serviceName) }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
{{- if $serviceSpec.extraPodSpec.mainContainer.args }} {{- if $serviceSpec.extraPodSpec.mainContainer.args }}
args: args:
{{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }} {{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 8 }}
{{- else if $serviceSpec.componentType | eq "frontend" }}
args:
- -m
- dynamo.frontend
{{- end }} {{- end }}
{{ if $serviceSpec.resources }} {{ if $serviceSpec.resources }}
resources: resources:
...@@ -77,8 +95,10 @@ spec: ...@@ -77,8 +95,10 @@ spec:
name: {{ $serviceSpec.envFromSecret }} name: {{ $serviceSpec.envFromSecret }}
{{- end }} {{- end }}
env: env:
- name: DYNAMO_PORT {{- if $.Values.dynamoNamespace }}
value: "{{ $.Values.dynamoPort | default 8000 }}" - name: DYN_NAMESPACE
value: {{ $.Values.dynamoNamespace }}
{{- end }}
{{- if $.Values.etcdAddr }} {{- if $.Values.etcdAddr }}
- name: ETCD_ENDPOINTS - name: ETCD_ENDPOINTS
value: "{{ $.Values.etcdAddr }}" value: "{{ $.Values.etcdAddr }}"
...@@ -87,9 +107,31 @@ spec: ...@@ -87,9 +107,31 @@ spec:
- name: NATS_SERVER - name: NATS_SERVER
value: "{{ $.Values.natsAddr }}" value: "{{ $.Values.natsAddr }}"
{{- end }} {{- end }}
{{- if $serviceSpec.componentType | eq "frontend" }}
- name: DYNAMO_PORT
value: "{{ $.Values.dynamoPort | default 8000 }}"
- name: DYN_HTTP_PORT
value: "{{ $.Values.dynamoPort | default 8000 }}"
{{- else if $serviceSpec.componentType | eq "worker" }}
- name: DYN_SYSTEM_ENABLED
value: "true"
- name: DYN_SYSTEM_PORT
value: "{{ $.Values.dynamoSystemPort | default 9090 }}"
- name: DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS
value: "[\"generate\"]"
{{- end }}
{{- if $serviceSpec.componentType | eq "frontend" }}
ports:
- name: http
containerPort: {{ $.Values.dynamoPort | default 8000 }}
protocol: TCP
{{- else if $serviceSpec.componentType | eq "worker" }}
ports: ports:
- name: health - name: system
containerPort: {{ $.Values.healthPort | default 5000 }} containerPort: {{ $.Values.dynamoSystemPort | default 9090 }}
protocol: TCP
{{- end }}
{{- if and $serviceSpec.componentType (or (eq $serviceSpec.componentType "frontend") (eq $serviceSpec.componentType "worker")) }}
livenessProbe: livenessProbe:
{{- if $serviceSpec.livenessProbe }} {{- if $serviceSpec.livenessProbe }}
{{ $serviceSpec.livenessProbe | toYaml | nindent 10 }} {{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
...@@ -99,11 +141,21 @@ spec: ...@@ -99,11 +141,21 @@ spec:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 10 failureThreshold: 10
successThreshold: 1 successThreshold: 1
{{- if $serviceSpec.componentType | eq "frontend" }}
httpGet:
path: /health
port: http
{{- else if $serviceSpec.componentType | eq "worker" }}
httpGet:
path: /live
port: system
{{- else }}
httpGet: httpGet:
path: /healthz path: /healthz
port: health port: health
scheme: HTTP scheme: HTTP
{{- end }} {{- end }}
{{- end }}
readinessProbe: readinessProbe:
{{- if $serviceSpec.readinessProbe }} {{- if $serviceSpec.readinessProbe }}
{{ $serviceSpec.readinessProbe | toYaml | nindent 10 }} {{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
...@@ -113,10 +165,23 @@ spec: ...@@ -113,10 +165,23 @@ spec:
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 10 failureThreshold: 10
successThreshold: 1 successThreshold: 1
{{- if $serviceSpec.componentType | eq "frontend" }}
exec:
command:
- /bin/sh
- -c
- curl -s http://localhost:${DYNAMO_PORT}/health | jq -e ".status == \"healthy\""
{{- else if $serviceSpec.componentType | eq "worker" }}
httpGet:
path: /health
port: system
{{- else }}
httpGet: httpGet:
path: /readyz path: /readyz
port: health port: health
scheme: HTTP scheme: HTTP
{{- end }} {{- end }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
\ No newline at end of file
...@@ -23,6 +23,7 @@ metadata: ...@@ -23,6 +23,7 @@ metadata:
spec: spec:
replicas: 1 replicas: 1
template: template:
terminationDelay: 1h
cliques: cliques:
{{- range $serviceName, $serviceSpec := .Values.spec.services }} {{- range $serviceName, $serviceSpec := .Values.spec.services }}
- name: {{ $serviceName | lower }} - name: {{ $serviceName | lower }}
...@@ -64,14 +65,32 @@ spec: ...@@ -64,14 +65,32 @@ spec:
{{- if $serviceSpec.extraPodSpec.mainContainer.command }} {{- if $serviceSpec.extraPodSpec.mainContainer.command }}
command: command:
{{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 14 }} {{- $serviceSpec.extraPodSpec.mainContainer.command | toYaml | nindent 14 }}
{{- else }}
{{- if $serviceSpec.componentType | eq "frontend" }}
command:
- python3
{{- else }}
command:
- /bin/sh
- -c
{{- if not $serviceSpec.extraPodSpec.mainContainer.args }}
{{- fail (printf "spec.services[%s].extraPodSpec.mainContainer.args must be set for non-frontend components" $serviceName) }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
{{- if $serviceSpec.extraPodSpec.mainContainer.args }} {{- if $serviceSpec.extraPodSpec.mainContainer.args }}
args: args:
{{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 14 }} {{- $serviceSpec.extraPodSpec.mainContainer.args | toYaml | nindent 14 }}
{{- else if $serviceSpec.componentType | eq "frontend" }}
args:
- -m
- dynamo.frontend
{{- end }} {{- end }}
env: env:
- name: DYNAMO_PORT {{- if $.Values.dynamoNamespace }}
value: "{{ $.Values.dynamoPort | default 8000 }}" - name: DYN_NAMESPACE
value: {{ $.Values.dynamoNamespace }}
{{- end }}
{{- if $.Values.etcdAddr }} {{- if $.Values.etcdAddr }}
- name: ETCD_ENDPOINTS - name: ETCD_ENDPOINTS
value: "{{ $.Values.etcdAddr }}" value: "{{ $.Values.etcdAddr }}"
...@@ -80,41 +99,86 @@ spec: ...@@ -80,41 +99,86 @@ spec:
- name: NATS_SERVER - name: NATS_SERVER
value: "{{ $.Values.natsAddr }}" value: "{{ $.Values.natsAddr }}"
{{- end }} {{- end }}
{{- if $serviceSpec.componentType | eq "frontend" }}
- name: DYNAMO_PORT
value: "{{ $.Values.dynamoPort | default 8000 }}"
- name: DYN_HTTP_PORT
value: "{{ $.Values.dynamoPort | default 8000 }}"
{{- else if $serviceSpec.componentType | eq "worker" }}
- name: DYN_SYSTEM_ENABLED
value: "true"
- name: DYN_SYSTEM_PORT
value: "{{ $.Values.dynamoSystemPort | default 9090 }}"
- name: DYN_SYSTEM_USE_ENDPOINT_HEALTH_STATUS
value: "[\"generate\"]"
{{- end }}
{{- if $serviceSpec.envFromSecret }} {{- if $serviceSpec.envFromSecret }}
envFrom: envFrom:
- secretRef: - secretRef:
name: {{ $serviceSpec.envFromSecret }} name: {{ $serviceSpec.envFromSecret }}
{{- end }} {{- end }}
{{- if $serviceSpec.componentType | eq "frontend" }}
ports:
- name: http
containerPort: {{ $.Values.dynamoPort | default 8000 }}
protocol: TCP
{{- else if $serviceSpec.componentType | eq "worker" }}
ports: ports:
- name: health - name: system
containerPort: {{ $.Values.healthPort | default 5000 }} containerPort: {{ $.Values.dynamoSystemPort | default 9090 }}
protocol: TCP
{{- end }}
{{- if and $serviceSpec.componentType (or (eq $serviceSpec.componentType "frontend") (eq $serviceSpec.componentType "worker")) }}
livenessProbe: livenessProbe:
{{- if $serviceSpec.livenessProbe }} {{- if $serviceSpec.livenessProbe }}
{{ $serviceSpec.livenessProbe | toYaml | nindent 14 }} {{ $serviceSpec.livenessProbe | toYaml | nindent 10 }}
{{- else }} {{- else }}
initialDelaySeconds: 60 initialDelaySeconds: 60
periodSeconds: 60 periodSeconds: 60
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 10 failureThreshold: 10
successThreshold: 1 successThreshold: 1
{{- if $serviceSpec.componentType | eq "frontend" }}
httpGet:
path: /health
port: http
{{- else if $serviceSpec.componentType | eq "worker" }}
httpGet:
path: /live
port: system
{{- else }}
httpGet: httpGet:
path: /healthz path: /healthz
port: health port: health
scheme: HTTP scheme: HTTP
{{- end }} {{- end }}
{{- end }}
readinessProbe: readinessProbe:
{{- if $serviceSpec.readinessProbe }} {{- if $serviceSpec.readinessProbe }}
{{ $serviceSpec.readinessProbe | toYaml | nindent 14 }} {{ $serviceSpec.readinessProbe | toYaml | nindent 10 }}
{{- else }} {{- else }}
initialDelaySeconds: 60 initialDelaySeconds: 60
periodSeconds: 60 periodSeconds: 60
timeoutSeconds: 5 timeoutSeconds: 5
failureThreshold: 10 failureThreshold: 10
successThreshold: 1 successThreshold: 1
{{- if $serviceSpec.componentType | eq "frontend" }}
exec:
command:
- /bin/sh
- -c
- curl -s http://localhost:${DYNAMO_PORT}/health | jq -e ".status == \"healthy\""
{{- else if $serviceSpec.componentType | eq "worker" }}
httpGet:
path: /health
port: system
{{- else }}
httpGet: httpGet:
path: /readyz path: /readyz
port: health port: health
scheme: HTTP scheme: HTTP
{{- end }} {{- end }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
{{- range $serviceName, $serviceSpec := .Values.spec.services }} {{- range $serviceName, $serviceSpec := .Values.spec.services }}
{{- if eq $serviceSpec.componentType "main" }} {{- if eq $serviceSpec.componentType "frontend" }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment