Bug 1665368 - Custom label for pvc in statefulsets
Summary: Custom label for pvc in statefulsets
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: kube-controller-manager
Version: 3.9.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: 4.3.0
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-11 07:27 UTC by Sudarshan Chaudhari
Modified: 2020-02-24 09:44 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Custom labels were not copied to PVCs. Consequence: Custom labels where not applied to created PVC under Stateful Sets. Fix: Copy labels when creating PVCs. Result: Custom labels are applied to created PVC under Stateful Sets.
Clone Of:
Environment:
Last Closed: 2020-01-23 11:03:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:0062 0 None None None 2020-01-23 11:03:59 UTC

Description Sudarshan Chaudhari 2019-01-11 07:27:57 UTC
Description of problem:

While creating the pvc via statefulsets, the custom labels added in the pvc are not getting appreciated. the only label available is default one "app: appname"

PVC config in the test statefulset:
~~~
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
  labels:
    test: label1
spec:
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "glusterfs-storage"
      resources:
        requests:
          storage: 1Gi
~~~

In the yaml of created pvc:
~~~
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  annotations:
    volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/glusterfs
  creationTimestamp: 2019-01-11T07:24:27Z
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: mehdb
  name: data-test-0
  namespace: test
  resourceVersion: "31600680"
  selfLink: /api/v1/namespaces/test/persistentvolumeclaims/data-test-0
  uid: edbf4ceb-1571-11e9-b475-001a4a000cfb
~~~

Known Kubernetes issue: https://github.com/kubernetes/kubernetes/issues/58987

Version-Release number of selected component (if applicable):
N/a


Actual results:
No custom label available

Expected results:
the pvc should have the custom label as well

Comment 5 Sudarshan Chaudhari 2019-08-19 12:15:37 UTC
Hello,

Is there any update on this?

Regards, 
Sudarshan

Comment 6 Deepak Sukhiya 2019-09-06 15:01:59 UTC
Hi Team,

Do we have any further update on the bug?

If any information is required, please do let us know so that we can gather the same.

Best Regards,
Deepak Sukhiya
Associate Manager, OpenShift

Comment 7 Maciej Szulik 2019-09-09 10:33:35 UTC
This will be fixed in OCP 4.3 (since the fix from https://github.com/kubernetes/kubernetes/pull/74941 landed in k8s 1.15).
I don't envision us backporting that fix.

Comment 8 Maciej Szulik 2019-10-01 15:38:56 UTC
4.3 bump to k8s 1.16 landed in https://github.com/openshift/origin/pull/23811 moving to qa.

Comment 10 zhou ying 2019-10-15 07:47:50 UTC
Confirmed with latest version, the issue has fixed:
[root@dhcp-140-138 ~]# oc version
Client Version: v4.3.0
Server Version: 4.3.0-0.nightly-2019-10-15-020113
Kubernetes Version: v1.16.0-beta.2+a6ff814


apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: test
  labels:
    test: label1
spec:
......
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "nfs"
      resources:
        requests:
          storage: 1Gi

[root@dhcp-140-138 kubernetes]# oc get pvc -o data-test-0 -o yaml 
apiVersion: v1
items:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      pv.kubernetes.io/bind-completed: "yes"
      pv.kubernetes.io/bound-by-controller: "yes"
      volume.beta.kubernetes.io/storage-provisioner: example.com/nfs
    creationTimestamp: "2019-10-15T07:43:07Z"
    finalizers:
    - kubernetes.io/pvc-protection
    labels:
      test: label1
    name: data-test-0
    namespace: zhouy
    resourceVersion: "77697"
    selfLink: /api/v1/namespaces/zhouy/persistentvolumeclaims/data-test-0
    uid: 2ea18713-8437-42c8-9d23-4c6b876c40c4

Comment 12 errata-xmlrpc 2020-01-23 11:03:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0062


Note You need to log in before you can comment on or make changes to this bug.