Bug 1743610

Summary: Cronjobs are not suspended when the migration is a quiesced migration
Product: OpenShift Container Platform Reporter: Sergio <sregidor>
Component: Migration ToolingAssignee: Scott Seago <sseago>
Status: CLOSED ERRATA QA Contact: Sergio <sregidor>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: chezhang, rpattath, xjiang
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:36:40 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 Sergio 2019-08-20 10:02:21 UTC
When the migration is quiescePods=true, cronjobs are not suspended and they continue spamming jobs.


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

OCP3
oc v3.11.126
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://
openshift v3.11.104
kubernetes v1.11.0+d4cacc0


OCP4
$ oc get clusterversion
NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.1.0     True        False         25h     Cluster version is 4.1.0


Controller 
    image: quay.io/ocpmigrate/mig-controller:latest
    imageID: quay.io/ocpmigrate/mig-controller@sha256:56f0ca2f594a571a7e1dbc35c4ee4b8cc1aed773e0eeb74b32331127a3f95c2d

Velero
    image: quay.io/ocpmigrate/velero:fusor-dev
    imageID: quay.io/ocpmigrate/velero@sha256:21297a4ab5f82b91bebd5f13d29acb6d43fb87c65ebb1e00fab11ebfeb0a2be2
    image: quay.io/ocpmigrate/migration-plugin:latest
    imageID: quay.io/ocpmigrate/migration-plugin@sha256:7cd1d4c3e2361a51ce7e13d184dff79cd451dd9e05bac8f03d09df80410c4583


How reproducible: always


Steps to Reproduce:
1. oc new-project cronjobtest
2. Create a helloworld cronjob

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            args:
            - /bin/sh
            - -c
            - date; echo Hello from the cluster
          restartPolicy: OnFailure

3. Migrate the cronjobtest project with quiescePods=true


Actual results:

1. Cronjob is not suspended
oc get cronjob
NAME      SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE
hello     */1 * * * *   False     1         14s             10m

2. Jobs continue to be scheduled
oc get pods
NAME                     READY     STATUS      RESTARTS   AGE
hello-1566294480-4j9g2   0/1       Completed   0          2m
hello-1566294540-7x78z   0/1       Completed   0          1m
hello-1566294600-kltmx   0/1       Completed   0          19s


Expected results:

1. Cronjob should be suspendend
  "oc get cronjob" should show "SUSPEND" with "true" value

2. "oc get pods" should show no new pods scheduled.



Additional info:

Comment 1 Scott Seago 2019-09-09 14:00:03 UTC
This has been fixed in the following PR: https://github.com/fusor/mig-controller/pull/296

Comment 3 Sergio 2019-09-09 14:54:56 UTC
Verified in 

Controller:
    image: quay.io/ocpmigrate/mig-controller:latest
    imageID: quay.io/ocpmigrate/mig-controller@sha256:259b08d197940932c616dd45f7cfd9799aca6823e83a510f85c83c0c5368496c
Velero:
    image: quay.io/ocpmigrate/velero:latest
    imageID: quay.io/ocpmigrate/velero@sha256:33d0e627aea00d0896a25d0acae6d4aa7deaaf86ddd28c29f8a6020dc16a97fc
    image: quay.io/ocpmigrate/migration-plugin:latest
    imageID: quay.io/ocpmigrate/migration-plugin@sha256:68f0791ce3d51e16e9759465064067d90daba396339ad83aa7aa6eba5a3bd4cf
OCP4:
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.2.0-0.nightly-2019-09-08-232045   True        False         6h41m   Cluster version is 4.2.0-0.nightly-2019-09-08-232045
OCP3:
 oc version
oc v3.9.97
kubernetes v1.9.1+a0ce1bc657


Cron jobs are now suspended when quiesce

 oc get cronjob
NAME        SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE
hellocron   */1 * * * *   True      0         1m              7m

Comment 4 errata-xmlrpc 2019-10-16 06:36:40 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-2019:2922