Skip to content

Commit 08c3c4e

Browse files
committed
Expose CSI sidecar images in TridentOrchestrator
1 parent 4632ded commit 08c3c4e

6 files changed

Lines changed: 237 additions & 116 deletions

File tree

deploy/crds/tridentorchestrator_cr_customimage.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ spec:
66
debug: true
77
namespace: trident
88
tridentImage: localhost:5000/netapp/trident:26.10
9+
csiSidecarProvisionerImage: localhost:5000/sig-storage/csi-provisioner:v6.3.0
10+
csiSidecarAttacherImage: localhost:5000/sig-storage/csi-attacher:v4.11.0
11+
csiSidecarResizerImage: localhost:5000/sig-storage/csi-resizer:v2.1.0
12+
csiSidecarSnapshotterImage: localhost:5000/sig-storage/csi-snapshotter:v8.6.0
13+
csiSidecarNodeDriverRegistrarImage: localhost:5000/sig-storage/csi-node-driver-registrar:v2.17.0
14+
csiSidecarLivenessProbeImage: localhost:5000/sig-storage/livenessprobe:v2.19.0

helm/trident-operator/templates/tridentorchestrator.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ spec:
3030
{{- if .Values.imageRegistry }}
3131
imageRegistry: {{ .Values.imageRegistry }}
3232
{{- end }}
33+
{{- if .Values.csiSidecarProvisionerImage }}
34+
csiSidecarProvisionerImage: {{ .Values.csiSidecarProvisionerImage }}
35+
{{- end }}
36+
{{- if .Values.csiSidecarAttacherImage }}
37+
csiSidecarAttacherImage: {{ .Values.csiSidecarAttacherImage }}
38+
{{- end }}
39+
{{- if .Values.csiSidecarResizerImage }}
40+
csiSidecarResizerImage: {{ .Values.csiSidecarResizerImage }}
41+
{{- end }}
42+
{{- if .Values.csiSidecarSnapshotterImage }}
43+
csiSidecarSnapshotterImage: {{ .Values.csiSidecarSnapshotterImage }}
44+
{{- end }}
45+
{{- if .Values.csiSidecarNodeDriverRegistrarImage }}
46+
csiSidecarNodeDriverRegistrarImage: {{ .Values.csiSidecarNodeDriverRegistrarImage }}
47+
{{- end }}
48+
{{- if .Values.csiSidecarLivenessProbeImage }}
49+
csiSidecarLivenessProbeImage: {{ .Values.csiSidecarLivenessProbeImage }}
50+
{{- end }}
3351
kubeletDir: {{ .Values.kubeletDir }}
3452
{{- with .Values.imagePullSecrets }}
3553
imagePullSecrets:

helm/trident-operator/values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,24 @@ tridentImage: ""
130130
# tridentImageTag allows overriding the tag of the image for Trident.
131131
tridentImageTag: ""
132132

133+
# csiSidecarProvisionerImage allows the complete override of the CSI provisioner sidecar image.
134+
csiSidecarProvisionerImage: ""
135+
136+
# csiSidecarAttacherImage allows the complete override of the CSI attacher sidecar image.
137+
csiSidecarAttacherImage: ""
138+
139+
# csiSidecarResizerImage allows the complete override of the CSI resizer sidecar image.
140+
csiSidecarResizerImage: ""
141+
142+
# csiSidecarSnapshotterImage allows the complete override of the CSI snapshotter sidecar image.
143+
csiSidecarSnapshotterImage: ""
144+
145+
# csiSidecarNodeDriverRegistrarImage allows the complete override of the CSI node-driver-registrar sidecar image.
146+
csiSidecarNodeDriverRegistrarImage: ""
147+
148+
# csiSidecarLivenessProbeImage allows the complete override of the CSI liveness probe sidecar image.
149+
csiSidecarLivenessProbeImage: ""
150+
133151
# (Deprecated) tridentEnableNodePrep attempts to automatically install required packages on nodes.
134152
tridentEnableNodePrep: false
135153

operator/controllers/orchestrator/installer/installer.go

Lines changed: 60 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,25 @@ func (i *Installer) setInstallationParams(
726726
}
727727
}
728728

