Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions charts/generic-service/ci/native-sidecar-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Native sidecar test

name: test
fullname: my-test

image:
repository: jwilder/whoami
tag: latest

launchSidecarFirst: true

sidecars:
- name: sidecar1
image: jwilder/whoami
env:
- name: PORT
value: '8081'

sidecarTemplates:
- |
name: sidecar2
image: {{ .Values.image.repository }}
env:
- name: PORT
value: '8082'
21 changes: 20 additions & 1 deletion charts/generic-service/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ spec:
command: ["sleep", "{{ .Values.ingress.shutdownDelaySeconds }}"]
{{- end }}

{{- if not .Values.launchSidecarFirst }}
{{- range .Values.sidecars }}
- securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
{{- toYaml . | nindent 10 }}
Expand All @@ -485,8 +486,9 @@ spec:
{{- $spec | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}

{{ if or .Values.initContainers .Values.initContainerTemplates }}
{{ if or .Values.initContainers .Values.initContainerTemplates (and .Values.launchSidecarFirst (or .Values.sidecars .Values.sidecarTemplates)) }}
initContainers:
{{- range .Values.initContainers }}
- securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
Expand All @@ -499,4 +501,21 @@ spec:
{{- $spec | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.launchSidecarFirst }}
{{- range .Values.sidecars }}
{{- $sidecar := omit . "restartPolicy" }}
- restartPolicy: Always
securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
{{- toYaml $sidecar | nindent 10 }}
{{- end }}
{{- range .Values.sidecarTemplates }}
{{- $spec := tpl . $ }}
{{- if $spec }}
{{- $specMap := omit (fromYaml $spec) "restartPolicy" }}
- restartPolicy: Always
securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
{{- toYaml $specMap | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/generic-service/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,11 @@
},
"description": "Additional sidecar containers to be added to the Pod"
},
"launchSidecarFirst": {
"type": "boolean",
"default": false,
"description": "Whether to wait for the sidecar's startup probe to succeed before launching the main container."
},
"sidecarsTemplates": {
"type": "array",
"items": {
Expand Down
1 change: 1 addition & 0 deletions charts/generic-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ initContainerTemplates: []

sidecars: []
sidecarTemplates: []
launchSidecarFirst: false

rbac:
roles: []
Expand Down