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

labels with includeTemplates get applied to StatefulSet volumeClaimTemplates #5389

Closed
hameno opened this issue Oct 17, 2023 · 8 comments · May be fixed by #5807
Closed

labels with includeTemplates get applied to StatefulSet volumeClaimTemplates #5389

hameno opened this issue Oct 17, 2023 · 8 comments · May be fixed by #5807
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@hameno
Copy link

hameno commented Oct 17, 2023

What happened?

Trying to set datadog version labels on pods of a statefulset using

labels:
  - includeSelectors: false
    includeTemplates: true
    pairs:
      tags.datadoghq.com/version: r1
      app.kubernetes.io/version: r1

causes the labels to also be applied to volumeClaimTemplates which cannot be modified after initial creation and thus preventing updates.

What did you expect to happen?

volumeClaimTemplates should not be modified

How can we reproduce it (as minimally and precisely as possible)?

labels:
  - includeSelectors: false
    includeTemplates: true
    pairs:
      tags.datadoghq.com/version: r1
      app.kubernetes.io/version: r1
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name:test
  serviceName: test-headless
  replicas: 3
  template:
    metadata:
      name: test
      labels:
        app.kubernetes.io/name: test
    spec:
      containers:
        - name: pod
          image: test:r1
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /usr/src/app/data/usercontent
              name: userdata
      restartPolicy: Always
  volumeClaimTemplates:
    - metadata:
        name: userdata
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: gp3
        resources:
          requests:
            storage: 10Gi

Expected output

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
  labels:
      tags.datadoghq.com/version: r1
      app.kubernetes.io/version: r1
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name:test
  serviceName: test-headless
  replicas: 3
  template:
    metadata:
      name: test
      labels:
        app.kubernetes.io/name: test
        tags.datadoghq.com/version: r1
        app.kubernetes.io/version: r1
    spec:
      containers:
        - name: pod
          image: test:r1
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /usr/src/app/data/usercontent
              name: userdata
      restartPolicy: Always
  volumeClaimTemplates:
    - metadata:
        name: userdata
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: gp3
        resources:
          requests:
            storage: 10Gi

Actual output

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
  labels:
      tags.datadoghq.com/version: r1
      app.kubernetes.io/version: r1
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name:test
  serviceName: test-headless
  replicas: 3
  template:
    metadata:
      name: test
      labels:
        app.kubernetes.io/name: test
        tags.datadoghq.com/version: r1
        app.kubernetes.io/version: r1
    spec:
      containers:
        - name: pod
          image: test:r1
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - mountPath: /usr/src/app/data/usercontent
              name: userdata
      restartPolicy: Always
  volumeClaimTemplates:
    - metadata:
        name: userdata
        labels:
          tags.datadoghq.com/version: r1
          app.kubernetes.io/version: r1
      spec:
        accessModes:
          - ReadWriteOnce
        storageClassName: gp3
        resources:
          requests:
            storage: 10Gi

Kustomize version

5.1.1

Operating system

Linux

@hameno hameno added the kind/bug Categorizes issue or PR as related to a bug. label Oct 17, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 17, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@babinos87
Copy link

babinos87 commented Jan 18, 2024

I have observed the same thing. I want to customize labels in the pods, but the labels are also applied to the volumeClaimTemplates, making it impossible to update the stateful set.

As a workaround until (if ever) this is fixed, inspired by this answer, you can first delete the StatefulSet without deleting its pods (so there won't be any downtime) and then apply the kustomization, for example:

$ kubectl delete statefulset your-stateful-set --cascade=orphan
$ kubectl apply -k .

@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue 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 Apr 17, 2024
@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue 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 May 17, 2024
@k8s-triage-robot
Copy link

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

This bot triages issues 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 issue is closed

You can:

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

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

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

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

This bot triages issues 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 issue is closed

You can:

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

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

/close not-planned

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 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2024
@aibarbetta
Copy link
Contributor

/reopen
I contributed the includeTemplates flag some time ago. The motivation was to add metadata without causing downtime, which is not achieved in the case of StatefulSets with volumeClaimTemplates defined. I'll try to contribute an additional includeVolumeClaimTemplates flag so that we can disable this undesired behavior.

@KnVerey @natasha41575 thoughts?

@k8s-ci-robot
Copy link
Contributor

@aibarbetta: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen
I contributed the includeTemplates flag some time ago. The motivation was to add metadata without causing downtime, which is not achieved in the case of StatefulSets with volumeClaimTemplates defined. I'll try to contribute an additional includeVolumeClaimTemplates flag so that we can disable this undesired behavior.

@KnVerey @natasha41575 thoughts?

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.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants