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 that karmada-agent don't have permission to delete work resources #2902

Merged

Conversation

lonelyCZ
Copy link
Member

@lonelyCZ lonelyCZ commented Dec 5, 2022

Signed-off-by: lonelyCZ chengzhe@zju.edu.cn

What type of PR is this?

/kind bug

What this PR does / why we need it:

karmada-agent need to permission to delete work resources.

E1205 07:30:10.437634       1 service_export_controller.go:459] Failed to delete work(karmada-es-member140/dc-demo-59r4p-58b774c749), Error: works.work.karmada.io "dc-demo-59r4p-58b774c749" is forbidden: User "system:node:member140" cannot delete resource "works" in API group "work.karmada.io" in the namespace "karmada-es-member140"
E1205 07:30:10.437688       1 service_export_controller.go:161] Failed to handle endpointSlice(default/dc-demo-59r4p) event, Error: works.work.karmada.io "dc-demo-59r4p-58b774c749" is forbidden: User "system:node:member140" cannot delete resource "works" in API group "work.karmada.io" in the namespace "karmada-es-member140"

// handleEndpointSliceEvent syncs EndPointSlice objects to control-plane according to EndpointSlice event.
// For EndpointSlice create or update event, reports the EndpointSlice when referencing service has been exported.
// For EndpointSlice delete event, cleanup the previously reported EndpointSlice.
func (c *ServiceExportController) handleEndpointSliceEvent(endpointSliceKey keys.FederatedKey) error {
endpointSliceObj, err := helper.GetObjectFromCache(c.RESTMapper, c.InformerManager, endpointSliceKey)
if err != nil {
if apierrors.IsNotFound(err) {
return cleanupWorkWithEndpointSliceDelete(c.Client, endpointSliceKey)
}
return err
}

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

release-1.3 and release-1.4 need this patch (cherry-pick).

/cc @RainbowMango

Does this PR introduce a user-facing change?:

`karmadactl`: Fixed `karmada-agent` installed by the `register` command can not delete works due to lack of permission issue.

Signed-off-by: lonelyCZ <chengzhe@zju.edu.cn>
@karmada-bot karmada-bot added kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 5, 2022
@Poor12
Copy link
Member

Poor12 commented Dec 5, 2022

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 5, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #2902 (f6721c4) into master (472ccb5) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2902   +/-   ##
=======================================
  Coverage   37.80%   37.80%           
=======================================
  Files         200      200           
  Lines       18461    18461           
=======================================
  Hits         6980     6980           
  Misses      11073    11073           
  Partials      408      408           
Flag Coverage Δ
unittests 37.80% <100.00%> (ø)

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

Impacted Files Coverage Δ
pkg/karmadactl/cmdinit/kubernetes/deploy.go 3.26% <ø> (ø)
pkg/karmadactl/cmdinit/karmada/rbac.go 88.57% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@RainbowMango
Copy link
Member

How to reproduce it?

Does this only happen on the one installed by karmadactl register?

@lonelyCZ
Copy link
Member Author

lonelyCZ commented Dec 5, 2022

Does this only happen on the one installed by karmadactl register?

Yes, I have updated the release-note.

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

@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 Dec 5, 2022
@RainbowMango RainbowMango added this to the v1.5 milestone Dec 5, 2022
@karmada-bot karmada-bot merged commit 5934b17 into karmada-io:master Dec 5, 2022
@RainbowMango
Copy link
Member

By the way, I updated the release note, please take a look it will be used in cherry-picked PRs.

karmada-bot added a commit that referenced this pull request Dec 6, 2022
…-upstream-release-1.4

Automated cherry pick of #2902: Fix that karmada-agent don't have permission to delete work
karmada-bot added a commit that referenced this pull request Dec 6, 2022
…-upstream-release-1.3

Automated cherry pick of #2902: Fix that karmada-agent don't have permission to delete work
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