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

Bug 1550415

Summary: Set-based selectors are not working for statufulsets
Product: OpenShift Container Platform Reporter: weiwei jiang <wjiang>
Component: MasterAssignee: Tomáš Nožička <tnozicka>
Status: CLOSED CURRENTRELEASE QA Contact: weiwei jiang <wjiang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.9.0CC: aos-bugs, dma, haowang, jliggitt, jokerman, mmccomas, smunilla, tnozicka, xtian
Target Milestone: ---   
Target Release: 3.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift v3.9.3 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-18 17:44:20 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 weiwei jiang 2018-03-01 08:47:25 UTC
Description of problem:
When create a statufulset with its selector is set-based, got "invalid selector" when syncing pod.

Version-Release number of selected component (if applicable):
# openshift version 
openshift v3.9.1
kubernetes v1.9.1+a0ce1bc657
etcd 3.2.16


How reproducible:
always

Steps to Reproduce:
1.Create a statefulset with its selector is set-based
echo 'apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  name: grin
spec:
  serviceName: grin
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  selector:
    matchExpressions:
      - {key: app, operator: In, values: [grin]}
  template:
    metadata:
      labels:
        app: grin
    spec:
      containers:
      - image: quay.io/kargakis/grin:0.1
        name: grin
        command:
        - grin
        - server
        - run
        ports:
        - containerPort: 13413
          name: http
        - containerPort: 13414
          name: p2p' |oc create -f -
2.Check the log for statufulset syncing 
 journalctl -f -u atomic-openshift-master-controllers |grep -i statefulset
3.

Actual results:
# journalctl -f -u atomic-openshift-master-controllers |grep -i statefulset 
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: I0301 08:24:14.937502   15316 stateful_set.go:456] Syncing StatefulSet ns1/grin with 0 pods
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: I0301 08:24:14.937809   15316 stateful_set.go:418] Finished syncing statefulset "ns1/grin" (362.452µs)
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: E0301 08:24:14.937832   15316 stateful_set.go:400] Error syncing StatefulSet ns1/grin, requeuing: invalid selector: [app in (grin)]
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: I0301 08:24:14.937875   15316 stateful_set.go:456] Syncing StatefulSet default/grin with 0 pods
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: I0301 08:24:14.938009   15316 stateful_set.go:418] Finished syncing statefulset "default/grin" (152.966µs)
Mar 01 03:24:14 qe-wjiang-container-engine-me-1 atomic-openshift-master-controllers[15302]: E0301 08:24:14.938041   15316 stateful_set.go:400] Error syncing StatefulSet default/grin, requeuing: invalid selector: [app in (grin)]


Expected results:
Should be working.

Additional info:

Comment 1 weiwei jiang 2018-03-01 08:48:06 UTC
Create a bug to trigger https://github.com/kubernetes/kubernetes/issues/59266

Comment 2 Jordan Liggitt 2018-03-01 15:22:41 UTC
fixed in https://github.com/kubernetes/kubernetes/pull/59365

Comment 3 Tomáš Nožička 2018-03-01 15:25:21 UTC
jordan was faster :)

I'll pick that for 3.9

Comment 4 Tomáš Nožička 2018-03-01 21:30:26 UTC
master PR with backport https://bugzilla.redhat.com/show_bug.cgi?id=1550415

Comment 5 Tomáš Nožička 2018-03-01 21:38:39 UTC
this is the PR https://github.com/openshift/origin/pull/18797

Comment 6 Tomáš Nožička 2018-03-05 09:43:17 UTC
3.9 PR https://github.com/openshift/origin/pull/18824

Comment 7 Wang Haoran 2018-03-06 03:23:44 UTC
Moved to modified, will verify once the new puddle built out

Comment 8 Xiaoli Tian 2018-03-07 03:48:18 UTC
This PR has already been merged in latest OCP 3.9 build.

Comment 9 DeShuai Ma 2018-03-07 09:58:25 UTC
Verify on v3.9.3, This bug is fixed.

Versions:
openshift v3.9.3
kubernetes v1.9.1+a0ce1bc657
etcd 3.2.16


