Skip to content

Add labels to volumeClaimTemplates in StatefulSets if includeVolumeClaimTemplates is true#5831

Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
aibarbetta:fix-5389
Apr 1, 2026
Merged

Add labels to volumeClaimTemplates in StatefulSets if includeVolumeClaimTemplates is true#5831
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom
aibarbetta:fix-5389

Conversation

@aibarbetta
Copy link
Copy Markdown
Member

Fixes #5389

@k8s-ci-robot k8s-ci-robot requested review from koba1t and ncapps January 3, 2025 23:38
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 3, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @aibarbetta. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 3, 2025
@aibarbetta
Copy link
Copy Markdown
Member Author

/assign @KnVerey @koba1t
Hi folks, you reviewed this PR in the past. We've discovered that includeTemplates modifies immutable volumeClaimTemplates in StatefulSets (#5389). This is an attempt to decouple label insertion in volumeClaimTemplates to achieve labeling in metadata and templates without preventing updates. Can you take a look and give me your thoughts? Thanks!

@erikgb
Copy link
Copy Markdown
Member

erikgb commented Feb 4, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 4, 2025
@aibarbetta
Copy link
Copy Markdown
Member Author

/test all

@k8s-triage-robot
Copy link
Copy Markdown

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 6, 2025
@aibarbetta
Copy link
Copy Markdown
Member Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 6, 2025
@k8s-triage-robot
Copy link
Copy Markdown

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 4, 2025
@koba1t koba1t closed this Aug 11, 2025
@koba1t koba1t reopened this Aug 11, 2025
@koba1t
Copy link
Copy Markdown
Member

koba1t commented Aug 11, 2025

@aibarbetta

Sorry to delay review. I think this PR almost looks like good!

So, I care about a senario of includeTemplates==false && in includeVolumeClaimTemplates==true case, Could you add testcases that cover below case?

And, Please prepare a PR that update documents of official site!
https://github.com/kubernetes-sigs/cli-experimental

@aibarbetta
Copy link
Copy Markdown
Member Author

@aibarbetta

Sorry to delay review. I think this PR almost looks like good!

So, I care about a senario of includeTemplates==false && in includeVolumeClaimTemplates==true case, Could you add testcases that cover below case?

And, Please prepare a PR that update documents of official site! https://github.com/kubernetes-sigs/cli-experimental

Hi @koba1t, sure, thanks for getting back to me. I’m tied up with some v1.34 work, but I’ll work on this soon.

@k8s-triage-robot
Copy link
Copy Markdown

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 5, 2025
@k8s-triage-robot
Copy link
Copy Markdown

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@k8s-triage-robot: Closed this PR.

Details

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

@aibarbetta
Copy link
Copy Markdown
Member Author

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Nov 4, 2025
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

@aibarbetta: Reopened this PR.

Details

In response to this:

/reopen

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.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

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.

@aibarbetta
Copy link
Copy Markdown
Member Author

/remove-lifecycle rotten
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Nov 24, 2025
@aibarbetta
Copy link
Copy Markdown
Member Author

@aibarbetta

Sorry to delay review. I think this PR almost looks like good!

So, I care about a senario of includeTemplates==false && in includeVolumeClaimTemplates==true case, Could you add testcases that cover below case?

And, Please prepare a PR that update documents of official site! https://github.com/kubernetes-sigs/cli-experimental

Hi @koba1t, this is ready to review, let me know your thoughts 🙏🏻. The docs update is kubernetes-sigs/cli-experimental#426

@joar
Copy link
Copy Markdown

joar commented Feb 23, 2026

I found this PR via #5389, I tried to work around this issue by trying to override fieldSpecs in a bunch of different ways, but it always tried to merge instead of override.

The only way that worked for me was to create a custom LabelTransformer with the desired fieldspecs, excluding volumeClaimTemplate, which is a bit excessive:

kustomization.yaml

#
transformers:
  - labelsNoVolumeClaimTemplate.yaml

labelsNoVolumeClaimTemplate.yaml

apiVersion: builtin
kind: LabelTransformer
metadata:
  name: labelsNoVolumeClaimTemplate

labels:
  env: test
  version: beefcafe

fieldSpecs:
  # 1. Copy from https://github.com/kubernetes-sigs/kustomize/blob/master/api/internal/konfig/builtinpluginconsts/metadatalabels.go
  # 2. Remove volumeClaimTemplate.
  - path: metadata/labels
    create: true

  - path: spec/template/metadata/labels
    create: true
    version: v1
    kind: ReplicationController

  - path: spec/template/metadata/labels
    create: true
    kind: Deployment

  - path: spec/template/metadata/labels
    create: true
    kind: ReplicaSet

  - path: spec/template/metadata/labels
    create: true
    kind: DaemonSet

  - path: spec/template/metadata/labels
    create: true
    group: apps
    kind: StatefulSet

  - path: spec/template/metadata/labels
    create: true
    group: batch
    kind: Job

  - path: spec/jobTemplate/metadata/labels
    create: true
    group: batch
    kind: CronJob

  - path: spec/jobTemplate/spec/template/metadata/labels
    create: true
    group: batch
    kind: CronJob

Looking forward to get this PR merged ❤️

@koba1t
Copy link
Copy Markdown
Member

koba1t commented Apr 1, 2026

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 1, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aibarbetta, koba1t

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 1, 2026
@k8s-ci-robot k8s-ci-robot merged commit 80f63ae into kubernetes-sigs:master Apr 1, 2026
22 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

labels with includeTemplates get applied to StatefulSet volumeClaimTemplates

7 participants