Skip to content

Commit 92095c9

Browse files
committed
feat(azure): pass HYPERSHIFT_IMAGE for self-managed clusters only
Add conditional logic to pass HYPERSHIFT_IMAGE environment variable to Azure Disk and Azure File CSI driver operators only when running on self-managed Azure HyperShift clusters. For ARO HCP deployments, the Secret Provider Class pattern is used instead of token-minter, so HYPERSHIFT_IMAGE is not needed. This change detects ARO HCP mode by checking for the presence of ARO_HCP_SECRET_PROVIDER_CLASS_FOR_* environment variables. Signed-off-by: Bryan Cox <brcox@redhat.com> Commit-Message-Assisted-by: Claude (via Claude Code)
1 parent 0c5bde9 commit 92095c9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/operator/csidriveroperator/hypershift_deployment_controller.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ func (c *HyperShiftDeploymentController) Sync(ctx context.Context, syncCtx facto
156156
}
157157
}
158158

159+
// For self-managed Azure (not ARO HCP), pass HYPERSHIFT_IMAGE to enable token-minter sidecars
160+
if os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_DISK") == "" && requiredCopy.Name == "azure-disk-csi-driver-operator" {
161+
if hyperShiftImage := os.Getenv("HYPERSHIFT_IMAGE"); hyperShiftImage != "" {
162+
envVars = append(envVars, corev1.EnvVar{Name: "HYPERSHIFT_IMAGE", Value: hyperShiftImage})
163+
}
164+
}
165+
166+
if os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE") == "" && requiredCopy.Name == "azure-file-csi-driver-operator" {
167+
if hyperShiftImage := os.Getenv("HYPERSHIFT_IMAGE"); hyperShiftImage != "" {
168+
envVars = append(envVars, corev1.EnvVar{Name: "HYPERSHIFT_IMAGE", Value: hyperShiftImage})
169+
}
170+
}
171+
159172
if len(envVars) > 0 {
160173
requiredCopy.Spec.Template.Spec.Containers[0].Env = append(requiredCopy.Spec.Template.Spec.Containers[0].Env, envVars...)
161174
}

0 commit comments

Comments
 (0)