Bug 2031793

Summary: "migration-controller" pod goes into "CrashLoopBackOff" state if "MigPlan" CR contains an invalid "includedResources" resource
Product: Migration Toolkit for Containers Reporter: Simon Reber <sreber>
Component: ControllerAssignee: Pranav Gaikwad <pgaikwad>
Status: CLOSED ERRATA QA Contact: Xin jiang <xjiang>
Severity: medium Docs Contact: Avital Pinnick <apinnick>
Priority: medium    
Version: 1.6.2CC: ernelson, prajoshi, rjohnson, ssingla
Target Milestone: ---   
Target Release: 1.6.3   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-01-20 06:31:35 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 Simon Reber 2021-12-13 13:04:35 UTC
Description of problem:

When creating a `MigPlan` resource with `includedResources` and the `kind` for example has a typo or does not exist the `migration-controller` pod is stuck in `CrashLoopBackOff` state.

See https://docs.openshift.com/container-platform/4.9/migrating_from_ocp_3_to_4/advanced-migration-options-3-4.html#migration-kubernetes-objects_advanced-migration-options-3-4 for details about the `MigPlan`.

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

 - Migration Toolkit for Containers Operator 1.6.2

How reproducible:

 - Always

Steps to Reproduce:
1. Install Migration Toolkit for Containers Operator
2. Create a `MigPlan` that looks as following:

> apiVersion: migration.openshift.io/v1alpha1
> kind: MigPlan
> metadata:
>   name: <migplan>
>   namespace: openshift-migration
> spec:
>   includedResources:
>   - kind: Namespaces
>     group: ""
> [...]
>   labelSelector:
>     matchLabels:
>       <label> 
Mind the `kind: Namespaces` which is not valid (should be `kind: Namespace`)

3. Validate the state of migration-controller pod

Actual results:

The migration-controller pod is in `CrashLoopBackOff` state with `nil pointer` exception.

Expected results:

The migration-controller would in best case accept plural of resources (as per API definition) at if it's not valid report that `includedResources` is not valid but prevent the controller from going into `CrashLoopBackOff`

Additional info:

Comment 9 errata-xmlrpc 2022-01-20 06:31:35 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.3 security and bug fix 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-2022:0202