Skip to content

Commit

Permalink
feat(image registry): Use helm templates
Browse files Browse the repository at this point in the history
  • Loading branch information
DSchmidtDev committed Aug 27, 2024
1 parent 4b7c990 commit 471caa1
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 30 deletions.
2 changes: 1 addition & 1 deletion charts/datahub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for DataHub
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.
version: 0.4.22
version: 0.4.23
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.14.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.image.command }}
command: {{ .Values.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.image.command }}
command: {{ .Values.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ spec:
{{- toYaml $.Values.podSecurityContext | nindent 12 }}
containers:
- name: {{ $jobName }}-crawler
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ $.Values.image.repository }}:{{ required "Global or specific tag is required" ($.Values.image.tag | default $.Values.global.datahub.version) }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
volumeMounts:
- name: recipe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.image.command }}
command: {{ .Values.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
image: "{{ $registry }}/{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahub.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.image.command }}
command: {{ .Values.image.command | toRawJson }}
Expand Down
42 changes: 41 additions & 1 deletion charts/datahub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,44 @@ Return the appropriate apiVersion for cronjob.
{{- else -}}
{{- print "batch/v1beta1" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create general image registry, name and tag
*/}}
{{- define "datahub.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
{{ $registry }}/{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}

{{/*
Create image registry, name and tag for elasticsearch setup job
*/}}
{{- define "elasticsearchSetupJob.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.elasticsearchSetupJob.image.registry -}}
{{ $registry }}/{{ .Values.elasticsearchSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.elasticsearchSetupJob.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}

{{/*
Create image registry, name and tag for kafka setup job
*/}}
{{- define "kafkaSetupJob.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.kafkaSetupJob.image.registry -}}
{{ $registry }}/{{ .Values.kafkaSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.kafkaSetupJob.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}

{{/*
Create image registry, name and tag for mysql setup job
*/}}
{{- define "mysqlSetupJob.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.mysqlSetupJob.image.registry -}}
{{ $registry }}/{{ .Values.mysqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.mysqlSetupJob.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}

{{/*
Create image registry, name and tag for postgres setup job
*/}}
{{- define "postgresqlSetupJob.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.postgresqlSetupJob.image.registry -}}
{{ $registry }}/{{ .Values.postgresqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.postgresqlSetupJob.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}
16 changes: 16 additions & 0 deletions charts/datahub/templates/datahub-upgrade/_upgrade.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,19 @@ Return the env variables for upgrade jobs
value: {{ .datahub_upgrade_history_topic_name }}
{{- end }}
{{- end -}}

{{/*
Create image registry, name and tag for datahub upgrade jobs
*/}}
{{- define "datahubUpgrade.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.datahubUpgrade.image.registry -}}
{{ $registry }}/{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}

{{/*
Create image registry, name and tag for datahub system update job
*/}}
{{- define "datahubSystemUpdate.image" -}}
{{- $registry := .Values.global.imageRegistry | default .Values.datahubSystemUpdate.image.registry -}}
{{ $registry }}/{{ .Values.datahubSystemUpdate.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubSystemUpdate.image.tag | default .Values.global.datahub.version) -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ spec:
{{- end }}
containers:
- name: datahub-upgrade-job
{{- $registry := .Values.global.imageRegistry | default .Values.datahubUpgrade.image.registry -}}
image: "{{ $registry }}/{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahubUpgrade.image" . }}
imagePullPolicy: {{ .Values.datahubUpgrade.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.datahubUpgrade.cleanupJob.image.command }}
command: {{ .Values.datahubUpgrade.cleanupJob.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ spec:
{{- end }}
containers:
- name: datahub-upgrade-job
{{- $registry := .Values.global.imageRegistry | default .Values.datahubUpgrade.image.registry -}}
image: "{{ $registry }}/{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" ($.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahubUpgrade.image" . }}
imagePullPolicy: {{ .Values.datahubUpgrade.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.datahubUpgrade.noCodeDataMigration.image.command }}
command: {{ .Values.datahubUpgrade.noCodeDataMigration.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ spec:
{{- end }}
containers:
- name: datahub-upgrade-job
{{- $registry := .Values.global.imageRegistry | default .Values.datahubUpgrade.image.registry -}}
image: "{{ $registry }}/{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahubUpgrade.image" . }}
imagePullPolicy: {{ .Values.datahubUpgrade.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.datahubUpgrade.restoreIndices.image.command }}
command: {{ .Values.datahubUpgrade.restoreIndices.image.command | toRawJson }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ spec:
{{- end }}
containers:
- name: datahub-system-update-job
{{- $registry := .Values.global.imageRegistry | default .Values.datahubSystemUpdate.image.registry -}}
image: "{{ $registry }}/{{ .Values.datahubSystemUpdate.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubSystemUpdate.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "datahubSystemUpdate.image" . }}
imagePullPolicy: {{ .Values.datahubSystemUpdate.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.datahubSystemUpdate.image.command }}
command: {{ .Values.datahubSystemUpdate.image.command | toRawJson }}
Expand Down
3 changes: 1 addition & 2 deletions charts/datahub/templates/elasticsearch-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ spec:
{{- end }}
containers:
- name: elasticsearch-setup-job
{{- $registry := .Values.global.imageRegistry | default .Values.elasticsearchSetupJob.image.registry -}}
image: "{{ $registry }}/{{ .Values.elasticsearchSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.elasticsearchSetupJob.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "elasticsearchSetupJob.image" . }}
imagePullPolicy: {{ .Values.elasticsearchSetupJob.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.elasticsearchSetupJob.image.command }}
command: {{ .Values.elasticsearchSetupJob.image.command | toRawJson }}
Expand Down
3 changes: 1 addition & 2 deletions charts/datahub/templates/kafka-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ spec:
{{- end }}
containers:
- name: kafka-setup-job
{{- $registry := .Values.global.imageRegistry | default .Values.kafkaSetupJob.image.registry -}}
image: "{{ $registry }}/{{ .Values.kafkaSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.kafkaSetupJob.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "kafkaSetupJob.image" . }}
imagePullPolicy: {{ .Values.kafkaSetupJob.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.kafkaSetupJob.image.command }}
command: {{ .Values.kafkaSetupJob.image.command | toRawJson }}
Expand Down
3 changes: 1 addition & 2 deletions charts/datahub/templates/mysql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ spec:
{{- end }}
containers:
- name: mysql-setup-job
{{- $registry := .Values.global.imageRegistry | default .Values.mysqlSetupJob.image.registry -}}
image: "{{ $registry }}/{{ .Values.mysqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.mysqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "mysqlSetupJob.image" . }}
imagePullPolicy: {{ .Values.mysqlSetupJob.image.pullPolicy | default "IfNotPresent" }}
{{- if .Values.mysqlSetupJob.image.command }}
command: {{ .Values.mysqlSetupJob.image.command | toRawJson }}
Expand Down
3 changes: 1 addition & 2 deletions charts/datahub/templates/postgresql-setup-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ spec:
{{- end }}
containers:
- name: postgresql-setup-job
{{- $registry := .Values.global.imageRegistry | default .Values.postgresqlSetupJob.image.registry -}}
image: "{{ $registry }}/{{ .Values.postgresqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.postgresqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
image: {{ include "postgresqlSetupJob.image" . }}
imagePullPolicy: {{ .Values.postgresqlSetupJob.image.pullPolicy | default "Always" }}
{{- if .Values.postgresqlSetupJob.image.command }}
command: {{ .Values.postgresqlSetupJob.image.command | toRawJson }}
Expand Down

0 comments on commit 471caa1

Please sign in to comment.