Skip to content

Commit

Permalink
fix deletion of custom ssl secret by finalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
nmarukovich committed Aug 18, 2024
1 parent c3a4424 commit 0c707ac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/controller/ps/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ import (
func (r *PerconaServerMySQLReconciler) ensureTLSSecret(ctx context.Context, cr *apiv1alpha1.PerconaServerMySQL) error {
log := logf.FromContext(ctx)

err := r.ensureSSLByCertManager(ctx, cr)
secret := &corev1.Secret{}
err := r.Client.Get(ctx, types.NamespacedName{
Namespace: cr.Namespace,
Name: cr.Spec.SSLSecretName,
}, secret)

if cr.Spec.SSLSecretName != "" && err == nil {
return nil
}

err = r.ensureSSLByCertManager(ctx, cr)
if err != nil {
if cr.Spec.TLS != nil && cr.Spec.TLS.IssuerConf != nil {
log.Error(err, fmt.Sprintf("Failed to ensure certificate by cert-manager. Check `.spec.tls.issuerConf` in PerconaServerMySQL %s/%s", cr.Namespace, cr.Name))
Expand Down

0 comments on commit 0c707ac

Please sign in to comment.