From 507c6f6e67bf9dbccdcdf0a293540181f67c6573 Mon Sep 17 00:00:00 2001 From: jjaferson Date: Thu, 28 Apr 2022 12:13:44 -0300 Subject: [PATCH] fixes panic error when TLSEnabled flag is not set --- controllers/authorino_controller.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/controllers/authorino_controller.go b/controllers/authorino_controller.go index 1153fd7..b02f56b 100644 --- a/controllers/authorino_controller.go +++ b/controllers/authorino_controller.go @@ -668,13 +668,15 @@ func (r *AuthorinoReconciler) installationPreflightCheck(authorino *api.Authorin } for authServerName, tlsCert := range tlsCerts { + tlsEnabled := tlsCert.Enabled == nil || *tlsCert.Enabled + if tlsEnabled { + if tlsCert.CertSecret == nil { + return r.wrapErrorWithStatusUpdate( + r.Log, authorino, r.setStatusFailed(api.AuthorinoTlsSecretNotProvided), + fmt.Errorf("%s secret with tls cert not provided", authServerName), + ) + } - if tlsEnabled := tlsCert.Enabled; tlsEnabled == nil && tlsCert.CertSecret == nil { - return r.wrapErrorWithStatusUpdate( - r.Log, authorino, r.setStatusFailed(api.AuthorinoTlsSecretNotProvided), - fmt.Errorf("%s secret with tls cert not provided", authServerName), - ) - } else if *tlsEnabled { secretName := tlsCert.CertSecret.Name nsdName := namespacedName(authorino.Namespace, secretName) if err := r.Get(context.TODO(), nsdName, &k8score.Secret{}); err != nil { @@ -690,7 +692,6 @@ func (r *AuthorinoReconciler) installationPreflightCheck(authorino *api.Authorin ) } } - } return nil }