-
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: Context being cancelled and better Policy status #1012
Conversation
7e68b8c
to
1aff0b2
Compare
func (r *RateLimitPolicyStatusUpdater) enforcedCondition(policy *kuadrantv1.RateLimitPolicy, topology *machinery.Topology, state *sync.Map) *metav1.Condition { | ||
kObj := GetKuadrantFromTopology(topology) | ||
if kObj == nil { | ||
return kuadrant.EnforcedCondition(policy, kuadrant.NewErrSystemResource("kuadrant"), false) | ||
} |
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.
Should this also be done for AuthPolicy
? The current condition for AuthPolicy
without Kuadrant installed is:
status:
conditions:
- lastTransitionTime: "2024-11-13T08:50:35Z"
message: AuthPolicy has been accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: "2024-11-13T08:50:54Z"
message: 'AuthPolicy has encountered some issues: missing auth effective policies
stored in the reconciliation state'
reason: Unknown
status: "False"
type: Enforced
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.
Yes this should have being done.
@@ -40,9 +40,9 @@ var ( | |||
) | |||
|
|||
func GetLimitadorFromTopology(topology *machinery.Topology) (*limitadorv1alpha1.Limitador, error) { |
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.
nit: what about returning only *limitadorv1alpha1.Limitador
?
I do not consider as an error when (kuadrant managed) limitador does not exist. It is a state or reality, not an error.
The GetKuadrantFromTopology was somehow cancelling the context of functions that called it. This improves the policy status of ratelimit policies when there is no kuadrant CR on cluster, or it was removed. Signed-off-by: Jim Fitzpatrick <[email protected]>
Add changes based on PR comments Signed-off-by: Jim Fitzpatrick <[email protected]>
f6e4f62
to
59d4df1
Compare
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.
Verified! Looks good to me 👍
The GetKuadrantFromTopology was somehow cancelling the context of functions that called it.
This improves the policy status of ratelimit policies when there is no kuadrant CR on cluster, or it was removed.
Closes: #1004
Closes: #1011
Reproduce error
Install kuadrant from main.
Create the a working ratelimit example. RateLimitPolicy for Platform Engineers
Delete the kuadrant CR. Then check the state of the wasm plugin. It would be expected that this would be removed. However it will not. Restarting the kuadrant deployment will fix the issue and clean the resources up. Also the status in the ratelimiting policy will say it is still accepted.
Install the operator from this branch and get the cluster back into the state before the deletion of the kuadrant CR. This time when the Kuadrant CR is remove the wasm plugin will be removed and the enforced status will be false.