Skip to content

Commit

Permalink
remove redundant else
Browse files Browse the repository at this point in the history
Signed-off-by: pjuarezd <[email protected]>
  • Loading branch information
pjuarezd committed May 24, 2024
1 parent 1e336a1 commit fbefa26
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,16 @@ func (c *Controller) trustIfChanged(newSecret *corev1.Secret, oldSecret *corev1.
if err := c.addTLSCertificatesToTrustInTransport(newPublicCert); err == nil {
klog.Infof("Added certificates in field '%s' of '%s/%s' secret to trusted RootCA's", fieldToCompare, newSecret.Namespace, newSecret.Name)
return true
} else {
klog.Errorf("Failed adding certs in field '%s' of '%s/%s' secret: %v", fieldToCompare, newSecret.Namespace, newSecret.Name, err)
}
klog.Errorf("Failed adding certs in field '%s' of '%s/%s' secret: %v", fieldToCompare, newSecret.Namespace, newSecret.Name, err)
}
} else {
// If filed was not present in old secret but is in new secret then is an addition, we trust it
if err := c.addTLSCertificatesToTrustInTransport(newPublicCert); err == nil {
klog.Infof("Added certificates in field '%s' of '%s/%s' secret to trusted RootCA's", fieldToCompare, newSecret.Namespace, newSecret.Name)
return true
} else {
klog.Errorf("Failed adding certs in field %s of '%s/%s' secret: %v", fieldToCompare, newSecret.Namespace, newSecret.Name, err)
}
klog.Errorf("Failed adding certs in field %s of '%s/%s' secret: %v", fieldToCompare, newSecret.Namespace, newSecret.Name, err)
}
}
return false
Expand All @@ -271,9 +269,8 @@ func (c *Controller) trustPEMInSecretField(secret *corev1.Secret, fieldToCompare
if err := c.addTLSCertificatesToTrustInTransport(newPublicCert); err == nil {
klog.Infof("Added certificates in field '%s' of '%s/%s' secret to trusted RootCA's", fieldToCompare, secret.Namespace, secret.Name)
return true
} else {
klog.Errorf("Failed adding certs in field '%s' of '%s/%s' secret: %v", fieldToCompare, secret.Namespace, secret.Name, err)
}
klog.Errorf("Failed adding certs in field '%s' of '%s/%s' secret: %v", fieldToCompare, secret.Namespace, secret.Name, err)
}
return false
}
Expand Down

0 comments on commit fbefa26

Please sign in to comment.