-
Notifications
You must be signed in to change notification settings - Fork 256
Sort AgentTolerations when creating agent Bundle #4367
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
This is a follow-up to: rancher/rancher#52755 , merged in Rancher recently and to avoid the problem when running Fleet standalone. It simply sorts the AgentTolerations when creating the agent Bundle so they don't differ and create later different _Content_ resources. Signed-off-by: Xavi Garcia <[email protected]>
b9dfffe to
2eed782
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.
Pull request overview
This PR adds sorting functionality for AgentTolerations when creating agent Bundles to prevent the generation of different Content resources due to inconsistent toleration ordering. The change ensures deterministic ordering of tolerations, which is crucial for maintaining stable Bundle specifications.
Key Changes:
- Implemented a
sortTolerationsfunction that sorts tolerations by Key, Value, Operator, Effect, and TolerationSeconds - Added sorting of
AgentTolerationsin thenewAgentBundlemethod before creating the Bundle - Introduced comprehensive unit tests for the sorting logic and integration test for Bundle creation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent.go |
Adds sortTolerations function and applies sorting to cluster's AgentTolerations before Bundle creation |
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent_test.go |
Adds TestNewAgentBundle_SortsAgentTolerations integration test and TestSortTolerations table-driven unit tests with comprehensive coverage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent.go
Outdated
Show resolved
Hide resolved
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent.go
Show resolved
Hide resolved
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent_test.go
Show resolved
Hide resolved
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent.go
Outdated
Show resolved
Hide resolved
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Xavi Garcia <[email protected]>
internal/cmd/controller/agentmanagement/controllers/manageagent/manageagent_test.go
Outdated
Show resolved
Hide resolved
Signed-off-by: Xavi Garcia <[email protected]>
* Sort AgentTolerations when creating agent Bundle This is a follow-up to: rancher/rancher#52755 , merged in Rancher recently and to avoid the problem when running Fleet standalone. It simply sorts the AgentTolerations when creating the agent Bundle so they don't differ and create later different _Content_ resources. --------- Signed-off-by: Xavi Garcia <[email protected]>
* Sort AgentTolerations when creating agent Bundle This is a follow-up to: rancher/rancher#52755 , merged in Rancher recently and to avoid the problem when running Fleet standalone. It simply sorts the AgentTolerations when creating the agent Bundle so they don't differ and create later different _Content_ resources. --------- Signed-off-by: Xavi Garcia <[email protected]>
* Sort AgentTolerations when creating agent Bundle This is a follow-up to: rancher/rancher#52755 , merged in Rancher recently and to avoid the problem when running Fleet standalone. It simply sorts the AgentTolerations when creating the agent Bundle so they don't differ and create later different _Content_ resources. --------- Signed-off-by: Xavi Garcia <[email protected]>
This is a follow-up to: rancher/rancher#52755 , merged in Rancher recently and to avoid the problem when running Fleet standalone.
It simply sorts the AgentTolerations when creating the agent Bundle so they don't differ and create later different Content resources.
It also adds a unit test to test the Bundle's tolerations sorting, that could be used as the base to add more tests about the generated Bundle in the future.
Additional Information
Checklist
- [ ] I have updated the documentation via a pull request in thefleet-docs repository.