Skip to content

Commit

Permalink
Fix multiple container usage (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored May 12, 2024
1 parent 03ec779 commit 819c929
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/webservice/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: webservice
description: OSC webservice bootstrap Helm Chart
type: application
version: 0.34.0
version: 0.34.1
appVersion: "0.1.0"
maintainers:
- name: treydock
Expand Down
10 changes: 6 additions & 4 deletions charts/webservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ spec:
{{- end }}
{{- if or $root.Values.env $root.Values.database.enable $root.Values.database.mariadb.enable $root.Values.envSecrets }}
env:
- name: PASSENGER_PORT
value: {{ $container.port | default (add $root.Values.service.port $idx) | quote }}
{{- if and $root.Values.database.enable $root.Values.database.password }}
- name: DATABASE_PASSWORD
valueFrom:
Expand All @@ -88,7 +90,7 @@ spec:
{{- end }}
{{- end }}
ports:
- containerPort: {{ add $root.Values.service.port $idx }}
- containerPort: {{ $container.port | default (add $root.Values.service.port $idx) }}
name: {{ $container.portName | default (tpl $container.name $root) }}
{{- if or $root.Values.data.enable $root.Values.mounts.data $root.Values.mounts.home $root.Values.mounts.roDir $root.Values.mounts.rwDir $root.Values.mounts.socket $root.Values.mounts.roFile }}
volumeMounts:
Expand Down Expand Up @@ -131,13 +133,13 @@ spec:
{{- $probeType = $root.Values.probes.type }}
{{- end }}
startupProbe:
{{ $probeType }}: {{ toYaml (index $root.Values.startupProbe $probeType) | nindent 12 }}
{{ $probeType }}: {{ tpl (toYaml (index $root.Values.startupProbe $probeType)) $root | nindent 12 }}
{{- omit $root.Values.startupProbe "httpGet" "tcpSocket" | toYaml | nindent 10 }}
livenessProbe:
{{ $probeType }}: {{ toYaml (index $root.Values.livenessProbe $probeType) | nindent 12 }}
{{ $probeType }}: {{ tpl (toYaml (index $root.Values.livenessProbe $probeType)) $root | nindent 12 }}
{{- omit $root.Values.livenessProbe "httpGet" "tcpSocket" | toYaml | nindent 10 }}
readinessProbe:
{{ $probeType }}: {{ toYaml (index $root.Values.readinessProbe $probeType) | nindent 12 }}
{{ $probeType }}: {{ tpl (toYaml (index $root.Values.readinessProbe $probeType)) $root | nindent 12 }}
{{- omit $root.Values.readinessProbe "httpGet" "tcpSocket" | toYaml | nindent 10 }}
{{- $podResources := $root.Values.podResources}}
{{- if $root.Values.global.env }}
Expand Down
2 changes: 1 addition & 1 deletion charts/webservice/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ spec:
service:
name: {{ include "webservice.name" $root }}
port:
number: {{ add $root.Values.service.port $idx }}
number: {{ $container.port | default (add $root.Values.service.port $idx) }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/webservice/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
{{ $root := . }}
{{- range $idx, $container := .Values.containers }}
- name: {{ $container.portName | default (tpl $container.name $root) }}
port: {{ add $root.Values.service.port $idx }}
port: {{ $container.port | default (add $root.Values.service.port $idx) }}
protocol: TCP
targetPort: {{ $container.portName | default (tpl $container.name $root) }}
{{- end }}
Expand Down
19 changes: 11 additions & 8 deletions charts/webservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ defaultCommand:
none: []
defaultArgs:
rails:
- "--port={{ .Values.service.port }}"
# Set by PASSENGER_PORT env var
# - "--port={{ .Values.service.port }}"
- "--min-instances=1"
- "--sticky-sessions"
- "--start-timeout=180"
Expand All @@ -27,7 +28,8 @@ defaultArgs:
- "--log-file=/dev/stdout"
- "--pid-file=/tmp/passenger.pid"
rshiny:
- "--port={{ .Values.service.port }}"
# Set by PASSENGER_PORT env var
# - "--port={{ .Values.service.port }}"
- "--min-instances=1"
- "--sticky-sessions"
- "--start-timeout=180"
Expand All @@ -41,6 +43,7 @@ defaultArgs:
none: []
containers:
- name: '{{ include "webservice.name" . }}'
port: 3000
portName: http
startCommand: ~
ingressPath: /
Expand Down Expand Up @@ -98,27 +101,27 @@ probes:
startupProbe:
httpGet:
path: /
port: http
port: '{{ .portName | default .name }}'
tcpSocket:
port: http
port: '{{ .portName | default .name }}'
failureThreshold: 12
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /
port: http
port: '{{ .portName | default .name }}'
tcpSocket:
port: http
port: '{{ .portName | default .name }}'
failureThreshold: 6
periodSeconds: 10
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: http
port: '{{ .portName | default .name }}'
tcpSocket:
port: http
port: '{{ .portName | default .name }}'
failureThreshold: 6
periodSeconds: 10
timeoutSeconds: 5
Expand Down

0 comments on commit 819c929

Please sign in to comment.