Skip to content

Commit

Permalink
Add the filepath to the CSO CSI certificate info
Browse files Browse the repository at this point in the history
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 <brcox@redhat.com>
  • Loading branch information
bryan-cox committed Dec 17, 2024
1 parent a1e7852 commit b175cdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit b175cdc

Please sign in to comment.