From b175cdcd38a43f6ee03227fc1f8b0aca0a277d46 Mon Sep 17 00:00:00 2001 From: Bryan Cox Date: Tue, 17 Dec 2024 08:20:57 -0500 Subject: [PATCH] Add the filepath to the CSO CSI certificate info This commit adds the file path with the certificate name for the CSO CSI secret reconciliation for managed azure deployments. Signed-off-by: Bryan Cox --- .../hostedcontrolplane/hostedcontrolplane_controller.go | 2 +- .../controllers/hostedcontrolplane/storage/azure.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go index cf065a6c81..2fbee8dd38 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go +++ b/control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go @@ -5074,7 +5074,7 @@ func (r *HostedControlPlaneReconciler) reconcileClusterStorageOperator(ctx conte // Reconcile the secret needed for azure-disk-csi-controller // This is related to https://github.com/openshift/csi-operator/pull/290. azureFileCSISecret := manifests.AzureFileConfigWithCredentials(hcp.Namespace) - if _, err := createOrUpdate(ctx, r, azureDiskCSISecret, func() error { + if _, err := createOrUpdate(ctx, r, azureFileCSISecret, func() error { return storage.ReconcileAzureFileCSISecret(azureFileCSISecret, hcp, tenantID) }); err != nil { return fmt.Errorf("failed to reconcile Azure File CSI config: %w", err) diff --git a/control-plane-operator/controllers/hostedcontrolplane/storage/azure.go b/control-plane-operator/controllers/hostedcontrolplane/storage/azure.go index e77cc9afc2..e8001ced8d 100644 --- a/control-plane-operator/controllers/hostedcontrolplane/storage/azure.go +++ b/control-plane-operator/controllers/hostedcontrolplane/storage/azure.go @@ -3,9 +3,11 @@ package storage import ( "encoding/json" "fmt" + "path" hyperv1 "github.com/openshift/hypershift/api/hypershift/v1beta1" "github.com/openshift/hypershift/control-plane-operator/controllers/hostedcontrolplane/cloud/azure" + hypershiftconfig "github.com/openshift/hypershift/support/config" corev1 "k8s.io/api/core/v1" ) @@ -28,7 +30,7 @@ func initializeAzureCSIControllerConfig(hcp *hyperv1.HostedControlPlane, tenantI func ReconcileAzureDiskCSISecret(secret *corev1.Secret, hcp *hyperv1.HostedControlPlane, tenantID string) error { config := initializeAzureCSIControllerConfig(hcp, tenantID) config.AADClientID = hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.Disk.ClientID - config.AADClientCertPath = hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.Disk.CertificateName + config.AADClientCertPath = path.Join(hypershiftconfig.ManagedAzureCertificatePath, hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.Disk.CertificateName) serializedConfig, err := json.MarshalIndent(config, "", " ") if err != nil { @@ -46,7 +48,7 @@ func ReconcileAzureDiskCSISecret(secret *corev1.Secret, hcp *hyperv1.HostedContr func ReconcileAzureFileCSISecret(secret *corev1.Secret, hcp *hyperv1.HostedControlPlane, tenantID string) error { config := initializeAzureCSIControllerConfig(hcp, tenantID) config.AADClientID = hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.File.ClientID - config.AADClientCertPath = hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.File.CertificateName + config.AADClientCertPath = path.Join(hypershiftconfig.ManagedAzureCertificatePath, hcp.Spec.Platform.Azure.ManagedIdentities.ControlPlane.File.CertificateName) serializedConfig, err := json.MarshalIndent(config, "", " ") if err != nil {