Skip to content

Commit

Permalink
Support container specific probes (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored Jun 17, 2024
1 parent db52474 commit e0ec48e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 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.36.3
version: 0.37.0
appVersion: "0.1.0"
maintainers:
- name: treydock
Expand Down
6 changes: 4 additions & 2 deletions charts/webservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,12 @@ spec:
{{- end }}
{{- end }}
{{- $probeType := "httpGet" }}
{{- if index $root.Values.probes.typeDefaults $root.Values.appType }}
{{- $probeType = (index $root.Values.probes.typeDefaults $root.Values.appType) }}
{{- if $container.probeType }}
{{- $probeType = $container.probeType }}
{{- else if $root.Values.probes.type }}
{{- $probeType = $root.Values.probes.type }}
{{- else if index $root.Values.probes.typeDefaults $root.Values.appType }}
{{- $probeType = (index $root.Values.probes.typeDefaults $root.Values.appType) }}
{{- end }}
startupProbe:
{{ $probeType }}: {{ tpl (toYaml (index $root.Values.startupProbe $probeType)) $root | nindent 12 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/webservice/templates/tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
image: busybox:latest
imagePullPolicy: Always
command: ['wget']
args: ['-O-','-S','{{ include "webservice.name" . }}:{{ .Values.service.port }}{{ .Values.startupProbe.httpGet.path }}']
args: ['-O-','-S','{{ include "webservice.name" . }}:{{ .Values.service.port }}{{ tpl .Values.startupProbe.httpGet.path . }}']
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand Down
9 changes: 6 additions & 3 deletions charts/webservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ containers:
port: ~
portName: http
startCommand: ~
probePath: ~
probeType: ~
ingressPath: /
auth: ~

Expand Down Expand Up @@ -97,11 +99,12 @@ service:

probes:
type: ~
path: /
typeDefaults:
rshiny: tcpSocket
startupProbe:
httpGet:
path: /
path: '{{ .probePath | default .Values.probes.path }}'
port: '{{ .portName | default .name }}'
tcpSocket:
port: '{{ .portName | default .name }}'
Expand All @@ -110,7 +113,7 @@ startupProbe:
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /
path: '{{ .probePath | default .Values.probes.path }}'
port: '{{ .portName | default .name }}'
tcpSocket:
port: '{{ .portName | default .name }}'
Expand All @@ -119,7 +122,7 @@ livenessProbe:
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
path: '{{ .probePath | default .Values.probes.path }}'
port: '{{ .portName | default .name }}'
tcpSocket:
port: '{{ .portName | default .name }}'
Expand Down

0 comments on commit e0ec48e

Please sign in to comment.