Skip to content

Commit

Permalink
Fix/command args (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp authored Oct 16, 2023
1 parent 5fa1a84 commit d3fbe3f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
skip-version-file: 'true'
skip-commit: 'true'
skip-on-empty: 'false'
git-push: 'true'
git-push: 'false'

- name: Create Release
uses: softprops/action-gh-release@v1
if: ${{ steps.changelog.outputs.tag != '' }}
Expand Down
2 changes: 1 addition & 1 deletion charts/component/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.0.8
version: 0.0.9

# 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
Expand Down
47 changes: 23 additions & 24 deletions charts/component/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- if and .Values.cronjob .Values.cronjob.enabled }}
{{- $customUser := include "postgresql.v1.username" . }}
apiVersion: batch/v1
kind: CronJob
metadata:
Expand Down Expand Up @@ -36,8 +35,19 @@ spec:
{{- end }}
containers:
{{- range .Values.containers }}
-
name: {{ .name }}
- name: {{ .name }}
{{- if .command }}
command:
{{- range .command }}
- "{{ . }}"
{{- end }}
{{- end}}
{{- if .args }}
args:
{{- range .args }}
- "{{ . }}"
{{- end }}
{{- end }}
{{- if .securityContext }}
securityContext:
{{- toYaml .securityContext | nindent 12 }}
Expand All @@ -47,22 +57,19 @@ spec:
{{- if .envFrom }}
envFrom:
{{- if .envFrom.secretRef }}
-
secretRef:
- secretRef:
name: {{ include "component.fullname" $ }}
{{- end }}
{{- if .envFrom.configMapRef }}
-
configMapRef:
- configMapRef:
name: {{ include "component.fullname" $ }}
{{- end }}
{{- end }}
{{- if .env }}
env:
{{- if .env.fromLocalConfigmap }}
{{- range $item := .env.fromLocalConfigmap }} # picking individual elements from configmap of individual component (backend, frontend, etc)
-
name: {{$item.name}} # the env variable name
- name: {{$item.name}} # the env variable name
valueFrom:
configMapKeyRef:
name: {{ include "component.fullname" $ }}
Expand All @@ -71,8 +78,7 @@ spec:
{{- end }}
{{- if .env.fromGlobalConfigmap }}
{{- range $item := .env.fromGlobalConfigmap }} # picking individual elements from global configmap of entire deployment set
-
name: {{$item.name}} # the env variable name
- name: {{$item.name}} # the env variable name
valueFrom:
configMapKeyRef:
name: {{ $.Release.Name }}
Expand All @@ -81,8 +87,7 @@ spec:
{{- end }}
{{- if .env.fromLocalSecret }}
{{- range $item := .env.fromLocalSecret }} # picking individual elements from secret of individual component (backend, frontend, etc)
-
name: {{$item.name}} # the env variable name
- name: {{$item.name}} # the env variable name
valueFrom:
secretKeyRef:
{{- if $item.secretName }}
Expand All @@ -95,8 +100,7 @@ spec:
{{- end }}
{{- if .env.fromGlobalSecret }}
{{- range $item := .env.fromGlobalSecret }} # picking individual elements from global secret of entire deployment set
-
name: {{$item.name}} # the env variable name
- name: {{$item.name}} # the env variable name
valueFrom:
secretKeyRef:
{{- if $item.secretName }}
Expand All @@ -109,14 +113,12 @@ spec:
{{- end }}
{{- if .env.fromValues }} #this could be pure values based env like DB URLS or DB Host et
{{- range $item := .env.fromValues }} # picking individual elements from global secret of entire deployment set
-
name: {{$item.name}} # the env variable name
- name: {{$item.name}} # the env variable name
value: {{tpl $item.value $ | quote}} # the value of env variable
{{- end }}
{{- end }}
{{- end }}


{{- if .resources}}
{{- with .resources }}
resources:
Expand All @@ -133,21 +135,18 @@ spec:
{{- end }}
{{- end }}
{{- if .volumeMounts }}
{{- with .volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- tpl (toYaml .volumeMounts) $ | nindent 12 }}
{{- end }}
restartPolicy: {{ .Values.cronjob.restartPolicy }}
{{- if .Values.cronjob.podSecurityContext.enabled }}
securityContext:
fsGroup: {{ .Values.cronjob.podSecurityContext.fsGroup }}
{{- end }}
{{- if .Values.cronjob.volumes.enabled }}
{{- with .Values.cronjob.volumes }}
{{- if .Values.cronjob.volumes }}
volumes:
{{- toYaml . | nindent 12 }}

{{- tpl (toYaml .Values.cronjob.volumes) . | nindent 10 }}
{{- end }}
{{- end }}
{{- end}}
30 changes: 23 additions & 7 deletions charts/component/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ spec:
image: '{{$.Values.global.openshiftImageRegistry}}/{{$.Release.Namespace}}/{{$releaseName}}-{{ .name }}:{{ .tag }}'
imagePullPolicy: Always
{{- if .command }}
command: {{ .command }}
command:
{{- range .command }}
- "{{ . }}"
{{- end }}
{{- end}}
{{- if .args }}
args:
{{- range .args }}
- "{{ . }}"
{{- end }}
{{- end }}
{{- if .envFrom }}
envFrom:
{{- if .envFrom.secretRef }}
Expand Down Expand Up @@ -138,6 +147,10 @@ spec:
cpu: 20m
memory: 50Mi
{{- end }}
{{- if .volumeMounts }}
volumeMounts:
{{- tpl (toYaml .volumeMounts) $ | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
containers:
Expand All @@ -148,14 +161,17 @@ spec:
{{- toYaml .securityContext | nindent 12 }}
{{- end}}
{{- if .command }}
command: {{ .command }}
command:
{{- range .command }}
- "{{ . }}"
{{- end }}
{{- end}}
{{- if and .vault .vault.enabled }}
{{- if .args }}
args:
- 'sh'
- '-c'
- '{{- range $k := .vault.secretPaths }}source /vault/secrets/{{$k}} && {{- end}}{{ .vault.entrypoint }}'
{{- end}}
{{- range .args }}
- "{{ . }}"
{{- end }}
{{- end }}
image: '{{$.Values.global.openshiftImageRegistry}}/{{$.Release.Namespace}}/{{$releaseName}}-{{ .name }}:{{ .tag }}'
imagePullPolicy: Always
{{- if .envFrom }}
Expand Down

0 comments on commit d3fbe3f

Please sign in to comment.