Skip to content

Conversation

@audrastump
Copy link
Collaborator

@audrastump audrastump commented Apr 29, 2025

Description of your changes

Blocking users from modifying member cluster labels directly through the dataplane unless they are the RP client. Not mergeable until member label changes are available through CLI.

Fixes #

I have:

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

How has this code been tested

Unit tests

Special notes for your reviewer

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 blocks direct modification of fleet member cluster labels through the dataplane unless performed by the RP client.

  • Introduces a new constant and check in the user validation logic to deny label modifications by non-RP clients.
  • Adds the helper function isRPClient to identify RP clients based on username and group membership.
  • Updates the webhook test suite to verify that label modifications are allowed for RP clients and denied for non-RP clients.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/webhook/validation/uservalidation.go Adds constant and logic to deny label modifications by non-RP clients along with a new isRPClient helper function.
pkg/webhook/fleetresourcehandler/fleetresourcehandler_webhook_test.go Adds test cases to verify the new label modification restrictions.

@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

Attention: Patch coverage is 63.63636% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...eetresourcehandler/fleetresourcehandler_webhook.go 14.28% 6 Missing ⚠️
cmd/hubagent/main.go 0.00% 4 Missing ⚠️
pkg/webhook/webhook.go 81.81% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@audrastump audrastump force-pushed the main branch 3 times, most recently from c86ddf2 to 4579fb3 Compare May 7, 2025 22:41
Signed-off-by: audrastump <a.e.stump@wustl.edu>
@audrastump audrastump force-pushed the main branch 2 times, most recently from 674fee6 to cb856d4 Compare May 7, 2025 22:57
audrastump added 3 commits May 7, 2025 15:58
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
audrastump added 3 commits May 8, 2025 13:51
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
audrastump added 4 commits May 8, 2025 20:13
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Copy link
Collaborator

@jim-minter jim-minter left a comment

Choose a reason for hiding this comment

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

LGTM

audrastump and others added 3 commits May 8, 2025 21:30
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
@audrastump audrastump marked this pull request as ready for review May 9, 2025 18:41
Signed-off-by: audrastump <a.e.stump@wustl.edu>
@audrastump audrastump requested a review from britaniar May 12, 2025 17:27
britaniar
britaniar previously approved these changes May 13, 2025
Copy link
Collaborator

@britaniar britaniar left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
@audrastump audrastump requested a review from jwtty May 14, 2025 02:57
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
Signed-off-by: audrastump <a.e.stump@wustl.edu>
@jwtty jwtty merged commit fe0f3f3 into kubefleet-dev:main May 14, 2025
16 checks passed
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.

5 participants