From e2a72a8602c9cdf2e44f5f35e58e2a2de5e25c03 Mon Sep 17 00:00:00 2001
From: szalai1 <szalaipeti.vagyok@gmail.com>
Date: Fri, 16 Dec 2022 17:01:51 +0100
Subject: [PATCH] feat(global-version): add option to globally define versions

---
 charts/datahub/Chart.yaml                     | 14 ++++++-------
 .../acryl-datahub-actions/Chart.yaml          |  2 +-
 .../subcharts/datahub-frontend/Chart.yaml     |  2 +-
 .../templates/deployment.yaml                 |  2 +-
 .../datahub/subcharts/datahub-gms/Chart.yaml  |  2 +-
 .../datahub-gms/templates/deployment.yaml     |  2 +-
 .../datahub-ingestion-cron/Chart.yaml         |  2 +-
 .../templates/cron.yaml                       |  2 +-
 .../subcharts/datahub-mae-consumer/Chart.yaml |  2 +-
 .../templates/deployment.yaml                 |  2 +-
 .../subcharts/datahub-mce-consumer/Chart.yaml |  2 +-
 .../templates/deployment.yaml                 |  2 +-
 .../datahub-cleanup-job-template.yml          |  2 +-
 .../datahub-restore-indices-job-template.yml  |  2 +-
 .../datahub-upgrade/datahub-upgrade-job.yml   |  2 +-
 .../templates/elasticsearch-setup-job.yml     |  2 +-
 charts/datahub/templates/kafka-setup-job.yml  |  2 +-
 charts/datahub/templates/mysql-setup-job.yml  |  2 +-
 .../templates/postgresql-setup-job.yml        |  2 +-
 charts/datahub/values.yaml                    | 21 ++++++++++---------
 20 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/charts/datahub/Chart.yaml b/charts/datahub/Chart.yaml
index 6ccef1c32..5418e7154 100644
--- a/charts/datahub/Chart.yaml
+++ b/charts/datahub/Chart.yaml
@@ -4,33 +4,33 @@ description: A Helm chart for LinkedIn 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.2.119
+version: 0.2.120
 # 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.9.1
 dependencies:
   - name: datahub-gms
-    version: 0.2.118
+    version: 0.2.120
     repository: file://./subcharts/datahub-gms
     condition: datahub-gms.enabled
   - name: datahub-frontend
-    version: 0.2.114
+    version: 0.2.120
     repository: file://./subcharts/datahub-frontend
     condition: datahub-frontend.enabled
   - name: datahub-mae-consumer
-    version: 0.2.113
+    version: 0.2.120
     repository: file://./subcharts/datahub-mae-consumer
     condition: global.datahub_standalone_consumers_enabled
   - name: datahub-mce-consumer
-    version: 0.2.113
+    version: 0.2.120
     repository: file://./subcharts/datahub-mce-consumer
     condition: global.datahub_standalone_consumers_enabled
   - name: datahub-ingestion-cron
-    version: 0.2.114
+    version: 0.2.120
     repository: file://./subcharts/datahub-ingestion-cron
     condition: datahub-ingestion-cron.enabled
   - name: acryl-datahub-actions
-    version: 0.2.113
+    version: 0.2.120
     repository: file://./subcharts/acryl-datahub-actions
     condition: acryl-datahub-actions.enabled
 maintainers:
diff --git a/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml b/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml
index 72cd17c96..b2840a594 100644
--- a/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml
+++ b/charts/datahub/subcharts/acryl-datahub-actions/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes
 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.2.113
+version: 0.2.120
 # 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.0.7
diff --git a/charts/datahub/subcharts/datahub-frontend/Chart.yaml b/charts/datahub/subcharts/datahub-frontend/Chart.yaml
index 75fd30a37..cc46fb443 100644
--- a/charts/datahub/subcharts/datahub-frontend/Chart.yaml
+++ b/charts/datahub/subcharts/datahub-frontend/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes
 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.2.114
+version: 0.2.120
 # 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: v0.9.3
diff --git a/charts/datahub/subcharts/datahub-frontend/templates/deployment.yaml b/charts/datahub/subcharts/datahub-frontend/templates/deployment.yaml
index f2e1f342f..c1d39dfc3 100644
--- a/charts/datahub/subcharts/datahub-frontend/templates/deployment.yaml
+++ b/charts/datahub/subcharts/datahub-frontend/templates/deployment.yaml
@@ -47,7 +47,7 @@ spec:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+          image: "{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           lifecycle:
             {{- toYaml .Values.lifecycle | nindent 12 }}
diff --git a/charts/datahub/subcharts/datahub-gms/Chart.yaml b/charts/datahub/subcharts/datahub-gms/Chart.yaml
index 367e1a66e..01d0c2735 100644
--- a/charts/datahub/subcharts/datahub-gms/Chart.yaml
+++ b/charts/datahub/subcharts/datahub-gms/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for LinkedIn DataHub's datahub-gms component
 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.2.114
+version: 0.2.120
 # 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: v0.9.3
diff --git a/charts/datahub/subcharts/datahub-gms/templates/deployment.yaml b/charts/datahub/subcharts/datahub-gms/templates/deployment.yaml
index d307a6f55..89f57237c 100644
--- a/charts/datahub/subcharts/datahub-gms/templates/deployment.yaml
+++ b/charts/datahub/subcharts/datahub-gms/templates/deployment.yaml
@@ -51,7 +51,7 @@ spec:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+          image: "{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           ports:
             - name: http
diff --git a/charts/datahub/subcharts/datahub-ingestion-cron/Chart.yaml b/charts/datahub/subcharts/datahub-ingestion-cron/Chart.yaml
index bde46a4ae..03b20980a 100644
--- a/charts/datahub/subcharts/datahub-ingestion-cron/Chart.yaml
+++ b/charts/datahub/subcharts/datahub-ingestion-cron/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes
 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.2.114
+version: 0.2.120
 # 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: v0.9.3
diff --git a/charts/datahub/subcharts/datahub-ingestion-cron/templates/cron.yaml b/charts/datahub/subcharts/datahub-ingestion-cron/templates/cron.yaml
index 129b4c113..5cbae9d51 100644
--- a/charts/datahub/subcharts/datahub-ingestion-cron/templates/cron.yaml
+++ b/charts/datahub/subcharts/datahub-ingestion-cron/templates/cron.yaml
@@ -35,7 +35,7 @@ spec:
         {{- end }}
           containers:
           - name: {{ $jobName }}-crawler
-            image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
+            image: "{{ $.Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
             imagePullPolicy: {{ $.Values.image.pullPolicy }}
             volumeMounts:
               - name: recipe
diff --git a/charts/datahub/subcharts/datahub-mae-consumer/Chart.yaml b/charts/datahub/subcharts/datahub-mae-consumer/Chart.yaml
index 9ecf2ae15..adb60b921 100644
--- a/charts/datahub/subcharts/datahub-mae-consumer/Chart.yaml
+++ b/charts/datahub/subcharts/datahub-mae-consumer/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes
 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.2.113
+version: 0.2.120
 # 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: v0.9.3
diff --git a/charts/datahub/subcharts/datahub-mae-consumer/templates/deployment.yaml b/charts/datahub/subcharts/datahub-mae-consumer/templates/deployment.yaml
index 6a74316e1..e807bd1d8 100644
--- a/charts/datahub/subcharts/datahub-mae-consumer/templates/deployment.yaml
+++ b/charts/datahub/subcharts/datahub-mae-consumer/templates/deployment.yaml
@@ -51,7 +51,7 @@ spec:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+          image: "{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           ports:
             - name: http
diff --git a/charts/datahub/subcharts/datahub-mce-consumer/Chart.yaml b/charts/datahub/subcharts/datahub-mce-consumer/Chart.yaml
index 7457df560..6f88840a2 100644
--- a/charts/datahub/subcharts/datahub-mce-consumer/Chart.yaml
+++ b/charts/datahub/subcharts/datahub-mce-consumer/Chart.yaml
@@ -12,7 +12,7 @@ description: A Helm chart for Kubernetes
 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.2.113
+version: 0.2.120
 # 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: v0.9.3
