Skip to content

Commit

Permalink
Merge pull request #104 from dasmeta/DMVP-4372
Browse files Browse the repository at this point in the history
fix: DMVP-4372 Support multiple init container
  • Loading branch information
aghamyan44 authored Jun 7, 2024
2 parents 05f6eb4 + 5182bee commit e553aae
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 22 deletions.
4 changes: 2 additions & 2 deletions charts/base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.66
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.66"
appVersion: "0.2.0"
29 changes: 26 additions & 3 deletions charts/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,31 @@ base:
name: docflow-config

### Init container

initContainers:
name: config
#### 0.1.66 Version which support one init container
initContainers:
name: config
args:
- /config.json
- /test/config.json
secrets:
- CLIENT_ID:
from: client-market
key: client_id
- AUTH_TOKEN:
from: auth-token
key: token
image:
repository: nginx
pullPolicy: IfNotPresent
tag: latest
volumes:
- mountPath: /config.json
name: config-json
subPath: config.json

#### 0.2.0 version support multiple init containers
initContainers:
- name: config
args:
- /config.json
- /test/config.json
Expand All @@ -518,6 +540,7 @@ base:
name: config-json
subPath: config.json


### Job
job:
name: db-commands
Expand Down
30 changes: 16 additions & 14 deletions charts/base/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,24 @@ spec:
serviceAccountName: {{ include "base.serviceAccountName" . }}
{{- if .Values.initContainers }}
initContainers:
- name: {{ .Values.initContainers.name }}
image: "{{ .Values.initContainers.image.repository }}:{{ .Values.initContainers.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.initContainers.image.pullPolicy }}
{{- if $.Values.initContainers.command }}
{{- range $initContainer := .Values.initContainers }}
- name: {{ $initContainer.name }}
image: "{{ $initContainer.image.repository }}:{{ $initContainer.image.tag }}"
imagePullPolicy: {{ $initContainer.image.pullPolicy }}
{{- if $initContainer.command }}
command:
{{ toYaml .Values.initContainers.command | nindent 12 }}
{{ toYaml $initContainer.command | nindent 12 }}
{{- end }}
{{- if $.Values.initContainers.args }}
args: {{ toYaml .Values.initContainers.args | nindent 12 }}
{{- if $initContainer.args }}
args: {{ toYaml $initContainer.args | nindent 12 }}
{{- end }}
{{- if or .Values.initContainers.extraEnv .Values.initContainers.secrets}}
{{- if or $initContainer.extraEnv $initContainer.secrets}}
env:
{{- range $key, $value := .Values.initContainers.extraEnv }}
{{- range $key, $value := $initContainer.extraEnv }}
- name: {{ $key | quote}}
value: {{ $value | quote }}
{{- end }}
{{- range $secret := .Values.initContainers.secrets }}
{{- range $secret := $initContainer.secrets }}
{{- if ne (kindOf $secret) "string" }}
{{- range $map_key,$map_value := $secret }}
- name: {{ $map_key }}
Expand All @@ -81,13 +82,13 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.initContainers.envFrom }}
{{- if $initContainer.envFrom }}
envFrom:
{{- toYaml .Values.initContainers.envFrom | nindent 12 }}
{{- toYaml $initContainer.envFrom | nindent 12 }}
{{- end }}
{{- if .Values.initContainers.volumes }}
{{- if $initContainer.volumes }}
volumeMounts:
{{- range $index, $element := .Values.initContainers.volumes }}
{{- range $index, $element := $initContainer.volumes }}
- name: {{ coalesce $element.name (add $index 1) }}
mountPath: {{ $element.mountPath }}
readOnly: {{ $element.readOnly | default false }}
Expand All @@ -97,6 +98,7 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints | nindent 6 }}
Expand Down
24 changes: 21 additions & 3 deletions charts/base/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,27 @@ image:
# Overrides the image tag whose default is the chart appVersion.
tag: 1.21

# initContainer:
# image: busybox
# tag: 1.28
# Init containers
# initContainers:
# - name: config
# args:
# - /config.json
# - /test/config.json
# secrets:
# - CLIENT_ID:
# from: client-market
# key: client_id
# - AUTH_TOKEN:
# from: auth-token
# key: token
# image:
# repository: nginx
# pullPolicy: IfNotPresent
# tag: latest
# volumes:
# - mountPath: /config.json
# name: config-json
# subPath: config.json

imagePullSecrets: []
nameOverride: ""
Expand Down

0 comments on commit e553aae

Please sign in to comment.