-
Notifications
You must be signed in to change notification settings - Fork 703
internal/k8s: Ignore LastTransitionTime for HTTPProxy objects status equal check #2986
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2986 +/- ##
=======================================
Coverage 75.03% 75.04%
=======================================
Files 90 90
Lines 5869 5871 +2
=======================================
+ Hits 4404 4406 +2
Misses 1371 1371
Partials 94 94
|
|
FYI this tags the wrong issue |
…equal check Change how the comparison of the status of the object of HTTPProxy objects by ignoring the LastTransitionTime which is always updates on each DAG rebuild regardless if the status of object changed or not. Not ignoring this causes each status to be updated each time since the objects are always different for each DAG rebuild. Fixes projectcontour#2979 Signed-off-by: Steve Sloka <[email protected]>
98ba0f8 to
1a86f5a
Compare
skriss
left a comment
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.
LGTM. I don't know if there was a particular reason for using the equality package to do the equality compare previously, but we use cmp.Equal in the Contour handler for doing equality of API objects, and the tests pass, so I don't see an issue with changing it.
jpeach
left a comment
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.
This reverts the switch to Kubernetes semantic equality from #2853
I think that a better fix might be to add the v1.DetailedCondition type to the equality funcs that we use for this comparison. That retains the special handling that api-machinery has for existing Kubernetes types.
var equalities = conversion.Equalities{equality.Semantic}
equalities.AddFunc(func(a, b contourv1.DetailedCondition) bool{
...
})
That said, I don't see any practical issues with landing this and following up. |
|
But will adding the type still skip that field? That's the goal here, and why we went with cmp which is used in other places. |
Looking at the way the interfaces work, you would add your own comparator that skips or flattens the relevant fields (e.g. the time comparison is flattened to UTC). |
|
FWIW in Knative we define a |
|
We define our common condition type here: https://github.com/knative/pkg/blob/21cb070a8b050ec23100078e89df11d67444350c/apis/condition_types.go#L76 |
|
We also have https://github.com/projectcontour/contour/blob/main/internal/contour/handler.go#L179-L183 which would need a custom comparer if we want to migrate that to @stevesloka do you want to merge this as-is for now (@jpeach was OK with that too) and do a follow-up to fully switch compare libraries? |
|
@skriss let's just land this as-is. I think we should chat about how to best approach the solution. I like Knavtive's approach that @mattmoor linked, it removes the extra need to understand that this field is different for other comparisons, but should chat about this a bit before making that change. |
Change how the comparison of the status of the object of HTTPProxy objects by
ignoring the LastTransitionTime which is always updates on each DAG rebuild
regardless if the status of object changed or not.
Not ignoring this causes each status to be updated each time since the objects
are always different for each DAG rebuild.
Fixes #2979
Signed-off-by: Steve Sloka [email protected]