diff --git a/charts/datahub/subcharts/datahub-mce-consumer/templates/deployment.yaml b/charts/datahub/subcharts/datahub-mce-consumer/templates/deployment.yaml
index ab2d99d2e..f1bdf42f2 100644
--- a/charts/datahub/subcharts/datahub-mce-consumer/templates/deployment.yaml
+++ b/charts/datahub/subcharts/datahub-mce-consumer/templates/deployment.yaml
@@ -51,7 +51,7 @@ spec:
         - name: {{ .Chart.Name }}
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
+          image: "{{ .Values.image.repository }}:{{ required "Global or specific tag is required" (.Values.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.image.pullPolicy }}
           ports:
             - name: http 
diff --git a/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml b/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml
index 532e8c147..da005afce 100644
--- a/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml
+++ b/charts/datahub/templates/datahub-upgrade/datahub-cleanup-job-template.yml
@@ -56,7 +56,7 @@ spec:
           {{- end }}
           containers:
             - name: datahub-upgrade-job
-              image: "{{ .Values.datahubUpgrade.image.repository }}:{{ .Values.datahubUpgrade.image.tag }}"
+              image: "{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
               imagePullPolicy: {{ .Values.datahubUpgrade.imagePullPolicy | default "IfNotPresent" }}
               args: [ "-u", "NoCodeDataMigrationCleanup" ]
               env:
diff --git a/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml b/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml
index 1357a07aa..9740c3beb 100644
--- a/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml
+++ b/charts/datahub/templates/datahub-upgrade/datahub-restore-indices-job-template.yml
@@ -62,7 +62,7 @@ spec:
           {{- end }}
           containers:
             - name: datahub-upgrade-job
-              image: "{{ .Values.datahubUpgrade.image.repository }}:{{ .Values.datahubUpgrade.image.tag }}"
+              image: "{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
               imagePullPolicy: {{ .Values.datahubUpgrade.imagePullPolicy | default "IfNotPresent" }}
               args:
                 - "-u"
diff --git a/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml b/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml
index f22cd43a4..fc7ec9437 100644
--- a/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml
+++ b/charts/datahub/templates/datahub-upgrade/datahub-upgrade-job.yml
@@ -60,7 +60,7 @@ spec:
       {{- end }}
       containers:
         - name: datahub-upgrade-job
-          image: "{{ .Values.datahubUpgrade.image.repository }}:{{ .Values.datahubUpgrade.image.tag }}"
+          image: "{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.datahubUpgrade.imagePullPolicy | default "IfNotPresent" }}
           args:
             - "-u"
diff --git a/charts/datahub/templates/elasticsearch-setup-job.yml b/charts/datahub/templates/elasticsearch-setup-job.yml
index 06ecf0975..f6b911535 100644
--- a/charts/datahub/templates/elasticsearch-setup-job.yml
+++ b/charts/datahub/templates/elasticsearch-setup-job.yml
@@ -50,7 +50,7 @@ spec:
         {{- toYaml .Values.elasticsearchSetupJob.podSecurityContext | nindent 8 }}
       containers:
         - name: elasticsearch-setup-job
-          image: "{{ .Values.elasticsearchSetupJob.image.repository }}:{{ .Values.elasticsearchSetupJob.image.tag }}"
+          image: "{{ .Values.elasticsearchSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.elasticsearchSetupJob.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.elasticsearchSetupJob.imagePullPolicy | default "IfNotPresent" }}
           env:
             - name: ELASTICSEARCH_HOST
diff --git a/charts/datahub/templates/kafka-setup-job.yml b/charts/datahub/templates/kafka-setup-job.yml
index 7d907e5e9..752306600 100644
--- a/charts/datahub/templates/kafka-setup-job.yml
+++ b/charts/datahub/templates/kafka-setup-job.yml
@@ -56,7 +56,7 @@ spec:
       {{- end }}
       containers:
         - name: kafka-setup-job
-          image: "{{ .Values.kafkaSetupJob.image.repository }}:{{ .Values.kafkaSetupJob.image.tag }}"
+          image: "{{ .Values.kafkaSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.kafkaSetupJob.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.kafkaSetupJob.imagePullPolicy | default "IfNotPresent" }}
           env:
             - name: KAFKA_ZOOKEEPER_CONNECT
diff --git a/charts/datahub/templates/mysql-setup-job.yml b/charts/datahub/templates/mysql-setup-job.yml
index 13e865901..4a776c736 100644
--- a/charts/datahub/templates/mysql-setup-job.yml
+++ b/charts/datahub/templates/mysql-setup-job.yml
@@ -50,7 +50,7 @@ spec:
         {{- toYaml .Values.mysqlSetupJob.podSecurityContext | nindent 8 }}
       containers:
         - name: mysql-setup-job
