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

[Feat] Resource Deletion Protection #4074

Conversation

Vacant2333
Copy link
Contributor

@Vacant2333 Vacant2333 commented Sep 18, 2023

What type of PR is this?
/kind feature
Add the resource deletion protection

What this PR does / why we need it:
Proposal: #3802

Which issue(s) this PR fixes:
Part of ##3728

Special notes for your reviewer:
install by helm:
c0b641620468f62d55d2be3bab79e64e

install by local-up-karmada.sh:
dc3fc741f4acd1a9981c33abccc680dd

install by karmada-operator:
ab9102da6eb9556a5d5468318b7e77e2

Does this PR introduce a user-facing change?:

`karmada-webhook`: Introduced `validate-resourcedeletionprotection` webhook which enforces resource protection rules for those resources labeled with `resourcetemplate.karmada.io/deletion-protected`.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 18, 2023
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 18, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5135e8f) 54.71% compared to head (1df2420) 53.50%.
Report is 98 commits behind head on master.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4074      +/-   ##
==========================================
- Coverage   54.71%   53.50%   -1.21%     
==========================================
  Files         232      234       +2     
  Lines       22828    23296     +468     
==========================================
- Hits        12490    12465      -25     
- Misses       9659    10149     +490     
- Partials      679      682       +3     
Flag Coverage Δ
unittests 53.50% <100.00%> (-1.21%) ⬇️

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

Files Coverage Δ
...armadactl/cmdinit/karmada/webhook_configuration.go 88.81% <100.00%> (+0.66%) ⬆️
pkg/webhook/cronfederatedhpa/validating.go 80.68% <ø> (ø)

... and 32 files with indirect coverage changes

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

@XiShanYongYe-Chang
Copy link
Member

Thanks, @Vacant2333, I will review it later.
/assign

Copy link
Member

@chaunceyjiang chaunceyjiang left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Good Job!

@Vacant2333 Vacant2333 force-pushed the add-resource-deletion-protection-by-label branch from 5723823 to 7902764 Compare September 22, 2023 11:34
@Vacant2333 Vacant2333 force-pushed the add-resource-deletion-protection-by-label branch from 7902764 to 7bafc02 Compare October 8, 2023 08:28
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
/cc @RainbowMango @chaunceyjiang

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 8, 2023
@XiShanYongYe-Chang
Copy link
Member

/cc @RainbowMango

Copy link
Member

@chaunceyjiang chaunceyjiang left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/assign

Copy link
Member

Choose a reason for hiding this comment

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

nice finding! for the renaming: validation.go --> validating.go.
cc @jwcesign
It's no big deal, but it'd be great if we kept the consistent naming rule.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

Generally looks good, just proposed another label key.
Please let me know what you think.

By the way, @Vacant2333 sorry for the day.

@Vacant2333 Vacant2333 force-pushed the add-resource-deletion-protection-by-label branch from 7bafc02 to 76c6a08 Compare October 15, 2023 15:41
@karmada-bot karmada-bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2023
@@ -256,6 +256,23 @@ webhooks:
sideEffects: None
admissionReviewVersions: [ "v1" ]
timeoutSeconds: 3
- name: resourcedeletionprotection.karmada.io
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- name: resourcedeletionprotection.karmada.io
- name: resource deletion protection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we may use the consist name like the other webohooks?
or resource-deletion-protection
image
image

Copy link
Member

@RainbowMango RainbowMango Oct 17, 2023

Choose a reason for hiding this comment

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

Yeah, you are right, I didn't notice that the name should be fully qualified.
Then, please ignore my suggestions. Let's keep the resourcedeletionprotection.karmada.io.

@Vacant2333 Vacant2333 force-pushed the add-resource-deletion-protection-by-label branch from 76c6a08 to f915995 Compare October 17, 2023 05:46
Signed-off-by: Vacant2333 <vacant2333@gmail.com>
@Vacant2333 Vacant2333 force-pushed the add-resource-deletion-protection-by-label branch from f915995 to 1df2420 Compare October 17, 2023 06:55
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/approve

Leave final decisions to @chaunceyjiang @XiShanYongYe-Chang

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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 Oct 17, 2023
@XiShanYongYe-Chang
Copy link
Member

Thanks~
/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2023
@karmada-bot karmada-bot merged commit 557348f into karmada-io:master Oct 18, 2023
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants