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: ClusterResourceBinding scope in MutatingWebhookConfiguration #5252

Merged
merged 1 commit into from
Jul 27, 2024

Conversation

a7i
Copy link
Contributor

@a7i a7i commented Jul 26, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:

We've been having a lot of issues with karmada deleting cluster-level resources such as ClusterRole and ClusterRoleBinding.

After debugging, we realized that the label clusterresourcebinding.karmada.io/permanent-id was missing from those ClusterResourceBinding and that the webhook is responsible for populating that. Given that this was empty, all resource propagated to the member cluster also had an empty value for the id (i.e. clusterresourcebinding.karmada.io/permanent-id: "") which is then identified as orphaned work and is deleted in the cluster.

This must have broke after the "63 char limit issue" because all of our CRBs prior to that release are fine and do not cause orphan work issues:

(note 79 days ago is good, but all recent ones are not)

❯ kubectl get crb -L clusterresourcebinding.karmada.io/permanent-id

NAME                                                                                          SCHEDULED   FULLYAPPLIED   AGE     PERMANENT-ID
access-admin-clusterrole                                                                      True        True           150d    49baa1bb-c6e5-40fb-a913-3721314d736e
access-admin-clusterrolebinding                                                               True        True           150d    cfd8e53f-52fb-4613-8244-9a8084959b54
aggregate-olm-edit-clusterrole                                                                True        False          13d
aggregate-olm-view-clusterrole                                                                True        False          13d
aggregate-to-restricted-edit-clusterrole                                                      True        False          13d
amir-namespace                                                                                True        True           125d    fca50359-b88b-4647-bf33-9f25ffd82d02
analytics-admin-clusterrole                                                                   True        True           150d    ce2aefef-3251-45bf-8082-b816913b66cc
applications.argoproj.io-customresourcedefinition                                             True        True           79d     f5e35e32-20ac-4b2d-94b3-1e3a94e387f1
applicationsets.argoproj.io-customresourcedefinition                                          True        True           79d     d6f33b7d-1dd4-467d-b753-b60d0d70d473
appprojects.argoproj.io-customresourcedefinition                                              True        True           79d     50c92fea-e201-44fd-ba34-a717c90ed2e2

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix: `ClusterResourceBinding` scope in `MutatingWebhookConfiguration`

Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 26, 2024
@karmada-bot karmada-bot requested review from chaosi-zju and Poor12 July 26, 2024 01:00
@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jul 26, 2024
@a7i
Copy link
Contributor Author

a7i commented Jul 26, 2024

/cc @jwcesign

would you be open to reviewing? seems like a regression from this

@karmada-bot karmada-bot requested a review from jwcesign July 26, 2024 01:10
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.26%. Comparing base (4ba18c1) to head (2530ab9).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5252      +/-   ##
==========================================
+ Coverage   28.24%   28.26%   +0.02%     
==========================================
  Files         632      632              
  Lines       43732    43732              
==========================================
+ Hits        12353    12363      +10     
+ Misses      30476    30469       -7     
+ Partials      903      900       -3     
Flag Coverage Δ
unittests 28.26% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@a7i
Copy link
Contributor Author

a7i commented Jul 26, 2024

/retest

@XiShanYongYe-Chang
Copy link
Member

Hi @a7i, thanks for your feedback. I'm sorry for the disruption to your business.

This also reminds me that we do not have E2E capabilities to maintain related capabilities. Do you think we can design some E2E capabilities to maintain the logic?

@a7i
Copy link
Contributor Author

a7i commented Jul 26, 2024

Hi @a7i, thanks for your feedback. I'm sorry for the disruption to your business.

This also reminds me that we do not have E2E capabilities to maintain related capabilities. Do you think we can design some E2E capabilities to maintain the logic?

all good! we're happy that we can make small contributions to this project.

Happy to explore this and submit a few e2e tests in a separate PR (so we can cover CRB and RB)

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

Thanks~
/lgtm
/approve

We also need to cherry-pick this patch to the previous branch.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2024
@karmada-bot karmada-bot merged commit b5c4c8d into karmada-io:master Jul 27, 2024
13 checks passed
@a7i a7i deleted the amir/fix-crb-webhook-scope branch July 28, 2024 16:03
karmada-bot added a commit that referenced this pull request Jul 29, 2024
…k-of-#5252-upstream-release-1.10

Automated cherry pick of #5252: fix: `ClusterResourceBinding` scope in
@RainbowMango RainbowMango added this to the v1.11 milestone Aug 31, 2024
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants