Skip to content

Fix generateName for StatefulSets by including UID in workload name#9091

Open
IrvingMg wants to merge 1 commit intokubernetes-sigs:mainfrom
epam:fix/statefulsets-generated-name
Open

Fix generateName for StatefulSets by including UID in workload name#9091
IrvingMg wants to merge 1 commit intokubernetes-sigs:mainfrom
epam:fix/statefulsets-generated-name

Conversation

@IrvingMg
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

GetWorkloadName previously used only the StatefulSet name with an empty UID, causing workload name collisions when multiple StatefulSets shared a generateName prefix. This PR now includes the UID in the workload name hash.

Since the UID is not available at webhook time, labels that depend on the workload name have been moved from the webhook to the reconciler.

For MultiKueue compatibility, this PR adds GetOwnerUID (following the LWS pattern) so that worker-cluster copies use the management cluster’s UID via MultiKueueOriginUIDAnnotation.

Which issue(s) this PR fixes:

Fixes #8687

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix StatefulSets with generateName producing the same workload name.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 10, 2026
@netlify
Copy link

netlify bot commented Feb 10, 2026

Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 6002a6c
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/69933b719d60e70008d7c1d1
😎 Deploy Preview https://deploy-preview-9091--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot requested a review from pajakd February 10, 2026 12:03
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: IrvingMg
Once this PR has been reviewed and has the lgtm label, please assign gabesaba, mbobrovskyi for approval. For more information see the Code Review Process.

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

Details 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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 10, 2026
@IrvingMg
Copy link
Contributor Author

@DavideRutigliano @mbobrovskyi PTAL

@IrvingMg IrvingMg force-pushed the fix/statefulsets-generated-name branch from 327ad6a to d1344c5 Compare February 11, 2026 15:48
@IrvingMg IrvingMg force-pushed the fix/statefulsets-generated-name branch from d1344c5 to 6002a6c Compare February 16, 2026 15:44
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 16, 2026
@k8s-ci-robot
Copy link
Contributor

@IrvingMg: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-test-e2e-multikueue-main 6002a6c link true /test pull-kueue-test-e2e-multikueue-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

remoteStatefulSet.Labels[kueue.MultiKueueOriginLabel] = origin

if remoteStatefulSet.Annotations == nil {
remoteStatefulSet.Annotations = map[string]string{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
remoteStatefulSet.Annotations = map[string]string{}
remoteStatefulSet.Annotations = make(map[string]string, 1)

@mimowo
Copy link
Contributor

mimowo commented Feb 17, 2026

@IrvingMg do you understand the issue behind the e2e tests failing https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_kueue/9091/pull-kueue-test-e2e-multikueue-main/2023423325627224064? Do we have a path forward for fixing it?

@IrvingMg
Copy link
Contributor Author

@IrvingMg do you understand the issue behind the e2e tests failing https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_kueue/9091/pull-kueue-test-e2e-multikueue-main/2023423325627224064? Do we have a path forward for fixing it?

Yes, I’ve been looking into it and am currently working on the fix. The issue seems to be related to splitting the reconciliation process after adding the StatefulSet pod reconciler, which is causing the workload to miss the StatefulSet owner reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create statefulsets with generatedName always produce the same workload name statefulset--d7705

4 participants