From 7680273adaaa9902be0f68b541aa485d25b3d1fb Mon Sep 17 00:00:00 2001 From: badri-pathak Date: Wed, 10 Sep 2025 05:06:08 +0530 Subject: [PATCH] fixed issue 9482 - adding cso failed status on error for cacert Signed-off-by: badri-pathak --- operator/controllers/csiscaleoperator_controller.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/operator/controllers/csiscaleoperator_controller.go b/operator/controllers/csiscaleoperator_controller.go index e18da631a..57f582112 100644 --- a/operator/controllers/csiscaleoperator_controller.go +++ b/operator/controllers/csiscaleoperator_controller.go @@ -1911,9 +1911,15 @@ func (r *CSIScaleOperatorReconciler) newConnector(ctx context.Context, instance } caCertPool := x509.NewCertPool() - for k, v := range configMap.Data { + for _, v := range configMap.Data { if ok := caCertPool.AppendCertsFromPEM([]byte(v)); !ok { - return nil, fmt.Errorf("parsing CA cert %v failed for CertName %v", cluster.Cacert, k) + message := fmt.Sprintf("Failed to parse the GUI CA certificates from the ConfigMap %s", cluster.Cacert) + parseErr := fmt.Errorf(message) + logger.Error(parseErr, message) + SetStatusAndRaiseEvent(instance, r.Recorder, corev1.EventTypeWarning, string(config.StatusConditionSuccess), + metav1.ConditionFalse, string(csiv1.GetFailed), message, + ) + return nil, parseErr } } tr = &http.Transport{TLSClientConfig: &tls.Config{RootCAs: caCertPool, MinVersion: tls.VersionTLS12}}