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

[BUG] Can not create a WorkloadSpread with subset patches if the target CloneSet, which includes a volume template, already exists. #1738

Open
AiRanthem opened this issue Sep 11, 2024 · 2 comments · May be fixed by #1740
Assignees
Labels
kind/bug Something isn't working

Comments

@AiRanthem
Copy link
Contributor

What happened:

When creating a WorkloadSpread, the request will be intercepted by the Webhook and result in failure if the following conditions are met:

  1. A subset of the WorkloadSpread contains a patch.
  2. The WorkloadSpread's targetRef is an existing CloneSet.
  3. This CloneSet has a volume template, and a container mounts that volume.

What you expected to happen:

Created successfully.

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

  1. Create a CloneSet named test-cs with a volume template
  2. Create a WorkloadSpread whose targetRef is test-cs, and patches anything in a subset
  3. An error related to volume will occur like:
Error from server: error when creating "workloadspread.yaml": admission webhook "vworkloadspread.kb.io" denied the request: [spec.subsets[0].patch.containers[0].volumeMounts[0].name: Not found: "vol-1"]

Anything else we need to know?:

This bug is caused by the validation of patches in the Webhook. During this validation, the Webhook reads the template of the existing target workload, applies the subset's patch to it as a real corev1.Pod object, and checks if the patched Pod is valid. In this bug, the patched Pod's volumes field does not contain the volumes related to the CloneSet's volume template, leading the Webhook to mistakenly believe that the patched Pod would mount a non-existent volume. As a result, it incorrectly deems the patch invalid, ultimately rejecting the creation of the WorkloadSpread.

Environment:

  • Kruise version: any
  • Kubernetes version (use kubectl version): any
  • Install details (e.g. helm install args):
  • Others:
@AiRanthem AiRanthem added the kind/bug Something isn't working label Sep 11, 2024
@furykerry furykerry assigned AiRanthem and unassigned FillZpp Sep 12, 2024
@furykerry
Copy link
Member

Besides CloneSet, statefulset and advance statefulset will have similar problem

@AiRanthem
Copy link
Contributor Author

AiRanthem commented Sep 12, 2024

Besides CloneSet, statefulset and advance statefulset will have similar problem

AdvancedStatefulSet does not appear to be supported by WorkloadSpread. @furykerry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants