From 22b0f6bb42f75369ba0deb89b451ed16b7bc03c6 Mon Sep 17 00:00:00 2001 From: Stefan Mayr Date: Tue, 18 Oct 2022 23:18:54 +0200 Subject: [PATCH] Fall back to imageRegistry if tridentImageRegistry is not set --- cli/cmd/install.go | 6 +++++- helm/trident-operator/templates/_helpers.tpl | 6 +++--- helm/trident-operator/values.yaml | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cli/cmd/install.go b/cli/cmd/install.go index 80b5c0f80..bce18308e 100644 --- a/cli/cmd/install.go +++ b/cli/cmd/install.go @@ -194,7 +194,7 @@ func init() { installCmd.Flags().StringVar(&kubeletDir, "kubelet-dir", "/var/lib/kubelet", "The host location of kubelet's internal state.") installCmd.Flags().StringVar(&imageRegistry, "image-registry", "", - "The address/port of an internal image registry containing csi sidecar images.") + "The address/port of an internal image registry containing csi sidecar images. If trident-image-registry is not set this is also used for trident images") installCmd.Flags().StringVar(&autosupportProxy, "autosupport-proxy", "", "The address/port of a proxy for sending Autosupport Telemetry") installCmd.Flags().StringVar(&autosupportCustomURL, "autosupport-custom-url", "", "Custom Autosupport endpoint") @@ -299,6 +299,8 @@ func discoverInstallationEnvironment() error { // Override registry only if using the default Trident image name and an alternate registry was supplied if tridentImageRegistry != "" { tridentImage = utils.ReplaceImageRegistry(tridentImage, tridentImageRegistry) + } else if imageRegistry != "" { + tridentImage = utils.ReplaceImageRegistry(tridentImage, imageRegistry) } } log.Debugf("Trident image: %s", tridentImage) @@ -308,6 +310,8 @@ func discoverInstallationEnvironment() error { if tridentImageRegistry != "" { autosupportImage = utils.ReplaceImageRegistry(autosupportImage, tridentImageRegistry) + } else if imageRegistry != "" { + autosupportImage = utils.ReplaceImageRegistry(autosupportImage, imageRegistry) } } log.Debugf("Autosupport image: %s", autosupportImage) diff --git a/helm/trident-operator/templates/_helpers.tpl b/helm/trident-operator/templates/_helpers.tpl index 78e6f5b75..41bf3a838 100644 --- a/helm/trident-operator/templates/_helpers.tpl +++ b/helm/trident-operator/templates/_helpers.tpl @@ -69,7 +69,7 @@ Trident operator image {{- if .Values.operatorImage }} {{- .Values.operatorImage }} {{- else }} -{{- .Values.tridentImageRegistry | default "docker.io/netapp" }}/trident-operator:{{ .Values.operatorImageTag | default .Chart.AppVersion }} +{{- .Values.tridentImageRegistry | default .Values.imageRegistry | default "docker.io/netapp" }}/trident-operator:{{ .Values.operatorImageTag | default .Chart.AppVersion }} {{- end }} {{- end }} @@ -112,7 +112,7 @@ Trident AutoSupport image {{- if .Values.tridentAutosupportImage }} {{- .Values.tridentAutosupportImage }} {{- else }} -{{- .Values.tridentImageRegistry | default "docker.io/netapp"}}/trident-autosupport:{{ .Values.tridentAutosupportImageTag | default .Chart.AppVersion | trunc 5}} +{{- .Values.tridentImageRegistry | default .Values.imageRegistry | default "docker.io/netapp" }}/trident-autosupport:{{ .Values.tridentAutosupportImageTag | default .Chart.AppVersion | trunc 5}} {{- end }} {{- end }} @@ -145,6 +145,6 @@ Trident image {{- if .Values.tridentImage }} {{- .Values.tridentImage }} {{- else }} -{{- .Values.tridentImageRegistry | default "docker.io/netapp"}}/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }} +{{- .Values.tridentImageRegistry | default .Values.imageRegistry | default "docker.io/netapp" }}/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }} {{- end }} {{- end }} diff --git a/helm/trident-operator/values.yaml b/helm/trident-operator/values.yaml index bf0782a5d..647a9e1a4 100644 --- a/helm/trident-operator/values.yaml +++ b/helm/trident-operator/values.yaml @@ -33,7 +33,7 @@ affinity: {} -# imageRegistry identifies the registry for official kubernetes csi sidecar images. Leave empty to accept the default. +# imageRegistry identifies the registry for official kubernetes csi sidecar images. Value is also used for tridentImageRegistry if this is not set. Leave empty to accept the default. imageRegistry: "" # imagePullPolicy sets the image pull policy for the trident-operator. @@ -89,7 +89,7 @@ tridentLogFormat: "text" # tridentImage allows the complete override of the image for Trident. tridentImage: "" -# tridentImageRegistry identifies the registry for the trident-operator, trident, and other images. Leave empty to accept the default. +# tridentImageRegistry identifies the registry for the trident-operator, trident, and other images. Leave empty to accept the default. tridentImageRegistry: "" # tridentImageTag allows overriding the tag of the image for Trident.