karmada: Got an unexpected result after deleting CRB first and then deleting CPP

What happened:

  1. I created a cluster-scoped resource and its CPP in Karmada control plane.
  2. After it was propagated to member clusters, I deleted its CRB first and then deleted its CPP(it happened after the CRB deletion was done).
  3. I created a new CPP to propagate this cluster-scoped resource, but no CRB was created. new CPP: image no CRB created: image

What you expected to happen: Karmada should created an new CRB to propagate this cluster-scoped resource.

How to reproduce it (as minimally and precisely as possible): Just follow the above steps.

Anything else we need to know?: If the CRB is deleted, the codes in line 936~956 won’t be executed so that the cluster-scoped resource never be matched by new CPP. https://github.com/karmada-io/karmada/blob/59ed0c6260668025519a4aa615eac5ac7ad81d00/pkg/detector/detector.go#L935-L956

Environment:

  • Karmada version: v1.5.0
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version):
  • Others:

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 15 (15 by maintainers)

Most upvoted comments

The current implementation is no problem from the perspective of direct user use. Of course, we can operate the rb object during the platform construction process, but this also needs to face some negative impacts caused by the operation, because in the design and implementation of many features, we set the rb cannot be directly operated.

Therefore, I think this is not a bug. If this is identified as a bug, there will be many problems in the future because of the direct processing of the rb object, which will affect the premise of our entire setting.

I think detector needs some code refactoring to solve this problem, I’d like to work on it. Let’s discuss in its PR. /assign

I can think of two solutions to this problem:

  1. detector clears resource labels when it detects that pp is deleted
  2. In the resource propagation controller, if a resource is selected by a pp, the controller checks whether the pp exists. If the PP does not exist, it clears the label so that it can be bound to a new label

Is there a better way?