diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e86e215..eaa65cc9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ [Releases](https://github.com/NetApp/trident/releases) +## Changes since v23.07.1 + +**Enhancements** +- **Kubernetes:** Added `--trident-image-registry` switch to installer + and value tridentImageRegistry to Helm chart. (Issue [#772](https://github.com/NetApp/trident/issues/772)) + ## Changes since v23.04.0 **Fixes:** diff --git a/cli/cmd/install.go b/cli/cmd/install.go index 68e5c50d6..e7537026e 100644 --- a/cli/cmd/install.go +++ b/cli/cmd/install.go @@ -101,6 +101,7 @@ var ( enableForceDetach bool disableAuditLog bool tridentImage string + tridentImageRegistry string autosupportImage string autosupportProxy string autosupportCustomURL string @@ -192,6 +193,8 @@ func init() { installCmd.Flags().BoolVar(&disableAuditLog, "disable-audit-log", true, "Disable the audit logger.") installCmd.Flags().StringVar(&tridentImage, "trident-image", "", "Trident container image. When installing Trident from a private image registry, this flag must be set to the path of the container image.") + installCmd.Flags().StringVar(&tridentImageRegistry, "trident-image-registry", "", + "The address/port of an internal image registry containing trident images.") installCmd.Flags().StringVar(&logFormat, "log-format", "text", "The Trident logging format (text, json).") installCmd.Flags().StringVar(&logWorkflows, "log-workflows", "", "A comma-delimited list of Trident "+ "workflows for which to enable trace logging.") @@ -202,8 +205,9 @@ 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 location. For more information on specifying image locations, "+ - "consult the Trident documentation.") + "The address/port of an internal image registry location containing csi sidecar images. If trident-image-registry "+ + "is not set this is also used for trident images. For more information on specifying image locations, "+ + "consult the Trident documentation.") 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") @@ -323,7 +327,9 @@ func discoverInstallationEnvironment() error { tridentImage = tridentconfig.BuildImage // Override registry only if using the default Trident image name and an alternate registry was supplied - if imageRegistry != "" { + if tridentImageRegistry != "" { + tridentImage = utils.ReplaceImageRegistry(tridentImage, tridentImageRegistry) + } else if imageRegistry != "" { tridentImage = utils.ReplaceImageRegistry(tridentImage, imageRegistry) } } @@ -332,7 +338,9 @@ func discoverInstallationEnvironment() error { if autosupportImage == "" { autosupportImage = tridentconfig.DefaultAutosupportImage - if imageRegistry != "" { + if tridentImageRegistry != "" { + autosupportImage = utils.ReplaceImageRegistry(autosupportImage, tridentImageRegistry) + } else if imageRegistry != "" { autosupportImage = utils.ReplaceImageRegistry(autosupportImage, imageRegistry) } } diff --git a/helm/trident-operator/templates/_helpers.tpl b/helm/trident-operator/templates/_helpers.tpl index 0a871a506..d70a3f4d1 100644 --- a/helm/trident-operator/templates/_helpers.tpl +++ b/helm/trident-operator/templates/_helpers.tpl @@ -71,10 +71,8 @@ Trident operator image {{- define "trident-operator.image" -}} {{- if .Values.operatorImage }} {{- .Values.operatorImage }} -{{- else if .Values.imageRegistry }} -{{- .Values.imageRegistry }}/trident-operator:{{ .Values.operatorImageTag | default .Chart.AppVersion }} {{- else }} -{{- "" }}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 }} @@ -116,10 +114,8 @@ Trident AutoSupport image {{- define "trident.autosupportImage" -}} {{- if .Values.tridentAutosupportImage }} {{- .Values.tridentAutosupportImage }} -{{- else if .Values.imageRegistry }} -{{- .Values.imageRegistry }}/trident-autosupport:{{ .Values.tridentAutosupportImageTag | default .Chart.AppVersion | trunc 5}} {{- else }} -{{- "" }}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 }} @@ -190,10 +186,8 @@ Trident image {{- define "trident.image" -}} {{- if .Values.tridentImage }} {{- .Values.tridentImage }} -{{- else if .Values.imageRegistry }} -{{- .Values.imageRegistry }}/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }} {{- else }} -{{- "" }}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 0dfc6d388..e5cedfedb 100644 --- a/helm/trident-operator/values.yaml +++ b/helm/trident-operator/values.yaml @@ -33,7 +33,7 @@ affinity: {} -# imageRegistry identifies the registry for the trident-operator, trident, and other 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. @@ -103,6 +103,9 @@ tridentLogLayers: "" # 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: "" + # tridentImageTag allows overriding the tag of the image for Trident. tridentImageTag: ""