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

The resource spec contents of spec PP and RB fields are always different. #5999

Open
CharlesQQ opened this issue Dec 31, 2024 · 0 comments
Open
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@CharlesQQ
Copy link
Member

What happened:
When create pp and workload, pp sets the .spec.suspension.dispatching=true, and then .spec.suspension.dispatching=false , rb is always .spec.suspension.dispatching=true.

As shown in the code below, when the update event starts to be processed, if the creation event has not been completed, that is, rb has not been created, then resourceBindings will not be found, and the result is that the update content of pp will not be synchronized to rb.

func (d *ResourceDetector) HandlePropagationPolicyCreationOrUpdate(policy *policyv1alpha1.PropagationPolicy) error {
// If the Policy's ResourceSelectors change, causing certain resources to no longer match the Policy, the label claimed
// on relevant resource template will be removed (which gives the resource template a change to match another policy).
policyID := policy.Labels[policyv1alpha1.PropagationPolicyPermanentIDLabel]
err := d.cleanPPUnmatchedRBs(policyID, policy.Namespace, policy.Name, policy.Spec.ResourceSelectors)
if err != nil {
return err
}
// When updating fields other than ResourceSelector, should first find the corresponding ResourceBinding
// and add the bound object to the processor's queue for reconciliation to make sure that
// PropagationPolicy's updates can be synchronized to ResourceBinding.
resourceBindings, err := d.listPPDerivedRBs(policyID, policy.Namespace, policy.Name)
if err != nil {
return err
}
for _, rb := range resourceBindings.Items {
resourceKey, err := helper.ConstructClusterWideKey(rb.Spec.Resource)
if err != nil {
return err
}
d.Processor.Add(keys.ClusterWideKeyWithConfig{ClusterWideKey: resourceKey, ResourceChangeByKarmada: true})
}

What you expected to happen:
The relevant fields in the spec of the PP and RB fields must ultimately be the same.

How to reproduce it (as minimally and precisely as possible):

create pp and resource template, set pp field .spec.suspension.dispatching=true, and then set .spec.suspension.dispatching=false, check check rb field .spec.suspension.dispatching.

Anything else we need to know?:

Environment:

  • Karmada version:
    v1.12
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version):
  • Others:
@CharlesQQ CharlesQQ added the kind/bug Categorizes issue or PR as related to a bug. label Dec 31, 2024
@CharlesQQ CharlesQQ changed the title The relevant fields in the spec of the PP and RB fields are always different. The resource spec contents of spec PP and RB fields are always different. Dec 31, 2024
@RainbowMango RainbowMango added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
Status: Accepted
Development

No branches or pull requests

2 participants