Skip to content

Commit

Permalink
fixup: filter for tls policies when looping over policies
Browse files Browse the repository at this point in the history
Signed-off-by: KevFan <[email protected]>
  • Loading branch information
KevFan committed Oct 21, 2024
1 parent ae206ee commit c986a25
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions controllers/effective_tls_policies_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ func (t *EffectiveTLSPoliciesReconciler) Reconcile(ctx context.Context, _ []cont
})

var expectedCerts []*certmanv1.Certificate
filterForTLSPolicies := func(p machinery.Policy, _ int) bool {
_, ok := p.(*kuadrantv1alpha1.TLSPolicy)
return ok
}

for _, listener := range listeners {
l := listener.(*machinery.Listener)

policies := l.Policies()
policies := lo.Filter(l.Policies(), filterForTLSPolicies)

if len(policies) == 0 {
policies = l.Gateway.Policies()
policies = lo.Filter(l.Gateway.Policies(), filterForTLSPolicies)
}

for _, p := range policies {
Expand Down

0 comments on commit c986a25

Please sign in to comment.