Skip to content

Commit

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

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

if cr.Spec.SSLSecretName != "" && err == nil {
// don't create secret ssl-internal if secret ssl is not created by operator
if errSecret == nil && !metav1.IsControlledBy(&secretObj, cr) {
return nil
}

err = r.ensureSSLByCertManager(ctx, cr)
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 6469171

Please sign in to comment.