Skip to content

feat: add GVK whitelisting support for status back-reporting#419

Open
michaelawyu (michaelawyu) wants to merge 1 commit into
kubefleet-dev:mainfrom
michaelawyu:feat/add-GVK-whitelisting-for-status-back-reporting
Open

feat: add GVK whitelisting support for status back-reporting#419
michaelawyu (michaelawyu) wants to merge 1 commit into
kubefleet-dev:mainfrom
michaelawyu:feat/add-GVK-whitelisting-for-status-back-reporting

Conversation

@michaelawyu
Copy link
Copy Markdown
Member

Description of your changes

This PR adds GVK whitelisting support for status back-reporting so that the hub agent will only back-report status information to the original resource for a specific set of GVKs. This helps most in cases where the Fleet hub cluster runs controllers that would reconcile such objects and add their own status, which would lead to contention with the Fleet hub agent.

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

  • Unit tests
  • Integration tests

Special notes for your reviewer

This PR is a prerequisite before we enable the status back-reporting feature in the system.

Signed-off-by: michaelawyu <chenyu1@microsoft.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 87.62887% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/controllers/statusbackreporter/controller.go 70.83% 5 Missing and 2 partials ⚠️
pkg/utils/gvkwhitelist/gvkwhitelist.go 93.15% 3 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

flags.DurationVar(&o.ResourceChangesCollectionDuration, "resource-changes-collection-duration", 15*time.Second,
"The duration for collecting resource changes into one snapshot. The default is 15 seconds, which means that the controller will collect resource changes for 15 seconds before creating a resource snapshot.")
o.RateLimiterOpts.AddFlags(flags)
flags.BoolVar(&o.EnableStatusBackReporting, "enable-status-back-reporting", false, "If set, the status back-reporting feature is enabled. This allows users to view object status of placed objects on the member cluster side directly on the hub cluster side.")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we start this as false, we need to change OM charts to enable it

}

// Register adds a new GVK into the whitelist.
func (w *WhitelistedGVKs) Register(apiGroup, apiVersion, kind string) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the current PR gets the GVK list from a flag which makes it static, why do we need all the locks?

}

// NewWhitelistedGVKs returns a new WhitelistedGVKs instance.
func NewWhitelistedGVKs() *WhitelistedGVKs {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we already have something similar in checking if a GVK should be propagated, can we not reuse it?

@michaelawyu
Copy link
Copy Markdown
Member Author

Putting this PR on hold per offline discussion -> will switch to a dynamic configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants