Bug 2142778 - CronJobs are not being migrated as the 'batch/v1beta1' apiversion not present in OCP 4.12
Summary: CronJobs are not being migrated as the 'batch/v1beta1' apiversion not present...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Migration Toolkit for Containers
Classification: Red Hat
Component: General
Version: 1.7.6
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 1.7.8
Assignee: Jason Montleon
QA Contact: ssingla
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-15 09:10 UTC by ssingla
Modified: 2023-02-16 17:56 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-16 17:56:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.