Skip to content

Conversation

@0xavi0
Copy link
Contributor

@0xavi0 0xavi0 commented Nov 25, 2025

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 the
fleet-docs repository.

@0xavi0 0xavi0 self-assigned this Nov 25, 2025
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]>
@0xavi0 0xavi0 force-pushed the tolerations-sorting branch from b9dfffe to 2eed782 Compare November 25, 2025 14:55
@0xavi0 0xavi0 added this to Fleet Nov 25, 2025
@0xavi0 0xavi0 added this to the v2.13.1 milestone Nov 25, 2025
@0xavi0 0xavi0 marked this pull request as ready for review November 26, 2025 09:45
@0xavi0 0xavi0 requested a review from a team as a code owner November 26, 2025 09:45
@kkaempf kkaempf moved this to 👀 In review in Fleet Nov 26, 2025
@thardeck thardeck requested a review from Copilot November 28, 2025 09:47
Copy link
Contributor

Copilot AI left a 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 sortTolerations function that sorts tolerations by Key, Value, Operator, Effect, and TolerationSeconds
  • Added sorting of AgentTolerations in the newAgentBundle method 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.

Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
@0xavi0 0xavi0 requested a review from weyfonk November 28, 2025 15:07
@0xavi0 0xavi0 merged commit 509088a into rancher:main Nov 28, 2025
35 of 36 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Fleet Nov 28, 2025
0xavi0 added a commit to 0xavi0/fleet that referenced this pull request Nov 28, 2025
* 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]>
weyfonk pushed a commit to 0xavi0/fleet that referenced this pull request Nov 28, 2025
* 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]>
0xavi0 added a commit that referenced this pull request Dec 1, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants