-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tlspolicy enforced condition when certificate/issuer ready condition is missing #715
Conversation
910eb98
to
21e0a1c
Compare
The intention for filtering here, at least for RateLimit / Auth, is that it only cares about programmed gateways, since if it's in an unready state, it should not do any of the configuration since no traffic will be recieved anyway. The policy will be marked as The DAG (a view of the cluster of things we care about, that was first used at the reconciler level) does the same filtering because of the same assumption that it should only care about programmed Gateways. But this filtering now also affects events since it was introduced at the gateway event mapper level from this change. I believe it's also with the same intention, no point to reconciling on policies on a gateway event where the Gateway is unready at least for RateLimit / Auth. But thinking on this, an event where the gateway goes from a In summary I think it's necessary at least here to mark policies as Not sure does anyone else want to give an opinion on this though 🤔 |
Exactly, i don't think any policy should be ignoring events, they should all go down to the policy controller and it decides what to do. Any assumption made about only caring about gateways with a status "Programmed: true" is wrong anyway as we have at least one policy of our own that does care about Gateways not programmed (TLSPolicy) , and other future polices may do also. So could we just remove these checks? |
Tend to agree with @mikenairn each policy controller should decide what it wants to do with a given gateway state. TLS is a good example. A gateway wont get into a programmed state unless TLSPolicy has setup the secret for it |
@mikenairn @maleck13 Not sure about completely removing the checks since both checks are primarly used within the reconcilers anyway and there's more instances of wanting to filter them out than not 🤔 The changes in this PR allows passing an option defined by the policy type whether it should do this filtering or not, with the DAG defaulting to always perform this filtering unless otherwise specified because of this majority (can default to not filter if people prefer). Otherwise I think completely removing the checks and doing a refactor to perform this at each controller level elsewhere seems a bit out of scope for this PR |
I am a bit out of context. But I will try to contribute a bit, hopefully not confusing things even more.
I would not state like that. Policy controllers setup watchers, mappers and predicates to catch only relevant events for the resources (or subresources) they are reconciling. Ignoring not relevant events to save NO-OP reconcilliation triggers.
I agree, but @KevFan implemented in a way you can opt out.
Have you considered having the topology component always add all the gateways to the graph and then have the topology index layer (the component wrapping the topology component), a new method called Yet another option would be that each controller decides which gateways are feeded into the topology. Nothing stops you from doing a pre-filtering step to filter out not programmed gateways and feed the topology with only programmed gateways. Between, your implemented option, the index layer and the pre-filtering approach, I would pick the index layer approach. But all three are good enough for me. The reason to pick the index layer is because it is somewhat weird to feed the topology with N gateways and when I requests gateways out of it I get fewer (or even none) instances of gateways. |
Index layer approach sounds good to me, however I prefer the current implementation since it works with both the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verification Steps worked as expected, The TLS policy is created and enforced correctly.
…tion is missing Previous using IsStatusConditionFalse will return true if the Ready status condition is missing which caused TLSPolicy to incorrectly set the Enforced condition to true
@mikenairn are you okay with the changes otherwise or is there anything else outstanding? Would appreciate a review from you or someone more familiar with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikenairn are you okay with the changes otherwise or is there anything else outstanding? Would appreciate a review from you or someone more familiar with the
TLSPolicy
to ensure the changes makes sense 🤔
Left a few comments/questions, but generally i think it looks fine. My initial questions were really around the need for the Programmed status checks at all, but if they are deemed necessary, then the approach here makes sense.
Have we tried it when cert manager isn't installed though?
…ager is installed
I've tried it when cert manager isn't installed with the following steps:
make local-env-setup
make install-cert-manager
make run
|
Description
Closes: #704
TLSPolicy controller with multiple https listener [It] should delete tls certificate when listener is removed
to be flaky. Added this filter option to the DAG to work as expected for TLSPolicy.Verification
Passing tests should be sufficient but if you want to manually verrify:
TLSPolicy
watch -n 0.1 "kubectl get tlspolicy -A -o yaml | yq '.items[0]'"
TLSPolicy
enforced condition quickly tranistions tofalse
and back totrue