diff --git a/deploy/crds/tridentorchestrator_cr_customimage.yaml b/deploy/crds/tridentorchestrator_cr_customimage.yaml index 5440a888b..f65f2739d 100644 --- a/deploy/crds/tridentorchestrator_cr_customimage.yaml +++ b/deploy/crds/tridentorchestrator_cr_customimage.yaml @@ -6,3 +6,9 @@ spec: debug: true namespace: trident tridentImage: localhost:5000/netapp/trident:26.06 + csiSidecarProvisionerImage: localhost:5000/sig-storage/csi-provisioner:v6.3.0 + csiSidecarAttacherImage: localhost:5000/sig-storage/csi-attacher:v4.11.0 + csiSidecarResizerImage: localhost:5000/sig-storage/csi-resizer:v2.1.0 + csiSidecarSnapshotterImage: localhost:5000/sig-storage/csi-snapshotter:v8.6.0 + csiSidecarNodeDriverRegistrarImage: localhost:5000/sig-storage/csi-node-driver-registrar:v2.17.0 + csiSidecarLivenessProbeImage: localhost:5000/sig-storage/livenessprobe:v2.19.0 diff --git a/helm/trident-operator/templates/tridentorchestrator.yaml b/helm/trident-operator/templates/tridentorchestrator.yaml index 5f5038df8..cbf3ced5b 100644 --- a/helm/trident-operator/templates/tridentorchestrator.yaml +++ b/helm/trident-operator/templates/tridentorchestrator.yaml @@ -30,6 +30,24 @@ spec: {{- if .Values.imageRegistry }} imageRegistry: {{ .Values.imageRegistry }} {{- end }} + {{- if .Values.csiSidecarProvisionerImage }} + csiSidecarProvisionerImage: {{ .Values.csiSidecarProvisionerImage }} + {{- end }} + {{- if .Values.csiSidecarAttacherImage }} + csiSidecarAttacherImage: {{ .Values.csiSidecarAttacherImage }} + {{- end }} + {{- if .Values.csiSidecarResizerImage }} + csiSidecarResizerImage: {{ .Values.csiSidecarResizerImage }} + {{- end }} + {{- if .Values.csiSidecarSnapshotterImage }} + csiSidecarSnapshotterImage: {{ .Values.csiSidecarSnapshotterImage }} + {{- end }} + {{- if .Values.csiSidecarNodeDriverRegistrarImage }} + csiSidecarNodeDriverRegistrarImage: {{ .Values.csiSidecarNodeDriverRegistrarImage }} + {{- end }} + {{- if .Values.csiSidecarLivenessProbeImage }} + csiSidecarLivenessProbeImage: {{ .Values.csiSidecarLivenessProbeImage }} + {{- end }} kubeletDir: {{ .Values.kubeletDir }} {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/helm/trident-operator/values.yaml b/helm/trident-operator/values.yaml index e30cee4bf..1961bfb47 100644 --- a/helm/trident-operator/values.yaml +++ b/helm/trident-operator/values.yaml @@ -130,6 +130,24 @@ tridentImage: "" # tridentImageTag allows overriding the tag of the image for Trident. tridentImageTag: "" +# csiSidecarProvisionerImage allows the complete override of the CSI provisioner sidecar image. +csiSidecarProvisionerImage: "" + +# csiSidecarAttacherImage allows the complete override of the CSI attacher sidecar image. +csiSidecarAttacherImage: "" + +# csiSidecarResizerImage allows the complete override of the CSI resizer sidecar image. +csiSidecarResizerImage: "" + +# csiSidecarSnapshotterImage allows the complete override of the CSI snapshotter sidecar image. +csiSidecarSnapshotterImage: "" + +# csiSidecarNodeDriverRegistrarImage allows the complete override of the CSI node-driver-registrar sidecar image. +csiSidecarNodeDriverRegistrarImage: "" + +# csiSidecarLivenessProbeImage allows the complete override of the CSI liveness probe sidecar image. +csiSidecarLivenessProbeImage: "" + # (Deprecated) tridentEnableNodePrep attempts to automatically install required packages on nodes. tridentEnableNodePrep: false diff --git a/operator/controllers/orchestrator/installer/installer.go b/operator/controllers/orchestrator/installer/installer.go index 9ff7b95e9..61e3f78f8 100644 --- a/operator/controllers/orchestrator/installer/installer.go +++ b/operator/controllers/orchestrator/installer/installer.go @@ -726,6 +726,25 @@ func (i *Installer) setInstallationParams( } } + if cr.Spec.CSISidecarProvisionerImage != "" { + csiSidecarProvisionerImage = cr.Spec.CSISidecarProvisionerImage + } + if cr.Spec.CSISidecarAttacherImage != "" { + csiSidecarAttacherImage = cr.Spec.CSISidecarAttacherImage + } + if cr.Spec.CSISidecarResizerImage != "" { + csiSidecarResizerImage = cr.Spec.CSISidecarResizerImage + } + if cr.Spec.CSISidecarSnapshotterImage != "" { + csiSidecarSnapshotterImage = cr.Spec.CSISidecarSnapshotterImage + } + if cr.Spec.CSISidecarNodeDriverRegistrarImage != "" { + csiSidecarNodeDriverRegistrarImage = cr.Spec.CSISidecarNodeDriverRegistrarImage + } + if cr.Spec.CSISidecarLivenessProbeImage != "" { + csiSidecarLivenessProbeImage = cr.Spec.CSISidecarLivenessProbeImage + } + // Setting up the resources if returnError = i.populateResources(cr); returnError != nil { return nil, nil, false, fmt.Errorf("failed parsing resources list specified: \n%w", returnError) @@ -1033,41 +1052,47 @@ func (i *Installer) InstallOrPatchTrident( acpVersion := i.GetACPVersion() identifiedSpecValues := netappv1.TridentOrchestratorSpecValues{ - EnableForceDetach: strconv.FormatBool(enableForceDetach), - DisableAuditLog: strconv.FormatBool(disableAuditLog), - LogFormat: logFormat, - Debug: strconv.FormatBool(debug), - LogLevel: determineLogLevel(), - LogWorkflows: logWorkflows, - LogLayers: logLayers, - TridentImage: tridentImage, - ImageRegistry: imageRegistry, - IPv6: strconv.FormatBool(useIPv6), - SilenceAutosupport: strconv.FormatBool(silenceAutosupport), - ProbePort: probePort, - AutosupportImage: autosupportImage, - AutosupportProxy: autosupportProxy, - AutosupportInsecure: autosupportInsecure, - AutosupportSerialNumber: autosupportSerialNumber, - AutosupportHostname: autosupportHostname, - KubeletDir: kubeletDir, - K8sTimeout: strconv.Itoa(int(k8sTimeout.Seconds())), - HTTPRequestTimeout: httpTimeout, - ImagePullSecrets: imagePullSecrets, - NodePluginNodeSelector: nodePluginNodeSelector, - NodePluginTolerations: nodePluginTolerations, - ImagePullPolicy: imagePullPolicy, - EnableACP: strconv.FormatBool(enableACP), - ACPImage: acpImage, - ISCSISelfHealingInterval: iscsiSelfHealingInterval, - ISCSISelfHealingWaitTime: iscsiSelfHealingWaitTime, - K8sAPIQPS: k8sAPIQPS, - FSGroupPolicy: fsGroupPolicy, - NodePrep: nodePrep, - EnableConcurrency: strconv.FormatBool(enableConcurrency), - Resources: resourcesValues, - HTTPSMetrics: strconv.FormatBool(httpsMetrics), - HostNetwork: hostNetwork, + EnableForceDetach: strconv.FormatBool(enableForceDetach), + DisableAuditLog: strconv.FormatBool(disableAuditLog), + LogFormat: logFormat, + Debug: strconv.FormatBool(debug), + LogLevel: determineLogLevel(), + LogWorkflows: logWorkflows, + LogLayers: logLayers, + TridentImage: tridentImage, + ImageRegistry: imageRegistry, + CSISidecarProvisionerImage: csiSidecarProvisionerImage, + CSISidecarAttacherImage: csiSidecarAttacherImage, + CSISidecarResizerImage: csiSidecarResizerImage, + CSISidecarSnapshotterImage: csiSidecarSnapshotterImage, + CSISidecarNodeDriverRegistrarImage: csiSidecarNodeDriverRegistrarImage, + CSISidecarLivenessProbeImage: csiSidecarLivenessProbeImage, + IPv6: strconv.FormatBool(useIPv6), + SilenceAutosupport: strconv.FormatBool(silenceAutosupport), + ProbePort: probePort, + AutosupportImage: autosupportImage, + AutosupportProxy: autosupportProxy, + AutosupportInsecure: autosupportInsecure, + AutosupportSerialNumber: autosupportSerialNumber, + AutosupportHostname: autosupportHostname, + KubeletDir: kubeletDir, + K8sTimeout: strconv.Itoa(int(k8sTimeout.Seconds())), + HTTPRequestTimeout: httpTimeout, + ImagePullSecrets: imagePullSecrets, + NodePluginNodeSelector: nodePluginNodeSelector, + NodePluginTolerations: nodePluginTolerations, + ImagePullPolicy: imagePullPolicy, + EnableACP: strconv.FormatBool(enableACP), + ACPImage: acpImage, + ISCSISelfHealingInterval: iscsiSelfHealingInterval, + ISCSISelfHealingWaitTime: iscsiSelfHealingWaitTime, + K8sAPIQPS: k8sAPIQPS, + FSGroupPolicy: fsGroupPolicy, + NodePrep: nodePrep, + EnableConcurrency: strconv.FormatBool(enableConcurrency), + Resources: resourcesValues, + HTTPSMetrics: strconv.FormatBool(httpsMetrics), + HostNetwork: hostNetwork, } Log().WithFields(LogFields{ diff --git a/operator/controllers/orchestrator/installer/installer_test.go b/operator/controllers/orchestrator/installer/installer_test.go index aaae743c9..02f5d8697 100644 --- a/operator/controllers/orchestrator/installer/installer_test.go +++ b/operator/controllers/orchestrator/installer/installer_test.go @@ -485,6 +485,48 @@ func TestSetInstallationParams_Images(t *testing.T) { } }) } + + t.Run("CR sidecar images override environment and image registry", func(t *testing.T) { + for _, image := range images { + *image.image = "" + } + for env, image := range images { + t.Setenv(env, image.envval) + } + + expectedProvisionerImage := "cr-registry.example.com/sig-storage/csi-provisioner:v9.9.9" + expectedAttacherImage := "cr-registry.example.com/sig-storage/csi-attacher:v9.9.9" + expectedResizerImage := "cr-registry.example.com/sig-storage/csi-resizer:v9.9.9" + expectedSnapshotterImage := "cr-registry.example.com/sig-storage/csi-snapshotter:v9.9.9" + expectedRegistrarImage := "cr-registry.example.com/sig-storage/csi-node-driver-registrar:v9.9.9" + expectedLivenessProbeImage := "cr-registry.example.com/sig-storage/livenessprobe:v9.9.9" + + to := netappv1.TridentOrchestrator{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{}, + Spec: netappv1.TridentOrchestratorSpec{ + ImageRegistry: "registry-from-cr.example.com", + CSISidecarProvisionerImage: expectedProvisionerImage, + CSISidecarAttacherImage: expectedAttacherImage, + CSISidecarResizerImage: expectedResizerImage, + CSISidecarSnapshotterImage: expectedSnapshotterImage, + CSISidecarNodeDriverRegistrarImage: expectedRegistrarImage, + CSISidecarLivenessProbeImage: expectedLivenessProbeImage, + }, + Status: netappv1.TridentOrchestratorStatus{}, + } + installer := newTestInstaller(mockK8sClient) + + _, _, _, err := installer.setInstallationParams(to, "") + assert.NoError(t, err) + + assert.Equal(t, expectedProvisionerImage, csiSidecarProvisionerImage) + assert.Equal(t, expectedAttacherImage, csiSidecarAttacherImage) + assert.Equal(t, expectedResizerImage, csiSidecarResizerImage) + assert.Equal(t, expectedSnapshotterImage, csiSidecarSnapshotterImage) + assert.Equal(t, expectedRegistrarImage, csiSidecarNodeDriverRegistrarImage) + assert.Equal(t, expectedLivenessProbeImage, csiSidecarLivenessProbeImage) + }) } func TestSetInstallationParams_FSGroupPolicy(t *testing.T) { diff --git a/operator/crd/apis/netapp/v1/types.go b/operator/crd/apis/netapp/v1/types.go index 2072d03e8..ae66e3647 100644 --- a/operator/crd/apis/netapp/v1/types.go +++ b/operator/crd/apis/netapp/v1/types.go @@ -50,52 +50,58 @@ type TridentOrchestratorList struct { // TridentOrchestratorSpec defines the desired state of TridentOrchestrator type TridentOrchestratorSpec struct { - EnableForceDetach bool `json:"enableForceDetach"` - DisableAuditLog *bool `json:"disableAuditLog"` - Namespace string `json:"namespace"` - IPv6 bool `json:"IPv6,omitempty"` - K8sTimeout int `json:"k8sTimeout,omitempty"` - HTTPRequestTimeout string `json:"httpRequestTimeout,omitempty"` - SilenceAutosupport bool `json:"silenceAutosupport,omitempty"` - ExcludeAutosupport *bool `json:"excludeAutosupport,omitempty"` - AutosupportImage string `json:"autosupportImage,omitempty"` - AutosupportProxy string `json:"autosupportProxy,omitempty"` - AutosupportInsecure bool `json:"autosupportInsecure,omitempty"` - AutosupportSerialNumber string `json:"autosupportSerialNumber,omitempty"` - AutosupportHostname string `json:"autosupportHostname,omitempty"` - Uninstall bool `json:"uninstall,omitempty"` - LogFormat string `json:"logFormat,omitempty"` - LogLevel string `json:"logLevel,omitempty"` - Debug bool `json:"debug,omitempty"` - LogWorkflows string `json:"logWorkflows,omitempty"` - LogLayers string `json:"logLayers,omitempty"` - ProbePort *int64 `json:"probePort,omitempty"` - TridentImage string `json:"tridentImage,omitempty"` - ImageRegistry string `json:"imageRegistry,omitempty"` - KubeletDir string `json:"kubeletDir,omitempty"` - Wipeout []string `json:"wipeout,omitempty"` - ImagePullSecrets []string `json:"imagePullSecrets,omitempty"` - ControllerPluginNodeSelector map[string]string `json:"controllerPluginNodeSelector,omitempty"` - ControllerPluginTolerations []Toleration `json:"controllerPluginTolerations,omitempty"` - NodePluginNodeSelector map[string]string `json:"nodePluginNodeSelector,omitempty"` - NodePluginTolerations []Toleration `json:"nodePluginTolerations,omitempty"` - Windows bool `json:"windows,omitempty"` - ImagePullPolicy string `json:"imagePullPolicy,omitempty"` - CloudProvider string `json:"cloudProvider,omitempty"` - CloudIdentity string `json:"cloudIdentity,omitempty"` - EnableACP bool `json:"enableACP,omitempty"` - ACPImage string `json:"acpImage,omitempty"` - EnableAutoBackendConfig bool `json:"enableAutoBackendConfig,omitempty"` - ISCSISelfHealingInterval string `json:"iscsiSelfHealingInterval,omitempty"` - ISCSISelfHealingWaitTime string `json:"iscsiSelfHealingWaitTime,omitempty"` - K8sAPIQPS int `json:"k8sAPIQPS,omitempty"` - FSGroupPolicy string `json:"fsGroupPolicy,omitempty"` - NodePrep []string `json:"nodePrep"` - SkipCRDsToObliviate []string `json:"skipCRDsToObliviate,omitempty"` - EnableConcurrency bool `json:"enableConcurrency,omitempty"` - Resources *Resources `json:"resources,omitempty"` - HTTPSMetrics bool `json:"httpsMetrics,omitempty"` - HostNetwork bool `json:"hostNetwork,omitempty"` + EnableForceDetach bool `json:"enableForceDetach"` + DisableAuditLog *bool `json:"disableAuditLog"` + Namespace string `json:"namespace"` + IPv6 bool `json:"IPv6,omitempty"` + K8sTimeout int `json:"k8sTimeout,omitempty"` + HTTPRequestTimeout string `json:"httpRequestTimeout,omitempty"` + SilenceAutosupport bool `json:"silenceAutosupport,omitempty"` + ExcludeAutosupport *bool `json:"excludeAutosupport,omitempty"` + AutosupportImage string `json:"autosupportImage,omitempty"` + AutosupportProxy string `json:"autosupportProxy,omitempty"` + AutosupportInsecure bool `json:"autosupportInsecure,omitempty"` + AutosupportSerialNumber string `json:"autosupportSerialNumber,omitempty"` + AutosupportHostname string `json:"autosupportHostname,omitempty"` + Uninstall bool `json:"uninstall,omitempty"` + LogFormat string `json:"logFormat,omitempty"` + LogLevel string `json:"logLevel,omitempty"` + Debug bool `json:"debug,omitempty"` + LogWorkflows string `json:"logWorkflows,omitempty"` + LogLayers string `json:"logLayers,omitempty"` + ProbePort *int64 `json:"probePort,omitempty"` + TridentImage string `json:"tridentImage,omitempty"` + ImageRegistry string `json:"imageRegistry,omitempty"` + CSISidecarProvisionerImage string `json:"csiSidecarProvisionerImage,omitempty"` + CSISidecarAttacherImage string `json:"csiSidecarAttacherImage,omitempty"` + CSISidecarResizerImage string `json:"csiSidecarResizerImage,omitempty"` + CSISidecarSnapshotterImage string `json:"csiSidecarSnapshotterImage,omitempty"` + CSISidecarNodeDriverRegistrarImage string `json:"csiSidecarNodeDriverRegistrarImage,omitempty"` + CSISidecarLivenessProbeImage string `json:"csiSidecarLivenessProbeImage,omitempty"` + KubeletDir string `json:"kubeletDir,omitempty"` + Wipeout []string `json:"wipeout,omitempty"` + ImagePullSecrets []string `json:"imagePullSecrets,omitempty"` + ControllerPluginNodeSelector map[string]string `json:"controllerPluginNodeSelector,omitempty"` + ControllerPluginTolerations []Toleration `json:"controllerPluginTolerations,omitempty"` + NodePluginNodeSelector map[string]string `json:"nodePluginNodeSelector,omitempty"` + NodePluginTolerations []Toleration `json:"nodePluginTolerations,omitempty"` + Windows bool `json:"windows,omitempty"` + ImagePullPolicy string `json:"imagePullPolicy,omitempty"` + CloudProvider string `json:"cloudProvider,omitempty"` + CloudIdentity string `json:"cloudIdentity,omitempty"` + EnableACP bool `json:"enableACP,omitempty"` + ACPImage string `json:"acpImage,omitempty"` + EnableAutoBackendConfig bool `json:"enableAutoBackendConfig,omitempty"` + ISCSISelfHealingInterval string `json:"iscsiSelfHealingInterval,omitempty"` + ISCSISelfHealingWaitTime string `json:"iscsiSelfHealingWaitTime,omitempty"` + K8sAPIQPS int `json:"k8sAPIQPS,omitempty"` + FSGroupPolicy string `json:"fsGroupPolicy,omitempty"` + NodePrep []string `json:"nodePrep"` + SkipCRDsToObliviate []string `json:"skipCRDsToObliviate,omitempty"` + EnableConcurrency bool `json:"enableConcurrency,omitempty"` + Resources *Resources `json:"resources,omitempty"` + HTTPSMetrics bool `json:"httpsMetrics,omitempty"` + HostNetwork bool `json:"hostNetwork,omitempty"` } // Toleration @@ -166,41 +172,47 @@ type TridentOrchestratorStatus struct { } type TridentOrchestratorSpecValues struct { - EnableForceDetach string `json:"enableForceDetach"` - DisableAuditLog string `json:"disableAuditLog"` - IPv6 string `json:"IPv6"` - SilenceAutosupport string `json:"silenceAutosupport"` - AutosupportImage string `json:"autosupportImage"` - AutosupportProxy string `json:"autosupportProxy"` - AutosupportInsecure bool `json:"autosupportInsecure"` - AutosupportSerialNumber string `json:"autosupportSerialNumber"` - AutosupportHostname string `json:"autosupportHostname"` - K8sTimeout string `json:"k8sTimeout"` - HTTPRequestTimeout string `json:"httpRequestTimeout"` - LogFormat string `json:"logFormat"` - LogLevel string `json:"logLevel"` - Debug string `json:"debug"` - LogWorkflows string `json:"logWorkflows"` - LogLayers string `json:"logLayers"` - ProbePort string `json:"probePort"` - TridentImage string `json:"tridentImage"` - ImageRegistry string `json:"imageRegistry"` - KubeletDir string `json:"kubeletDir"` - ImagePullSecrets []string `json:"imagePullSecrets"` - NodePluginNodeSelector map[string]string `json:"nodePluginNodeSelector,omitempty"` - NodePluginTolerations []Toleration `json:"nodePluginTolerations,omitempty"` - ImagePullPolicy string `json:"imagePullPolicy"` - EnableACP string `json:"enableACP"` - ACPImage string `json:"acpImage"` - ISCSISelfHealingInterval string `json:"iscsiSelfHealingInterval"` - ISCSISelfHealingWaitTime string `json:"iscsiSelfHealingWaitTime"` - K8sAPIQPS int `json:"k8sAPIQPS,omitempty"` - FSGroupPolicy string `json:"fsGroupPolicy,omitempty"` - NodePrep []string `json:"nodePrep"` - EnableConcurrency string `json:"enableConcurrency"` - Resources *config.Resources `json:"resources,omitempty"` - HTTPSMetrics string `json:"httpsMetrics"` - HostNetwork bool `json:"hostNetwork"` + EnableForceDetach string `json:"enableForceDetach"` + DisableAuditLog string `json:"disableAuditLog"` + IPv6 string `json:"IPv6"` + SilenceAutosupport string `json:"silenceAutosupport"` + AutosupportImage string `json:"autosupportImage"` + AutosupportProxy string `json:"autosupportProxy"` + AutosupportInsecure bool `json:"autosupportInsecure"` + AutosupportSerialNumber string `json:"autosupportSerialNumber"` + AutosupportHostname string `json:"autosupportHostname"` + K8sTimeout string `json:"k8sTimeout"` + HTTPRequestTimeout string `json:"httpRequestTimeout"` + LogFormat string `json:"logFormat"` + LogLevel string `json:"logLevel"` + Debug string `json:"debug"` + LogWorkflows string `json:"logWorkflows"` + LogLayers string `json:"logLayers"` + ProbePort string `json:"probePort"` + TridentImage string `json:"tridentImage"` + ImageRegistry string `json:"imageRegistry"` + CSISidecarProvisionerImage string `json:"csiSidecarProvisionerImage,omitempty"` + CSISidecarAttacherImage string `json:"csiSidecarAttacherImage,omitempty"` + CSISidecarResizerImage string `json:"csiSidecarResizerImage,omitempty"` + CSISidecarSnapshotterImage string `json:"csiSidecarSnapshotterImage,omitempty"` + CSISidecarNodeDriverRegistrarImage string `json:"csiSidecarNodeDriverRegistrarImage,omitempty"` + CSISidecarLivenessProbeImage string `json:"csiSidecarLivenessProbeImage,omitempty"` + KubeletDir string `json:"kubeletDir"` + ImagePullSecrets []string `json:"imagePullSecrets"` + NodePluginNodeSelector map[string]string `json:"nodePluginNodeSelector,omitempty"` + NodePluginTolerations []Toleration `json:"nodePluginTolerations,omitempty"` + ImagePullPolicy string `json:"imagePullPolicy"` + EnableACP string `json:"enableACP"` + ACPImage string `json:"acpImage"` + ISCSISelfHealingInterval string `json:"iscsiSelfHealingInterval"` + ISCSISelfHealingWaitTime string `json:"iscsiSelfHealingWaitTime"` + K8sAPIQPS int `json:"k8sAPIQPS,omitempty"` + FSGroupPolicy string `json:"fsGroupPolicy,omitempty"` + NodePrep []string `json:"nodePrep"` + EnableConcurrency string `json:"enableConcurrency"` + Resources *config.Resources `json:"resources,omitempty"` + HTTPSMetrics string `json:"httpsMetrics"` + HostNetwork bool `json:"hostNetwork"` } /************************