Bug 2142778

Summary: CronJobs are not being migrated as the 'batch/v1beta1' apiversion not present in OCP 4.12
Product: Migration Toolkit for Containers Reporter: ssingla
Component: GeneralAssignee: Jason Montleon <jmontleo>
Status: CLOSED DEFERRED QA Contact: ssingla
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.7.6CC: dymurray, rjohnson
Target Milestone: ---   
Target Release: 1.7.8   
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: 2023-02-16 17:56:51 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 ssingla 2022-11-15 09:10:58 UTC
Description of problem: Cronjobs are not being migrated to 4.12 OCP as the API Version 'batch/v1beta1' of CronJob is no longer present in k8s v1.25+


Version-Release number of selected component (if applicable):
MTC 1.7.6
Target -> OCP 4.12
Source -> OCp 4.6

How reproducible:
Always

Steps to Reproduce:
1.Create a namespace 
  oc new-project cronjob-test

2.Create an internal image
  oc import-image intalpine:int --from=docker.io/alpine:latest --confirm

3.Save the below template in a file cronjob.yml:

apiVersion: template.openshift.io/v1
kind: Template
labels:
  template: hello-cron
message: |-
  Creates a cronjob that says hello every minute using the given image.
objects:
- apiVersion: batch/v1beta1
  kind: CronJob
  metadata:
    name: ${CRON_NAME}
  spec:
    schedule: "*/1 * * * *"
    jobTemplate:
      metadata:
        labels: 
           cronowner: ${CRON_NAME}
      spec:
        template:
          metadata:
            labels: 
               cronowner: ${CRON_NAME}
          spec:
            containers:
            - name: ${CRON_NAME}
              env:
              - name: CURRENT_NAMESPACE
                valueFrom:
                  fieldRef:
                    fieldPath: metadata.namespace
              image: ${IMAGE}
              args:
              - /bin/sh
              - -c
              -  echo "Hello! from namespace $CURRENT_NAMESPACE while using image ${IMAGE}"
            restartPolicy: OnFailure

parameters:
- description: Name of the cronjob deployed
  displayName: Name
  name: CRON_NAME
  required: true
  value: "hello-cron"
- description: Image used to say hello
  displayName: Doker Image
  name: IMAGE
  required: true
  value: "alpine"

4. Create cronjob using the image

  oc process -f cronjob.yml -p CRON_NAME=internal-img -p IMAGE=image-registry.openshift-image-registry.svc:5000/cronjob-test/intalpine:int | oc create -f -
cronjob.batch/internal-img created

5. Migrate the namespace

Actual results: Cronjobs are not migrated to the destination cluster

$ oc get cronjobs -n cronjob-test
No resources found.



Expected results: Cronjobs should be migrated successfully 


Additional Info:


Warning in Migration Plan:

Unsupported resource GVKs
Namespaces with GVKs that are not supported on the target cluster will not be migrated with the rest of the migration plan. They will need to be migrated manually, post migration.

Namespaces with resource GVKs not supported on the target cluster:
cronjob-test
batch/v1beta1 Resource=cronjobs

Comment 7 Dylan Murray 2023-02-16 17:56:51 UTC
Closing this bug as it's been addressed in documentation.