Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1665368

Summary: Custom label for pvc in statefulsets
Product: OpenShift Container Platform Reporter: Sudarshan Chaudhari <suchaudh>
Component: kube-controller-managerAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.9.0CC: aos-bugs, cvogt, dsukhiya, eparis, jokerman, mfojtik, mmccomas, nmukherj, sponnaga, vjaypurk
Target Milestone: ---   
Target Release: 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-23 11:03:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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