Skip to content
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 configuration metadata inconsistency #15601

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

skonto
Copy link
Contributor

@skonto skonto commented Oct 30, 2024

Fixes #15594

Proposed Changes

  • Sorts routes list for the serving.knative.dev/routes anno to avoid triggering non-required reconciliations.
  • I benchmarked different sorting options:
    a) sets.List(valSet) <- this sorts the set behind the scenes.
    b)
     set := valSet.UnsortedList() 
     sort.Strings(set)
    

I think the overhead is low but b) seems ~10% faster. For a small number of routes, the common case, the diff is negligible (sorting is trivial), does not matter if a) or b) is used.

Release Note

Fixes a problem in configuration reconciliation where labeler creates a different order of the route names listed via the annotation `serving.knative.dev/routes` compared to the configuration reconciler.

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 30, 2024
@skonto skonto removed the request for review from izabelacg October 30, 2024 15:49
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.50%. Comparing base (c8e131b) to head (0bc5f1a).
Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
pkg/reconciler/labeler/accessors.go 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15601      +/-   ##
==========================================
- Coverage   84.49%   83.50%   -0.99%     
==========================================
  Files         219      219              
  Lines       13608    17427    +3819     
==========================================
+ Hits        11498    14553    +3055     
- Misses       1740     2501     +761     
- Partials      370      373       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@skonto skonto requested a review from dprotaso October 30, 2024 16:19
@skonto skonto added this to the v1.17.0 milestone Oct 30, 2024
@skonto skonto changed the title [wip] Fix configuration metadata inconsistency Fix configuration metadata inconsistency Oct 31, 2024
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 31, 2024
@@ -128,15 +129,19 @@ func updateRouteAnnotation(acc kmeta.Accessor, routeName string, diffAnn map[str
return
}
valSet.Delete(routeName)
diffAnn[serving.RoutesAnnotationKey] = strings.Join(valSet.UnsortedList(), ",")
sorted := valSet.UnsortedList()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm here it is not yet sorted, right? so maybe call that variable routes or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it is going to be sorted :) I can change it.

Copy link
Member

@ReToCode ReToCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2024
@knative-prow knative-prow bot merged commit 423e654 into knative:main Nov 4, 2024
68 checks passed
Copy link

knative-prow bot commented Nov 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ReToCode, skonto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurations annotation routes reorder loop
3 participants