From 979df0e37a72629ae41468ad408329b83b5c9cba Mon Sep 17 00:00:00 2001 From: David Leifker Date: Fri, 8 Nov 2024 16:57:27 -0600 Subject: [PATCH] feat(bootstrapMCPs): follow default globals bootstrapMCPs * use default timezone * use default CLI version * simplify overrides --- charts/datahub/Chart.yaml | 2 +- .../templates/datahub-upgrade/_upgrade.tpl | 20 +++++++++++++------ .../datahub-system-update-job.yml | 20 +++++++++++++++++-- charts/datahub/values.yaml | 19 ++++++++++-------- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/charts/datahub/Chart.yaml b/charts/datahub/Chart.yaml index b8d8f9644..d6588ba06 100644 --- a/charts/datahub/Chart.yaml +++ b/charts/datahub/Chart.yaml @@ -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.35 +version: 0.4.36 # 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.1 diff --git a/charts/datahub/templates/datahub-upgrade/_upgrade.tpl b/charts/datahub/templates/datahub-upgrade/_upgrade.tpl index b5d462572..24b47fcc3 100644 --- a/charts/datahub/templates/datahub-upgrade/_upgrade.tpl +++ b/charts/datahub/templates/datahub-upgrade/_upgrade.tpl @@ -192,19 +192,27 @@ Return the env variables for upgrade jobs datahubGC cron daily custom scheduling */}} {{- define "datahub.systemUpdate.datahubGC.dailyCronWindow" -}} -{{- if .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.dailyCronWindow.enabled -}} +{{- if hasKey (index .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.values "schedule" | default dict) "interval" -}} schedule: - interval: {{ printf "%d %s * * * " (mod (randNumeric 2) 60) (include "randomHourInRange" (list .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.dailyCronWindow.startHour .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.dailyCronWindow.endHour)) }} + interval: {{ .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.values.schedule.interval | quote }} {{- else }} schedule: - interval: {{ .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.values.schedule.interval | quote }} + interval: {{ printf "%d %s * * * " (mod (randNumeric 2) 60) (include "randomHourInRange" (list .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.dailyCronWindow.startHour .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.dailyCronWindow.endHour)) }} {{- end }} {{- end -}} {{/* -datahubGC timezone + timezone */}} -{{- define "datahub.systemUpdate.datahubGC.timezone" -}} +{{- define "datahub.bootstrapMCPs.default.schedule.timezone" -}} schedule: - timezone: {{ .Values.global.datahub.timezone | default .Values.datahubSystemUpdate.bootstrapMCPs.datahubGC.values.schedule.timezone | quote }} + timezone: {{ .Values.global.datahub.timezone | quote }} +{{- end -}} + +{{/* + default cli version +*/}} +{{- define "datahub.bootstrapMCPs.default.ingestion.version" -}} +ingestion: + version: {{ .Values.global.datahub.managed_ingestion.defaultCliVersion | quote }} {{- end -}} \ No newline at end of file diff --git a/charts/datahub/templates/datahub-upgrade/datahub-system-update-job.yml b/charts/datahub/templates/datahub-upgrade/datahub-system-update-job.yml index 2a514a29c..c64a3a0fe 100644 --- a/charts/datahub/templates/datahub-upgrade/datahub-system-update-job.yml +++ b/charts/datahub/templates/datahub-upgrade/datahub-system-update-job.yml @@ -135,7 +135,14 @@ spec: value: {{ . | quote }} {{- end }} {{- range $k, $v := .Values.datahubSystemUpdate.bootstrapMCPs }} - {{- $result := deepCopy $v.values }} + {{- if ne $k "default" }} + {{- $result := dict }} + {{- range $.Values.datahubSystemUpdate.bootstrapMCPs.default.value_configs }} + {{- $funcOutput := include . $ | fromYaml }} + {{- $result = include "deepMerge" (dict "dst" $result "src" $funcOutput) | fromYaml }} + {{- end }} + {{- $valuesCopy := deepCopy $v.values }} + {{- $result = include "deepMerge" (dict "dst" $result "src" $valuesCopy) | fromYaml }} {{- range $v.values_generated_configs }} {{- $funcOutput := include . $ | fromYaml }} {{- $result = include "deepMerge" (dict "dst" $result "src" $funcOutput) | fromYaml }} @@ -147,6 +154,7 @@ spec: value: '{"version":"{{ $.Chart.Version }}-{{ $.Release.Revision }}"}' {{- end }} {{- end }} + {{- end }} {{- with .Values.datahubSystemUpdate.extraEnvs }} {{- toYaml . | nindent 12 }} {{- end }} @@ -310,7 +318,14 @@ spec: value: {{ . | quote }} {{- end }} {{- range $k, $v := .Values.datahubSystemUpdate.bootstrapMCPs }} - {{- $result := deepCopy $v.values }} + {{- if ne $k "default" }} + {{- $result := dict }} + {{- range $.Values.datahubSystemUpdate.bootstrapMCPs.default.value_configs }} + {{- $funcOutput := include . $ | fromYaml }} + {{- $result = include "deepMerge" (dict "dst" $result "src" $funcOutput) | fromYaml }} + {{- end }} + {{- $valuesCopy := deepCopy $v.values }} + {{- $result = include "deepMerge" (dict "dst" $result "src" $valuesCopy) | fromYaml }} {{- range $v.values_generated_configs }} {{- $funcOutput := include . $ | fromYaml }} {{- $result = include "deepMerge" (dict "dst" $result "src" $funcOutput) | fromYaml }} @@ -322,6 +337,7 @@ spec: value: '{"version":"{{ $.Chart.Version }}-{{ $.Release.Revision }}"}' {{- end }} {{- end }} + {{- end }} {{- with .Values.datahubSystemUpdate.extraEnvs }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/datahub/values.yaml b/charts/datahub/values.yaml index d241811f8..fb074530d 100644 --- a/charts/datahub/values.yaml +++ b/charts/datahub/values.yaml @@ -395,17 +395,19 @@ datahubSystemUpdate: # args: [] # Depends on v0.14.2 or greater bootstrapMCPs: + default: + value_configs: + - "datahub.bootstrapMCPs.default.ingestion.version" + - "datahub.bootstrapMCPs.default.schedule.timezone" datahubGC: # For information about this recipe https://datahubproject.io/docs/0.14.0/generated/ingestion/sources/datahubgc/#install-the-plugin - # Overrides values.schedule.interval below with a jitter window using a generated config + # Generate values.schedule.interval with a jitter window using a generated config dailyCronWindow: - enabled: true startHour: 18 endHour: 5 # dynamic overrides, the output to each function is deepMerged with values values_generated_configs: - "datahub.systemUpdate.datahubGC.dailyCronWindow" - - "datahub.systemUpdate.datahubGC.timezone" # Environment variable containing the json value for the template mcp values_env: DATAHUB_GC_BOOTSTRAP_VALUES revision_env: DATAHUB_GC_BOOTSTRAP_REVISION @@ -413,12 +415,13 @@ datahubSystemUpdate: values: ingestion: name: datahub-gc + # override global.datahub.managed_ingestion.defaultCliVersion version: "0.14.1.7rc2" - schedule: - # overridden by global.datahub.timezone - timezone: "UTC" - # overridden if dynamic.dailyCronWindow.enable is true - interval: "0 1 * * *" + # schedule: + # # override global.datahub.timezone + # timezone: "UTC" + # # override dailyCronWindow + # interval: "0 1 * * *" cleanup_expired_tokens: "false" truncate_indices: "true" dataprocess_cleanup: