karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.12k stars 807 forks source link

Introduce a validation webhook to prohibit WorkloadRebalancer from being modified #4859

Closed chaosi-zju closed 1 week ago

chaosi-zju commented 1 week ago

DO NOT MERGE until the following PR have been merged (this PR needs a rebasing) :

What type of PR is this?

/kind feature

What this PR does / why we need it:

Introduce a validation webhook to prohibit WorkloadRebalancer from being modified, the final effect is like:

$ kubectl --context karmada-apiserver edit wr demo
error: workloadrebalancers.apps.karmada.io "demo" could not be patched: admission webhook "workloadrebalancer.karmada.io" denied the request: the spec field should not be modified
You can run `kubectl replace -f /tmp/kubectl-edit-vdiqj.yaml` to try this update again.
$
$ kubectl --context karmada-apiserver replace -f demo2.yaml     
Error from server (Forbidden): error when replacing "demo2.yaml": admission webhook "workloadrebalancer.karmada.io" denied the request: the spec field should not be modified

Which issue(s) this PR fixes:

Fixes part of #4840

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

karmada-bot commented 1 week ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign rainbowmango after the PR has been reviewed. You can assign the PR to them by writing /assign @rainbowmango in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/karmada-io/karmada/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
codecov-commenter commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 52.97%. Comparing base (aded7c0) to head (09f93bd). Report is 2 commits behind head on master.

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #4859 +/- ## ========================================== - Coverage 52.99% 52.97% -0.02% ========================================== Files 250 250 Lines 20420 20421 +1 ========================================== - Hits 10821 10819 -2 - Misses 8880 8882 +2 - Partials 719 720 +1 ``` | [Flag](https://app.codecov.io/gh/karmada-io/karmada/pull/4859/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/karmada-io/karmada/pull/4859/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io) | `52.97% <100.00%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=karmada-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

chaosi-zju commented 1 week ago

/close

we will try to implemente update event in #4860

karmada-bot commented 1 week ago

@chaosi-zju: Closed this PR.

In response to [this](https://github.com/karmada-io/karmada/pull/4859#issuecomment-2076180987): >/close > >we will try to implemente `update` event in #4860 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.