Bug 2002897

Summary: Rollback migration does not complete when the namespace contains a cron job
Product: Migration Toolkit for Containers Reporter: Jaydip Gabani <jgabani>
Component: ControllerAssignee: Jaydip Gabani <jgabani>
Status: CLOSED ERRATA QA Contact: Xin jiang <xjiang>
Severity: medium Docs Contact: Avital Pinnick <apinnick>
Priority: urgent    
Version: 1.6.0CC: ernelson, rjohnson
Target Milestone: ---   
Target Release: 1.6.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: 2021-09-29 14:36:19 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 Jaydip Gabani 2021-09-10 01:13:44 UTC
Description of problem:
Rollback of a namespace that includes cronjobs gets stuck in "EnsureMigratedDeleted" phase

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


How reproducible:
source - 3.11 - release 1.5.1
destination - 4.7 - latest

Steps to Reproduce:
1.Create a cronjob using a pvc

oc new project bz-test


Create these resources in the new namespace

---
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 a CronJob
          restartPolicy: OnFailure
          volumeMounts:
            - mountPath: /downlods
              name: downloads
          dnsPolicy: ClusterFirst
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
          volumes:
          - name: downloads
            persistentVolumeClaim:
              claimName: portal-downloads

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: portal-downloads
  labels:
    app: cronjob
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi

2. Migrate the bz-test namespace using IDVM+IDIM
3. wait for one or two jobs to run and complete
4. Rollback 

Actual results:
The rollback deletes the CronJob but jobs are not deleted, corresponding completed pods are also present, volume is in a terminating state since the completed pods are present. The process is stuck

Expected results:
The rollback should succeed without getting stuck.

Additional info:

rollback migration status - 

status:
  conditions:
    - category: Advisory
      lastTransitionTime: '2021-09-10T01:05:47Z'
      message: 'Step: 8/10'
      reason: EnsureMigratedDeleted
      status: 'True'
      type: Running
    - category: Required
      lastTransitionTime: '2021-09-10T01:05:34Z'
      message: The migration is ready.
      status: 'True'
      type: Ready
  itinerary: Rollback
  observedDigest: 7d795bfe1696958632b3fe5778e9da31944b0972bc8914d7206ee9b1f92b0fa3
  phase: EnsureMigratedDeleted
  pipeline:
    - completed: '2021-09-10T01:05:34Z'
      message: Completed
      name: CleanupVelero
      started: '2021-09-10T01:05:34Z'
    - completed: '2021-09-10T01:05:35Z'
      message: Completed
      name: CleanupHelpers
      started: '2021-09-10T01:05:34Z'
    - message: Rolling back. Waiting for migrated resource deletion.
      name: CleanupMigrated
      phase: EnsureMigratedDeleted
      started: '2021-09-10T01:05:35Z'
    - message: Not started
      name: CleanupUnquiesce
    - message: Not started
      name: Cleanup

Comment 4 Xin jiang 2021-09-15 07:11:56 UTC
verified with MTC 1.6.0

registry.redhat.io/rhmtc/openshift-migration-controller-rhel8@sha256:3b5efa9c8197fe0313a2ab7eb184d135ba9749c9a4f0d15a6abb11c0d18b9194

Comment 6 errata-xmlrpc 2021-09-29 14:36:19 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 (Moderate: Migration Toolkit for Containers (MTC) 1.6.0 security & bugfix update), 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/RHSA-2021:3694