-          image: "{{ .Values.mysqlSetupJob.image.repository }}:{{ .Values.mysqlSetupJob.image.tag }}"
+          image: "{{ .Values.mysqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" ( .Values.mysqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.mysqlSetupJob.imagePullPolicy | default "IfNotPresent" }}
           env:
             - name: MYSQL_USERNAME
diff --git a/charts/datahub/templates/postgresql-setup-job.yml b/charts/datahub/templates/postgresql-setup-job.yml
index b7e2df7a9..ec62c51d7 100644
--- a/charts/datahub/templates/postgresql-setup-job.yml
+++ b/charts/datahub/templates/postgresql-setup-job.yml
@@ -50,7 +50,7 @@ spec:
         {{- toYaml .Values.postgresqlSetupJob.podSecurityContext | nindent 8 }}
       containers:
         - name: postgresql-setup-job
-          image: "{{ .Values.postgresqlSetupJob.image.repository }}:{{ .Values.postgresqlSetupJob.image.tag }}"
+          image: "{{ .Values.postgresqlSetupJob.image.repository }}:{{ required "Global or specific tag is required" (.Values.postgresqlSetupJob.image.tag | default .Values.global.datahub.version) }}"
           imagePullPolicy: {{ .Values.postgresqlSetupJob.imagePullPolicy | default "Always" }}
           env:
             - name: POSTGRES_USERNAME
diff --git a/charts/datahub/values.yaml b/charts/datahub/values.yaml
index c30ccc80b..a806c593c 100644
--- a/charts/datahub/values.yaml
+++ b/charts/datahub/values.yaml
@@ -4,7 +4,7 @@ datahub-gms:
   enabled: true
   image:
     repository: linkedin/datahub-gms
-    tag: "v0.9.3"
+    # tag: "v0.9.3 # defaults to .global.datahub.version
   # Optionally set a GMS specific SQL login (defaults to global login)
   # sql:
   #   datasource:
@@ -17,7 +17,7 @@ datahub-frontend:
   enabled: true
   image:
     repository: linkedin/datahub-frontend-react
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # # defaults to .global.datahub.version
   # Set up ingress to expose react front-end
   ingress:
     enabled: false
@@ -37,24 +37,24 @@ acryl-datahub-actions:
 datahub-mae-consumer:
   image:
     repository: linkedin/datahub-mae-consumer
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
 
 datahub-mce-consumer:
   image:
     repository: linkedin/datahub-mce-consumer
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
 
 datahub-ingestion-cron:
   enabled: false
   image:
     repository: acryldata/datahub-ingestion
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
 
 elasticsearchSetupJob:
   enabled: true
   image:
     repository: linkedin/datahub-elasticsearch-setup
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
   podSecurityContext:
     fsGroup: 1000
   securityContext:
@@ -65,7 +65,7 @@ kafkaSetupJob:
   enabled: true
   image:
     repository: linkedin/datahub-kafka-setup
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
   podSecurityContext:
     fsGroup: 1000
   securityContext:
@@ -76,7 +76,7 @@ mysqlSetupJob:
   enabled: true
   image:
     repository: acryldata/datahub-mysql-setup
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
   podSecurityContext:
     fsGroup: 1000
   securityContext:
@@ -92,7 +92,7 @@ postgresqlSetupJob:
   enabled: false
   image:
     repository: acryldata/datahub-postgres-setup
-    tag: "v0.9.3"
+    # tag: "v0.9.3" # defaults to .global.datahub.version
   podSecurityContext:
     fsGroup: 1000
   securityContext:
@@ -108,7 +108,7 @@ datahubUpgrade:
   enabled: true
   image:
     repository: acryldata/datahub-upgrade
-    tag: "v0.9.3"
+    # tag: "v0.9.3"# defaults to .global.datahub.version
   batchSize: 1000
   batchDelayMs: 100
   noCodeDataMigration:
@@ -191,6 +191,7 @@ global:
       #   value: password
 
   datahub:
+    version: v0.9.3
     gms:
       port: "8080"
       nodePort: "30001"