Skip to content

chore: Expose Global Container Registry Configuration for All Microservices in Devtron Helm Chart #4897

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

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 16 additions & 0 deletions charts/devtron/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@ it randomly.
{{- randAlphaNum $len -}}
{{- end -}}
{{- end }}

{{- define "fullImage" }}
{{- $registryName := .currentPosition.registry | default .global.containerRegistry -}}
{{- $imageName := .image | default .currentPosition.image -}}
{{- $imageTag := .tag | default .currentPosition.tag -}}
{{- $imageDigest := .digest | default .currentPosition.digest -}}
{{- if and $registryName $imageName $imageTag $imageDigest }}
{{- printf "%s/%s:%s@%s" $registryName $imageName $imageTag $imageDigest -}}
{{- else if and $registryName $imageName $imageTag -}}
{{- printf "%s/%s:%s" $registryName $imageName $imageTag -}}
{{- else if and $registryName $imageName $imageDigest }}
{{- printf "%s/%s@%s" $registryName $imageName $imageDigest -}}
{{- else }}
{{- printf "%s/%s" $registryName $imageName -}}
{{- end }}
{{- end -}}
6 changes: 3 additions & 3 deletions charts/devtron/templates/app-sync-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
serviceAccountName: devtron
initContainers:
- name: migration-wait
image: "quay.io/devtron/kubectl:latest"
image: {{ include "fullImage" (dict "currentPosition" $.Values.kubectlUtility "global" $.Values.global ) }}
command: ['sh', '-c', 'while [ ! $(kubectl -n devtroncd get $(kubectl -n devtroncd get job -l job=postgresql-migrate-devtron -o name) -o jsonpath="{.status.succeeded}") ]; do sleep 10; done']
{{- if .Values.components.migrator }}
{{- if .Values.components.migrator.appSync }}
Expand All @@ -31,7 +31,7 @@ spec:
{{- end }}
containers:
- name: chart-sync
image: quay.io/devtron/chart-sync:d0dcc590-373-21074
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.appsyncjob "image" $.Values.components.appsyncjob.extraImage "digest" $.Values.components.appsyncjob.extraDigest "global" $.Values.global ) }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
{{- toYaml $.Values.global.containerSecurityContext | nindent 10 }}
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
{{- end }}
containers:
- name: chart-sync
image: quay.io/devtron/chart-sync:d0dcc590-373-21074
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.appsyncjob.chartsync "global" $.Values.global ) }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
{{- toYaml $.Values.global.containerSecurityContext | nindent 14 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/devtron/templates/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
{{- end }}
containers:
- name: dashboard
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.dashboard "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
Expand Down
6 changes: 3 additions & 3 deletions charts/devtron/templates/devtron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ spec:
- name: devtron
{{- if $.Values.installer.modules }}
{{- if and (has "cicd" $.Values.installer.modules) ($.Release.IsUpgrade) }}
image: {{ $.Values.components.devtron.cicdImage }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.devtron "image" $.Values.components.devtron.cicdImage "digest" $.Values.components.devtron.cicdImageDigest "global" $.Values.global ) }}
{{- else }}
image: {{ $.Values.components.devtron.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.devtron "image" $.Values.components.devtron.image "digest" $.Values.components.devtron.digest "global" $.Values.global ) }}
{{- end }}
{{- else }}
image: {{ $.Values.components.devtron.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.devtron "image" $.Values.components.devtron.image "digest" $.Values.components.devtron.digest "global" $.Values.global ) }}
{{- end }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
Expand Down
4 changes: 2 additions & 2 deletions charts/devtron/templates/dex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ spec:
- command:
- /shared/authenticator
- rundex
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.argocdDexServer "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
name: dex
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
Expand All @@ -100,7 +100,7 @@ spec:
- -n
- /authenticator
- /shared
image: {{ .initContainer.authenticator }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.argocdDexServer.initContainer "image" $.Values.components.argocdDexServer.initContainer.authenticator "digest" $.Values.components.argocdDexServer.initContainer.digest "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
name: copyutil
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
Expand Down
4 changes: 2 additions & 2 deletions charts/devtron/templates/gitsensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ spec:
- /bin/sh
- -c
- mkdir -p /git-base/ssh-keys && chown -R devtron:devtron /git-base && chmod 777 /git-base/ssh-keys
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.gitsensor "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
name: chown-git-base
resources: {}
Expand All @@ -90,7 +90,7 @@ spec:
name: git-volume
containers:
- name: git-sensor
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.gitsensor "global" $.Values.global ) }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
Expand Down
22 changes: 10 additions & 12 deletions charts/devtron/templates/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ spec:
serviceAccountName: devtron
containers:
- name: grafana-restart
image: "quay.io/devtron/kubectl:latest"
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.grafanaOrgJob "global" $.Values.global ) }}
command: ["sh", "/tmp/kubectl-grafana.sh"]
volumeMounts:
- name: grafana-org-volume
mountPath: "/tmp/"
initContainers:
- name: grafana-org
image: quay.io/devtron/k8s-utils:tutum-curl
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.grafanaOrgJob.initContainers "global" $.Values.global ) }}
command: ["sh","/tmp/org.sh"]
env:
- name: GRAFANA_PASSWORD
Expand Down Expand Up @@ -512,24 +512,22 @@ spec:
runAsUser: 472
initContainers:
- name: init-chown-data
image: "quay.io/devtron/busybox:1.31.1"
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.initContainer.chownData "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
securityContext:
runAsNonRoot: false
runAsUser: 0
command: ["chown", "-R", "472:472", "/var/lib/grafana"]
resources:
{}
resources: {}
volumeMounts:
- name: storage
mountPath: "/var/lib/grafana"
- name: download-dashboards
image: "quay.io/devtron/curl:7.73.0"
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.initContainer.downloadDashboards "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
command: ["/bin/sh"]
args: [ "-c", "mkdir -p /var/lib/grafana/dashboards/default && /bin/sh /etc/grafana/download_dashboards.sh" ]
resources:
{}
resources: {}
env:
volumeMounts:
- name: config
Expand All @@ -538,7 +536,7 @@ spec:
- name: storage
mountPath: "/var/lib/grafana"
- name: grafana-sc-datasources
image: "quay.io/kiwigrid/k8s-sidecar:1.1.0"
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.initContainer.grafanaDatasources "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
env:
- name: METHOD
Expand All @@ -557,7 +555,7 @@ spec:
containers:
{{- with $.Values.monitoring.grafana.grafanaDashboards }}
- name: grafana-sc-dashboard
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
env:
- name: METHOD
Expand All @@ -578,7 +576,7 @@ spec:
{{- end }}
{{- with $.Values.monitoring.grafana}}
- name: grafana
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
volumeMounts:
- name: config
Expand Down Expand Up @@ -662,7 +660,7 @@ spec:
serviceAccountName: devtron-grafana-test
containers:
- name: devtron-test
image: "quay.io/devtron/bats:v1.4.1"
image: {{ include "fullImage" (dict "currentPosition" $.Values.monitoring.grafana.devtronGrafanaTest "global" $.Values.global ) }}
imagePullPolicy: "IfNotPresent"
command: ["/opt/bats/bin/bats", "-t", "/tests/run.sh"]
volumeMounts:
Expand Down
7 changes: 1 addition & 6 deletions charts/devtron/templates/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@ spec:
{{- toYaml $.Values.global.podSecurityContext | nindent 8 }}
{{- end }}
containers:
-
{{- if $.Values.installer.tag }}
image: {{ $.Values.installer.image }}:{{ $.Values.installer.tag }}
{{- else }}
image: {{ $.Values.installer.image }}
{{- end }}
- image: {{ include "fullImage" (dict "currentPosition" $.Values.installer "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
name: inception
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
Expand Down
2 changes: 1 addition & 1 deletion charts/devtron/templates/kubelink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
{{- end }}
containers:
- name: kubelink
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.kubelink "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion charts/devtron/templates/kubewatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ spec:
{{- end }}
containers:
- name: kubewatch
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.kubewatch "global" $.Values.global ) }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion charts/devtron/templates/lens.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec:
{{- end }}
containers:
- name: lens
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.lens "global" $.Values.global ) }}
{{- if .imagePullPolicy }}
imagePullPolicy: {{ .imagePullPolicy }}
{{- end }}
Expand Down
26 changes: 15 additions & 11 deletions charts/devtron/templates/migrator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
envFrom:
- secretRef:
name: devtron-secret
image: quay.io/devtron/devtron-utils:dup-chart-repo-v1.1.0
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.migrator.devtron.initContainer.chartFix "global" $.Values.global ) }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
{{- toYaml $.Values.global.containerSecurityContext | nindent 12 }}
Expand All @@ -43,7 +43,7 @@ spec:
- /bin/sh
- -c
- cp -r /scripts/. /shared/
image: {{ $.Values.components.devtron.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.devtron "image" $.Values.components.devtron.cicdImage "digest" $.Values.components.devtron.cicdImageDigest "global" $.Values.global ) }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
{{- toYaml $.Values.global.containerSecurityContext | nindent 12 }}
Expand Down Expand Up @@ -76,7 +76,7 @@ spec:
- secretRef:
name: postgresql-migrator
{{- if .image }}
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.migrator "global" $.Values.global ) }}
{{- else }}
image: migrate/migrate
{{- end }}
Expand Down Expand Up @@ -120,7 +120,7 @@ spec:
{{- end }}
containers:
- name: devtron-rollout
image: "quay.io/devtron/kubectl:latest"
image: {{ include "fullImage" (dict "currentPosition" $.Values.kubectlUtility "global" $.Values.global ) }}
command: ['sh', '-c', 'kubectl rollout restart deployment/devtron -n devtroncd && kubectl rollout restart deployment/kubelink -n devtroncd']
{{- if .casbin }}
{{- if .casbin.resources }}
Expand All @@ -133,7 +133,7 @@ spec:
- /bin/sh
- -c
- cp -r /scripts/. /shared/
image: {{ $.Values.components.devtron.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.devtron "image" $.Values.components.devtron.cicdImage "digest" $.Values.components.devtron.cicdImageDigest "global" $.Values.global ) }}
name: init-devtron
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
Expand Down Expand Up @@ -165,7 +165,7 @@ spec:
- secretRef:
name: postgresql-migrator
{{- if .image }}
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.migrator "global" $.Values.global ) }}
{{- else }}
image: migrate/migrate
{{- end }}
Expand Down Expand Up @@ -212,7 +212,7 @@ spec:
- /bin/sh
- -c
- cp -r sql /shared/
image: {{ $.Values.components.gitsensor.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.gitsensor "global" $.Values.global ) }}
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
{{- toYaml $.Values.global.containerSecurityContext | nindent 12 }}
Expand Down Expand Up @@ -245,7 +245,7 @@ spec:
- secretRef:
name: postgresql-migrator
{{- if .image }}
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.migrator "global" $.Values.global ) }}
{{- else }}
image: migrate/migrate
{{- end }}
Expand Down Expand Up @@ -290,7 +290,7 @@ spec:
- /bin/sh
- -c
- cp -r sql /shared/
image: {{ $.Values.components.lens.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.lens "global" $.Values.global ) }}
name: init-lens
{{- if and $.Values.global $.Values.global.containerSecurityContext }}
securityContext:
Expand Down Expand Up @@ -328,7 +328,7 @@ spec:
- secretRef:
name: postgresql-migrator
{{- if .image }}
image: {{ .image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.migrator "global" $.Values.global ) }}
{{- else }}
image: migrate/migrate
{{- end }}
Expand Down Expand Up @@ -366,7 +366,11 @@ spec:
runAsUser: 1000
containers:
- name: postgresql-miscellaneous
image: quay.io/devtron/postgres:11.9
{{- if not $.Values.installer.arch }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.postgres "global" $.Values.global ) }}
{{- else }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.components.postgres.arm "global" $.Values.global ) }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1000
Expand Down
6 changes: 3 additions & 3 deletions charts/devtron/templates/minio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ spec:
fsGroup: 1000
containers:
- name: minio
image: {{ $.Values.minio.image }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.minio "global" $.Values.global ) }}
imagePullPolicy: {{ $.Values.minio.imagePullPolicy }}

command: [ "/bin/sh",
Expand Down Expand Up @@ -339,7 +339,7 @@ spec:
serviceAccountName: "devtron-minio"
containers:
- name: minio-mc
image: {{ $.Values.minio.mbImage }}
image: {{ include "fullImage" (dict "currentPosition" $.Values.minio.miniomc "global" $.Values.global ) }}
imagePullPolicy: {{ $.Values.minio.mbImagePullPolicy }}
command: ["/bin/sh", "/config/initialize"]
env:
Expand Down Expand Up @@ -385,7 +385,7 @@ spec:
serviceAccountName: "devtron-minio"
containers:
- name: minio
image: "quay.io/devtron/minio:RELEASE.2020-12-03T05-49-24Z"
image: {{ include "fullImage" (dict "currentPosition" $.Values.minio.miniomc "global" $.Values.global ) }}
imagePullPolicy: IfNotPresent
command:
- "/bin/sh"
Expand Down
Loading