[root@ip-172-18-12-111 ~]# echo 'apiVersion: apps/v1beta1
> kind: StatefulSet
> metadata:
>   name: grin
> spec:
>   serviceName: grin
>   replicas: 1
>   updateStrategy:
>     type: RollingUpdate
>   selector:
>     matchExpressions:
>       - {key: app, operator: In, values: [grin]}
>   template:
>     metadata:
>       labels:
>         app: grin
>     spec:
>       containers:
>       - image: quay.io/kargakis/grin:0.1
>         name: grin
>         command:
>         - grin
>         - server
>         - run
>         ports:
>         - containerPort: 13413
>           name: http
>         - containerPort: 13414
>           name: p2p' |oc create -f -
statefulset "grin" created
[root@ip-172-18-12-111 ~]# oc get po
NAME      READY     STATUS    RESTARTS   AGE
grin-0    1/1       Running   0          3m
[root@ip-172-18-12-111 ~]# journalctl -f -u atomic-openshift-master-controllers |grep -i statefulset
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.369914   12352 stateful_set.go:456] Syncing StatefulSet dma/grin with 1 pods
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370893   12352 stateful_set_control.go:354] StatefulSet dma/grin has 1 unhealthy Pods starting with grin-0
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370909   12352 stateful_set_control.go:427] StatefulSet dma/grin is waiting for Pod grin-0 to be Running and Ready
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370917   12352 stateful_set_control.go:102] StatefulSet dma/grin pod status replicas=1 ready=0 current=1 updated=0
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370924   12352 stateful_set_control.go:110] StatefulSet dma/grin revisions current=grin-6d4fb94b89 update=grin-6d4fb94b89
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370933   12352 stateful_set.go:461] Successfully synced StatefulSet dma/grin successful
Mar 07 04:54:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:41.370940   12352 stateful_set.go:418] Finished syncing statefulset "dma/grin" (1.100289ms)
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.013162   12352 stateful_set.go:227] Pod grin-0 updated, objectMeta {Name:grin-0 GenerateName:grin- Namespace:dma SelfLink:/api/v1/namespaces/dma/pods/grin-0 UID:7681fd02-21ed-11e8-9a32-0e09835c7a02 ResourceVersion:35151 Generation:0 CreationTimestamp:2018-03-07 04:54:01 -0500 EST DeletionTimestamp:<nil> DeletionGracePeriodSeconds:<nil> Labels:map[app:grin controller-revision-hash:grin-6d4fb94b89 statefulset.kubernetes.io/pod-name:grin-0] Annotations:map[openshift.io/scc:restricted] OwnerReferences:[{APIVersion:apps/v1beta1 Kind:StatefulSet Name:grin UID:766093b2-21ed-11e8-9a32-0e09835c7a02 Controller:0xc423245aec BlockOwnerDeletion:0xc423245aed}] Initializers:nil Finalizers:[] ClusterName:} -> {Name:grin-0 GenerateName:grin- Namespace:dma SelfLink:/api/v1/namespaces/dma/pods/grin-0 UID:7681fd02-21ed-11e8-9a32-0e09835c7a02 ResourceVersion:35222 Generation:0 CreationTimestamp:2018-03-07 04:54:01 -0500 EST DeletionTimestamp:<nil> DeletionGracePeriodSeconds:<nil> Labels:map[app:grin controller-revision-hash:grin-6d4fb94b89 statefulset.kubernetes.io/pod-name:grin-0] Annotations:map[openshift.io/scc:restricted] OwnerReferences:[{APIVersion:apps/v1beta1 Kind:StatefulSet Name:grin UID:766093b2-21ed-11e8-9a32-0e09835c7a02 Controller:0xc42a47a9ec BlockOwnerDeletion:0xc42a47a9ed}] Initializers:nil Finalizers:[] ClusterName:}.
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.013319   12352 stateful_set.go:456] Syncing StatefulSet dma/grin with 1 pods
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.045947   12352 stateful_set_control.go:102] StatefulSet dma/grin pod status replicas=1 ready=1 current=1 updated=0
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.045965   12352 stateful_set_control.go:110] StatefulSet dma/grin revisions current=grin-6d4fb94b89 update=grin-6d4fb94b89
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.045976   12352 stateful_set.go:461] Successfully synced StatefulSet dma/grin successful
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.045983   12352 stateful_set.go:418] Finished syncing statefulset "dma/grin" (32.708361ms)
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.046310   12352 stateful_set.go:456] Syncing StatefulSet dma/grin with 1 pods
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.047127   12352 stateful_set_control.go:102] StatefulSet dma/grin pod status replicas=1 ready=1 current=1 updated=0
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.047140   12352 stateful_set_control.go:110] StatefulSet dma/grin revisions current=grin-6d4fb94b89 update=grin-6d4fb94b89
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.047148   12352 stateful_set.go:461] Successfully synced StatefulSet dma/grin successful
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.047155   12352 stateful_set.go:418] Finished syncing statefulset "dma/grin" (890.666µs)
Mar 07 04:54:47 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:54:47.047322   12352 graph_builder.go:601] GraphBuilder process object: apps/v1/StatefulSet, namespace dma, name grin, uid 766093b2-21ed-11e8-9a32-0e09835c7a02, event type update
Mar 07 04:55:11 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:11.370095   12352 stateful_set.go:456] Syncing StatefulSet dma/grin with 1 pods
Mar 07 04:55:11 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:11.370975   12352 stateful_set_control.go:102] StatefulSet dma/grin pod status replicas=1 ready=1 current=1 updated=0
Mar 07 04:55:11 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:11.370989   12352 stateful_set_control.go:110] StatefulSet dma/grin revisions current=grin-6d4fb94b89 update=grin-6d4fb94b89
Mar 07 04:55:11 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:11.370998   12352 stateful_set.go:461] Successfully synced StatefulSet dma/grin successful
Mar 07 04:55:11 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:11.371006   12352 stateful_set.go:418] Finished syncing statefulset "dma/grin" (980.697µs)
Mar 07 04:55:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:41.370287   12352 stateful_set.go:456] Syncing StatefulSet dma/grin with 1 pods
Mar 07 04:55:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:41.371164   12352 stateful_set_control.go:102] StatefulSet dma/grin pod status replicas=1 ready=1 current=1 updated=0
Mar 07 04:55:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:41.371177   12352 stateful_set_control.go:110] StatefulSet dma/grin revisions current=grin-6d4fb94b89 update=grin-6d4fb94b89
Mar 07 04:55:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:41.371186   12352 stateful_set.go:461] Successfully synced StatefulSet dma/grin successful
Mar 07 04:55:41 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:41.371193   12352 stateful_set.go:418] Finished syncing statefulset "dma/grin" (969.752µs)
Mar 07 04:55:49 ip-172-18-12-111.ec2.internal atomic-openshift-master-controllers[12352]: I0307 04:55:49.341773   12352 reflector.go:428] github.com/openshift/origin/vendor/k8s.io/client-go/informers/factory.go:86: Watch close - *v1.StatefulSet total 3 items received