Skip to content

Commit

Permalink
Fall back to imageRegistry if tridentImageRegistry is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
mayrstefan committed Oct 18, 2022
1 parent 2c009f0 commit 22b0f6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions helm/trident-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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 }}

Expand Down Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions helm/trident-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 22b0f6b

Please sign in to comment.