trident icon indicating copy to clipboard operation
trident copied to clipboard

trident-operator.imageRegistry with custom registry not handled properly

Open domruf opened this issue 2 years ago • 0 comments

Describe the bug Our on-prem clusters can't access registries on the internet like registry.k8s.io directly. We have mirrors in our local registry though. So I though I use a custom values.yaml and set trident-operator.imageRegistry. The problem is, the helm chart (and operator) does not handle the path of the images properly then. If I set imageRegistry to 'myregistry.com/netapp' the netapp/* images are found but the registry.k8s.io/sig-storage/* images are not. If I set imageRegistry to 'myregistry.com/sig-storage' the registry.k8s.io/sig-storage/* images are found but the netapp/* images are not.

IMHO since trident gets its images from 2 different registries, there should also be 2 imageRegistry options, one for registry.k8s.io and one for docker.io (dockerhub).

BTW I already have a quick hack which solves this problem. I added an additional trident-operator.netappImageRegistry to my values and patched the helm chart like this:

diff --git a/helm/trident-operator/templates/_helpers.tpl b/helm/trident-operator/templates/_helpers.tpl
index a2974dcd..483a692a 100644
--- a/helm/trident-operator/templates/_helpers.tpl
+++ b/helm/trident-operator/templates/_helpers.tpl
@@ -68,8 +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 if .Values.netappImageRegistry }}
+{{- .Values.netappImageRegistry }}/trident-operator:{{ .Values.operatorImageTag | default .Chart.AppVersion }}
 {{- else }}
 {{- "" }}docker.io/netapp/trident-operator:{{ .Values.operatorImageTag | default .Chart.AppVersion }}
 {{- end }}
@@ -113,8 +113,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 if .Values.netappImageRegistry }}
+{{- .Values.netappImageRegistry }}/trident-autosupport:{{ .Values.tridentAutosupportImageTag | default .Chart.AppVersion | trunc 5}}
 {{- else }}
 {{- "" }}docker.io/netapp/trident-autosupport:{{ .Values.tridentAutosupportImageTag | default .Chart.AppVersion | trunc 5}}
 {{- end }}
@@ -148,8 +148,8 @@ Trident image
 {{- define "trident.image" -}}
 {{- if .Values.tridentImage }}
 {{- .Values.tridentImage }}
-{{- else if .Values.imageRegistry }}
-{{- .Values.imageRegistry }}/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }}
+{{- else if .Values.netappImageRegistry }}
+{{- .Values.netappImageRegistry }}/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }}
 {{- else }}
 {{- "" }}docker.io/netapp/trident:{{ .Values.tridentImageTag | default .Chart.AppVersion }}
 {{- end }}

With these changes trident runs fine so far.

Environment Provide accurate information about the environment to help us reproduce the issue.

  • Trident version: [22.07]
  • Trident installation flags used: []
  • Container runtime: [docker 20.10.10]
  • Kubernetes version: [1.21.7]
  • Kubernetes orchestrator: [Rancher v2.6.3]
  • Kubernetes enabled feature gates: []
  • OS: [Ubuntu 18.04]
  • NetApp backend types: [ONTAP]
  • Other:

To Reproduce Steps to reproduce the behavior: Deploy trident via helm and set trident-operator.imageRegistry to a custom registry.

Expected behavior After installing the trident helm chart, all containers are running properly.

Additional context Add any other context about the problem here.

domruf avatar Oct 11 '22 07:10 domruf