Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
Remove duplicate assignment of gatewayDiffObj
Remove alwaysUpdateCertificate mutate function (Come back to this, we
should be trying to use this pattern in all our policies, not removing
it.)
  • Loading branch information
mikenairn committed Nov 2, 2023
1 parent a75da13 commit 4df7444
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
8 changes: 2 additions & 6 deletions pkg/controllers/dnspolicy/dnspolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ func (r *DNSPolicyReconciler) reconcileResources(ctx context.Context, dnsPolicy
func (r *DNSPolicyReconciler) deleteResources(ctx context.Context, dnsPolicy *v1alpha1.DNSPolicy, targetNetworkObject client.Object) error {
// delete based on gateway diffs

gatewayDiffObj, err := r.ComputeGatewayDiffs(ctx, dnsPolicy, targetNetworkObject, &DNSPolicyRefsConfig{})
if err != nil {
return err
}
if err = r.deleteDNSRecords(ctx, dnsPolicy); err != nil {
if err := r.deleteDNSRecords(ctx, dnsPolicy); err != nil {
log.V(3).Info("error reconciling DNS records from delete, returning", "error", err)
return err
}
Expand All @@ -211,7 +207,7 @@ func (r *DNSPolicyReconciler) deleteResources(ctx context.Context, dnsPolicy *v1
}
}

gatewayDiffObj, err = r.ComputeGatewayDiffs(ctx, dnsPolicy, targetNetworkObject, &DNSPolicyRefsConfig{})
gatewayDiffObj, err := r.ComputeGatewayDiffs(ctx, dnsPolicy, targetNetworkObject, &DNSPolicyRefsConfig{})
if err != nil {
return err
}
Expand Down
19 changes: 0 additions & 19 deletions pkg/controllers/tlspolicy/tlspolicy_certmanager_certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package tlspolicy
import (
"context"
"fmt"
"reflect"

certmanv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1"

Expand Down Expand Up @@ -190,21 +189,3 @@ func gatewayTLSCertificateLabels(gwKey client.ObjectKey) map[string]string {
"gateway": gwKey.Name,
}
}

func alwaysUpdateCertificate(existingObj, desiredObj client.Object) (bool, error) {
existing, ok := existingObj.(*certmanv1.Certificate)
if !ok {
return false, fmt.Errorf("%T is not a *certmanv1.Certificate", existingObj)
}
desired, ok := desiredObj.(*certmanv1.Certificate)
if !ok {
return false, fmt.Errorf("%T is not an *certmanv1.Certificate", desiredObj)
}

if reflect.DeepEqual(existing.Spec, desired.Spec) {
return false, nil
}
existing.Spec = desired.Spec

return true, nil
}

0 comments on commit 4df7444

Please sign in to comment.