Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for initContainers #39

Merged
merged 8 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 2 additions & 0 deletions charts/generic-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ app:
| `alerting.custom.*.description` | __required if used__ | A longer description of the alert; can include metric labels via templating |
| `sidecars` | `[]` | Additional sidecar containers to be added to the `Pod` |
| `sidecarTemplates` | `[]` | Strings to be templated providing additional sidecar containers to be added to the Pod |
| `initContainers` | `[]` | Additional init containers to be added to the `Pod` |
| `initContainerTemplates` | `[]` | Strings to be templated providing additional init containers to be added to the Pod
hfjn marked this conversation as resolved.
Show resolved Hide resolved
| `rbac.roles` | `[]` | Namespace-specific Kubernetes RBAC Roles to assign to the service (supports templating) |
| `rbac.clusterRoles` | `[]` | Cluster-wide Kubernetes RBAC Roles to assign to the service (supports templating) |
| `rbac.existingServiceAccount` | | The name of an existing service account to use (instead of automatically creating one for the service) |
Expand Down
21 changes: 21 additions & 0 deletions charts/generic-service/ci/initContainer-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# InitContainer test

name: test
fullname: my-test

image:
repository: docker/whalesay
tag: latest

initContainers:
- name: init1
image: docker/whalesay
command: ["cowsay"]
args: ["works!"]

initContainerTemplates:
- |
name: init2
image: {{ .Values.image.repository }}
command: ["cowsay"]
args: ["works!"]
16 changes: 16 additions & 0 deletions charts/generic-service/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,19 @@ spec:
{{- $spec | nindent 10 }}
{{- end }}
{{- end }}

{{ if .Values.initContainers }}
initContainers:
{{- range .Values.initContainers }}
- securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- range .Values.initContainerTemplates }}
{{- $spec := tpl . $ }}
{{- if $spec }}
- securityContext: {{- $.Values.securityContext.container | toYaml | nindent 12 }}
{{- $spec | nindent 10 }}
{{- end }}
{{- end }}
{{- end }}

10 changes: 10 additions & 0 deletions charts/generic-service/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,16 @@
"items": {"type": "string"},
"description": "Strings to be templated providing additional sidecar containers to be added to the Pod"
},
"initContainers": {
"type": "array",
"items": {"type": "object"},
"description": "Additional init containers to be added to the Pod"
},
"initContainerTemplates": {
"type": "array",
"items": {"type": "string"},
"description": "Strings to be templated providing additional init containers to be added to the Pod"
},
"rbac": {
"type": "object",
"properties": {
Expand Down
7 changes: 5 additions & 2 deletions charts/generic-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: ''

image:
registry: docker.io
# repository: required
# tag: required
repository: required
tag: required
pullPolicy: IfNotPresent
pullSecret: ''

Expand Down Expand Up @@ -187,6 +187,9 @@ alerting:
labelValue: ""
custom: {}

initContainers: []
initContainerTemplates: []

sidecars: []
sidecarTemplates: []

Expand Down
Loading