Skip to content

Commit

Permalink
Improve using alternative image registries
Browse files Browse the repository at this point in the history
Separate tridentImageRegistry (NetApp images) from imageRegistry (csi sidecar images) in helm chart.
Fall back to imageRegistry if tridentImageRegistry is not set.
Added --trident-image-registry to installer.
  • Loading branch information
mayrstefan committed Jan 7, 2023
1 parent 41e1c03 commit 0d9ba72
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
**Enhancements**
- Improved performance for ontap-nas-economy storage drivers managing multiple FlexVols.
- Enabled dataLIF updates for all ONTAP NAS storage drivers.
- **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 v22.07.0

Expand Down
16 changes: 12 additions & 4 deletions cli/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var (
pvName string
pvcName string
tridentImage string
tridentImageRegistry string
autosupportImage string
autosupportProxy string
autosupportCustomURL string
Expand Down Expand Up @@ -204,14 +205,17 @@ func init() {
"The name of the legacy PV used by Trident, will ensure this does not exist.")
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().Int64Var(&probePort, "probe-port", 17546,
"The port used by the node pods for liveness/readiness probes. Must not already be in use on the worker hosts.")
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")
Expand Down Expand Up @@ -317,7 +321,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)
}
}
Expand All @@ -326,7 +332,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)
}
}
Expand Down
12 changes: 3 additions & 9 deletions helm/trident-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,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 }}

Expand Down Expand Up @@ -124,10 +122,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 }}

Expand Down Expand Up @@ -170,10 +166,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 }}

Expand Down
5 changes: 4 additions & 1 deletion 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 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.
Expand Down Expand Up @@ -90,6 +90,9 @@ tridentDisableAuditLog: true
# 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: ""

Expand Down

0 comments on commit 0d9ba72

Please sign in to comment.