729+
if cr.Spec.CSISidecarProvisionerImage != "" {
730+
csiSidecarProvisionerImage = cr.Spec.CSISidecarProvisionerImage
731+
}
732+
if cr.Spec.CSISidecarAttacherImage != "" {
733+
csiSidecarAttacherImage = cr.Spec.CSISidecarAttacherImage
734+
}
735+
if cr.Spec.CSISidecarResizerImage != "" {
736+
csiSidecarResizerImage = cr.Spec.CSISidecarResizerImage
737+
}
738+
if cr.Spec.CSISidecarSnapshotterImage != "" {
739+
csiSidecarSnapshotterImage = cr.Spec.CSISidecarSnapshotterImage
740+
}
741+
if cr.Spec.CSISidecarNodeDriverRegistrarImage != "" {
742+
csiSidecarNodeDriverRegistrarImage = cr.Spec.CSISidecarNodeDriverRegistrarImage
743+
}
744+
if cr.Spec.CSISidecarLivenessProbeImage != "" {
745+
csiSidecarLivenessProbeImage = cr.Spec.CSISidecarLivenessProbeImage
746+
}
747+
729748
// Setting up the resources
730749
if returnError = i.populateResources(cr); returnError != nil {
731750
return nil, nil, false, fmt.Errorf("failed parsing resources list specified: \n%w", returnError)
@@ -1033,41 +1052,47 @@ func (i *Installer) InstallOrPatchTrident(
10331052
acpVersion := i.GetACPVersion()
10341053

10351054
identifiedSpecValues := netappv1.TridentOrchestratorSpecValues{
1036-
EnableForceDetach: strconv.FormatBool(enableForceDetach),
1037-
DisableAuditLog: strconv.FormatBool(disableAuditLog),
1038-
LogFormat: logFormat,
1039-
Debug: strconv.FormatBool(debug),
1040-
LogLevel: determineLogLevel(),
1041-
LogWorkflows: logWorkflows,
1042-
LogLayers: logLayers,
1043-
TridentImage: tridentImage,
1044-
ImageRegistry: imageRegistry,
1045-
IPv6: strconv.FormatBool(useIPv6),
1046-
SilenceAutosupport: strconv.FormatBool(silenceAutosupport),
1047-
ProbePort: probePort,
1048-
AutosupportImage: autosupportImage,
1049-
AutosupportProxy: autosupportProxy,
1050-
AutosupportInsecure: autosupportInsecure,
1051-
AutosupportSerialNumber: autosupportSerialNumber,
1052-
AutosupportHostname: autosupportHostname,
1053-
KubeletDir: kubeletDir,
1054-
K8sTimeout: strconv.Itoa(int(k8sTimeout.Seconds())),
1055-
HTTPRequestTimeout: httpTimeout,
1056-
ImagePullSecrets: imagePullSecrets,
1057-
NodePluginNodeSelector: nodePluginNodeSelector,
1058-
NodePluginTolerations: nodePluginTolerations,
1059-
ImagePullPolicy: imagePullPolicy,
1060-
EnableACP: strconv.FormatBool(enableACP),
1061-
ACPImage: acpImage,
1062-
ISCSISelfHealingInterval: iscsiSelfHealingInterval,
1063-
ISCSISelfHealingWaitTime: iscsiSelfHealingWaitTime,
1064-
K8sAPIQPS: k8sAPIQPS,
1065-
FSGroupPolicy: fsGroupPolicy,
1066-
NodePrep: nodePrep,
1067-
EnableConcurrency: strconv.FormatBool(enableConcurrency),
1068-
Resources: resourcesValues,
1069-
HTTPSMetrics: strconv.FormatBool(httpsMetrics),
1070-
HostNetwork: hostNetwork,
1055+
EnableForceDetach: strconv.FormatBool(enableForceDetach),
1056+
DisableAuditLog: strconv.FormatBool(disableAuditLog),
1057+
LogFormat: logFormat,
1058+
Debug: strconv.FormatBool(debug),
1059+
LogLevel: determineLogLevel(),
1060+
LogWorkflows: logWorkflows,
1061+
LogLayers: logLayers,
1062+
TridentImage: tridentImage,
1063+
ImageRegistry: imageRegistry,
1064+
CSISidecarProvisionerImage: csiSidecarProvisionerImage,
1065+
CSISidecarAttacherImage: csiSidecarAttacherImage,
1066+
CSISidecarResizerImage: csiSidecarResizerImage,
1067+
CSISidecarSnapshotterImage: csiSidecarSnapshotterImage,
1068+
CSISidecarNodeDriverRegistrarImage: csiSidecarNodeDriverRegistrarImage,
1069+
CSISidecarLivenessProbeImage: csiSidecarLivenessProbeImage,
1070+
IPv6: strconv.FormatBool(useIPv6),
1071+
SilenceAutosupport: strconv.FormatBool(silenceAutosupport),
1072+
ProbePort: probePort,
1073+
AutosupportImage: autosupportImage,
1074+
AutosupportProxy: autosupportProxy,
1075+
AutosupportInsecure: autosupportInsecure,
1076+
AutosupportSerialNumber: autosupportSerialNumber,
1077+
AutosupportHostname: autosupportHostname,
1078+
KubeletDir: kubeletDir,
1079+
K8sTimeout: strconv.Itoa(int(k8sTimeout.Seconds())),
1080+
HTTPRequestTimeout: httpTimeout,
1081+
ImagePullSecrets: imagePullSecrets,
1082+
NodePluginNodeSelector: nodePluginNodeSelector,
1083+
NodePluginTolerations: nodePluginTolerations,
1084+
ImagePullPolicy: imagePullPolicy,
1085+
EnableACP: strconv.FormatBool(enableACP),
1086+
ACPImage: acpImage,
1087+
ISCSISelfHealingInterval: iscsiSelfHealingInterval,
1088+
ISCSISelfHealingWaitTime: iscsiSelfHealingWaitTime,
1089+
K8sAPIQPS: k8sAPIQPS,
1090+
FSGroupPolicy: fsGroupPolicy,
1091+
NodePrep: nodePrep,
1092+
EnableConcurrency: strconv.FormatBool(enableConcurrency),
1093+
Resources: resourcesValues,
1094+
HTTPSMetrics: strconv.FormatBool(httpsMetrics),
1095+
HostNetwork: hostNetwork,
10711096
}
10721097

10731098
Log().WithFields(LogFields{

operator/controllers/orchestrator/installer/installer_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,48 @@ func TestSetInstallationParams_Images(t *testing.T) {
485485
}
486486
})
487487
}
488+
489+
t.Run("CR sidecar images override environment and image registry", func(t *testing.T) {
490+
for _, image := range images {
491+
*image.image = ""
492+
}
493+
for env, image := range images {
494+
t.Setenv(env, image.envval)
495+
}
496+
497+
expectedProvisionerImage := "cr-registry.example.com/sig-storage/csi-provisioner:v9.9.9"
498+
expectedAttacherImage := "cr-registry.example.com/sig-storage/csi-attacher:v9.9.9"
499+
expectedResizerImage := "cr-registry.example.com/sig-storage/csi-resizer:v9.9.9"
500+
expectedSnapshotterImage := "cr-registry.example.com/sig-storage/csi-snapshotter:v9.9.9"
501+
expectedRegistrarImage := "cr-registry.example.com/sig-storage/csi-node-driver-registrar:v9.9.9"
502+
expectedLivenessProbeImage := "cr-registry.example.com/sig-storage/livenessprobe:v9.9.9"
503+
504+
to := netappv1.TridentOrchestrator{
505+
TypeMeta: metav1.TypeMeta{},
506+
ObjectMeta: metav1.ObjectMeta{},
507+
Spec: netappv1.TridentOrchestratorSpec{
508+
ImageRegistry: "registry-from-cr.example.com",
509+
CSISidecarProvisionerImage: expectedProvisionerImage,
510+
CSISidecarAttacherImage: expectedAttacherImage,
511+
CSISidecarResizerImage: expectedResizerImage,
512+
CSISidecarSnapshotterImage: expectedSnapshotterImage,
513+
CSISidecarNodeDriverRegistrarImage: expectedRegistrarImage,
514+
CSISidecarLivenessProbeImage: expectedLivenessProbeImage,
515+
},
516+
Status: netappv1.TridentOrchestratorStatus{},
517+
}
518+
installer := newTestInstaller(mockK8sClient)
519+
520+
_, _, _, err := installer.setInstallationParams(to, "")
521+
assert.NoError(t, err)
522+
523+
assert.Equal(t, expectedProvisionerImage, csiSidecarProvisionerImage)
524+
assert.Equal(t, expectedAttacherImage, csiSidecarAttacherImage)
525+
assert.Equal(t, expectedResizerImage, csiSidecarResizerImage)
526+
assert.Equal(t, expectedSnapshotterImage, csiSidecarSnapshotterImage)
527+
assert.Equal(t, expectedRegistrarImage, csiSidecarNodeDriverRegistrarImage)
528+
assert.Equal(t, expectedLivenessProbeImage, csiSidecarLivenessProbeImage)
529+
})
488530
}
489531

490532
func TestSetInstallationParams_FSGroupPolicy(t *testing.T) {

0 commit comments

Comments
 (0)