Bug 1974586 - Migration plan with no target namespace causes the Controller pod to crash
Summary: Migration plan with no target namespace causes the Controller pod to crash
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Migration Toolkit for Virtualization
Classification: Red Hat
Component: Controller
Version: 2.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.1.0
Assignee: Sam Lucidi
QA Contact: Amos Mastbaum
Avital Pinnick
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-22 06:21 UTC by Amos Mastbaum
Modified: 2023-09-15 01:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-08-26 07:09:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2021:3278 0 None None None 2021-08-26 07:09:18 UTC

Description Amos Mastbaum 2021-06-22 06:21:04 UTC
Description of problem:

A Plan CR with missing spec.targetNamespace key/value cause the forklift controller pod to CrashLoopBack.


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


How reproducible:


Steps to Reproduce:
1. Create a Plan CR without spec.targetNamespace key/value
2.
3.

Actual results:

* Plan remains Unknown in the UI
* The forklift controller pod to Crashes during reconciliation process 


Expected results:

* A Clear indication of the missing value
* Pod should not Crash


Additional info:

forklift controller:
{"level":"info","ts":1624340974.8925605,"logger":"entrypoint","msg":"setting up client for manager"}
{"level":"info","ts":1624340974.8930326,"logger":"entrypoint","msg":"setting up manager"}
I0622 05:49:35.943893       1 request.go:645] Throttling request took 1.038173445s, request: GET:https://172.30.0.1:443/apis/samples.operator.openshift.io/v1?timeout=32s
{"level":"info","ts":1624340978.954827,"logger":"controller-runtime.metrics","msg":"metrics server is starting to listen","addr":":8080"}
{"level":"info","ts":1624340978.9551847,"logger":"entrypoint","msg":"Registering Components."}
{"level":"info","ts":1624340978.955212,"logger":"entrypoint","msg":"setting up scheme"}
{"level":"info","ts":1624340978.9556923,"logger":"entrypoint","msg":"Setting up controller"}
{"level":"info","ts":1624340978.9559257,"logger":"entrypoint","msg":"setting up webhooks"}
{"level":"info","ts":1624340978.9559448,"logger":"entrypoint","msg":"Starting the Cmd."}
{"level":"info","ts":1624340978.9561305,"logger":"controller-runtime.manager","msg":"starting metrics server","path":"/metrics"}
{"level":"info","ts":1624340978.9563043,"logger":"controller","msg":"Starting EventSource","controller":"storageMap","source":"kind source: /, Kind="}
{"level":"info","ts":1624340978.9562986,"logger":"controller","msg":"Starting EventSource","controller":"migration","source":"kind source: /, Kind="}
{"level":"info","ts":1624340978.9564734,"logger":"controller","msg":"Starting EventSource","controller":"host","source":"kind source: /, Kind="}
{"level":"info","ts":1624340978.956564,"logger":"controller","msg":"Starting EventSource","controller":"hook","source":"kind source: /, Kind="}
{"level":"info","ts":1624340978.9566414,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340978.9570153,"logger":"controller","msg":"Starting EventSource","controller":"networkMap","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.0568318,"logger":"controller","msg":"Starting EventSource","controller":"storageMap","source":"channel source: 0xc000402c80"}
{"level":"info","ts":1624340979.0569,"logger":"controller","msg":"Starting EventSource","controller":"storageMap","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.0571547,"logger":"controller","msg":"Starting Controller","controller":"hook"}
{"level":"info","ts":1624340979.0571876,"logger":"controller","msg":"Starting EventSource","controller":"host","source":"channel source: 0xc000402dc0"}
{"level":"info","ts":1624340979.0572474,"logger":"controller","msg":"Starting EventSource","controller":"host","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.0574558,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"channel source: 0xc000402a00"}
{"level":"info","ts":1624340979.0574906,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.0577855,"logger":"controller","msg":"Starting EventSource","controller":"networkMap","source":"channel source: 0xc000402b40"}
{"level":"info","ts":1624340979.057835,"logger":"controller","msg":"Starting EventSource","controller":"networkMap","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.0579247,"logger":"controller","msg":"Starting EventSource","controller":"migration","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.057963,"logger":"controller","msg":"Starting Controller","controller":"migration"}
{"level":"info","ts":1624340979.1574178,"logger":"controller","msg":"Starting Controller","controller":"storageMap"}
{"level":"info","ts":1624340979.1574838,"logger":"controller","msg":"Starting workers","controller":"storageMap","worker count":1}
{"level":"info","ts":1624340979.1575687,"logger":"controller","msg":"Starting EventSource","controller":"host","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.1576204,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.157656,"logger":"storageMap|rbpwm","msg":"Reconcile started.","map":"openshift-mtv/storage-qe-vmware-mapping"}
{"level":"info","ts":1624340979.1577504,"logger":"controller","msg":"Starting workers","controller":"hook","worker count":1}
{"level":"info","ts":1624340979.1579764,"logger":"controller","msg":"Starting Controller","controller":"networkMap"}
{"level":"info","ts":1624340979.1579704,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.1580262,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.1580489,"logger":"controller","msg":"Starting EventSource","controller":"plan","source":"kind source: /, Kind="}
{"level":"info","ts":1624340979.1581137,"logger":"controller","msg":"Starting Controller","controller":"plan"}
{"level":"info","ts":1624340979.1985714,"logger":"storageMap|rbpwm","msg":"Reconcile ended.","map":"openshift-mtv/storage-qe-vmware-mapping","reQ":0}
{"level":"info","ts":1624340979.198686,"logger":"storageMap|ghmv9","msg":"Reconcile started.","map":"openshift-mtv/testplan-gjzbz"}
{"level":"info","ts":1624340979.2544518,"logger":"storageMap|ghmv9","msg":"Reconcile ended.","map":"openshift-mtv/testplan-gjzbz","reQ":0}
{"level":"info","ts":1624340979.25453,"logger":"storageMap|lxxfk","msg":"Reconcile started.","map":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8"}
{"level":"info","ts":1624340979.2962947,"logger":"storageMap|lxxfk","msg":"Reconcile ended.","map":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8","reQ":0}
{"level":"info","ts":1624340980.8590138,"logger":"controller","msg":"Starting workers","controller":"migration","worker count":1}
{"level":"info","ts":1624340980.859245,"logger":"migration|j5pch","msg":"Reconcile started.","migration":"openshift-mtv/testplan-1623788225148"}
{"level":"info","ts":1624340980.8608568,"logger":"controller","msg":"Starting Controller","controller":"host"}
{"level":"info","ts":1624340980.8608902,"logger":"controller","msg":"Starting workers","controller":"host","worker count":1}
{"level":"info","ts":1624340980.8631775,"logger":"controller","msg":"Starting workers","controller":"plan","worker count":1}
{"level":"info","ts":1624340980.863263,"logger":"plan|r6dvf","msg":"Reconcile started.","plan":"openshift-mtv/testplan"}
{"level":"info","ts":1624340980.8641076,"logger":"controller","msg":"Starting workers","controller":"networkMap","worker count":1}
{"level":"info","ts":1624340980.8641813,"logger":"networkMap|xxjds","msg":"Reconcile started.","map":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8"}
{"level":"info","ts":1624340980.8895035,"logger":"networkMap|xxjds","msg":"Reconcile ended.","map":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8","reQ":0}
{"level":"info","ts":1624340980.8895757,"logger":"networkMap|wppgr","msg":"Reconcile started.","map":"openshift-mtv/network-qe-vmware-mapping"}
{"level":"info","ts":1624340980.891671,"logger":"migration|j5pch","msg":"Reconcile ended.","migration":"openshift-mtv/testplan-1623788225148","reQ":0}
{"level":"info","ts":1624340980.8917174,"logger":"migration|hzmns","msg":"Reconcile started.","migration":"openshift-mtv/testplan-1623788243133"}
{"level":"info","ts":1624340980.891738,"logger":"migration|hzmns","msg":"Reconcile ended.","migration":"openshift-mtv/testplan-1623788243133","reQ":0}
{"level":"info","ts":1624340980.905849,"logger":"networkMap|wppgr","msg":"Reconcile ended.","map":"openshift-mtv/network-qe-vmware-mapping","reQ":0}
{"level":"info","ts":1624340980.9059293,"logger":"networkMap|9tr84","msg":"Reconcile started.","map":"openshift-mtv/testplan-cbtgh"}
{"level":"info","ts":1624340980.9255638,"logger":"networkMap|9tr84","msg":"Reconcile ended.","map":"openshift-mtv/testplan-cbtgh","reQ":0}
{"level":"info","ts":1624340985.0711265,"logger":"plan|r6dvf","msg":"Migration ignored.","plan":"openshift-mtv/testplan","migration":"openshift-mtv/testplan-1623788225148"}
{"level":"info","ts":1624340985.071161,"logger":"plan|r6dvf","msg":"Migration ignored.","plan":"openshift-mtv/testplan","migration":"openshift-mtv/testplan-1623788243133"}
{"level":"info","ts":1624340985.0711672,"logger":"plan|r6dvf","msg":"No pending migrations found.","plan":"openshift-mtv/testplan"}
{"level":"info","ts":1624340985.0827003,"logger":"plan|r6dvf","msg":"Reconcile ended.","plan":"openshift-mtv/testplan","reQ":0}
{"level":"info","ts":1624340985.0828059,"logger":"plan|q94h2","msg":"Reconcile started.","plan":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8-plan"}
{"level":"info","ts":1624340985.106345,"logger":"plan|q94h2","msg":"Reconcile ended.","plan":"openshift-mtv/apiauto8fc25f4bb11546eb994f4886d600bfd8-plan","reQ":0}
E0622 05:49:45.106494       1 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 678 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x1d70a60, 0x37b8c40)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/runtime/runtime.go:74 +0xa3
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/runtime/runtime.go:48 +0x82
panic(0x1d70a60, 0x37b8c40)
	/usr/lib/golang/src/runtime/panic.go:969 +0x166
github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1.(*Plan).TargetNamespace(...)
	/remote-source/app/pkg/apis/forklift/v1beta1/plan.go:100
github.com/konveyor/forklift-controller/pkg/controller/plan.(*Reconciler).validateVM(0xc00213e0f0, 0xc0005bcc00, 0x0, 0x0)
	/remote-source/app/pkg/controller/plan/validation.go:359 +0x8d3
github.com/konveyor/forklift-controller/pkg/controller/plan.(*Reconciler).validate(0xc00213e0f0, 0xc0005bcc00, 0x0, 0x0)
	/remote-source/app/pkg/controller/plan/validation.go:107 +0x28a
github.com/konveyor/forklift-controller/pkg/controller/plan.Reconciler.Reconcile(0x24a0900, 0xc000a8b700, 0x24be300, 0xc000d43410, 0xc00091ce40, 0xc00087cdf0, 0xd, 0xc000657440, 0x2c, 0x0, ...)
	/remote-source/app/pkg/controller/plan/controller.go:217 +0x4a0
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0005541b0, 0x1e75060, 0xc00067e0e0, 0xc00057b000)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:244 +0x284
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0005541b0, 0x203000)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:218 +0xae
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker(0xc0005541b0)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:197 +0x2b
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc00049a4f0)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc00049a4f0, 0x2462c20, 0xc00093c960, 0x1, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:156 +0xa3
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc00049a4f0, 0x3b9aca00, 0x0, 0x2206b01, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(0xc00049a4f0, 0x3b9aca00, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:90 +0x4d
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:179 +0x42d
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x19d7a93]

goroutine 678 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/runtime/runtime.go:55 +0x105
panic(0x1d70a60, 0x37b8c40)
	/usr/lib/golang/src/runtime/panic.go:969 +0x166
github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1.(*Plan).TargetNamespace(...)
	/remote-source/app/pkg/apis/forklift/v1beta1/plan.go:100
github.com/konveyor/forklift-controller/pkg/controller/plan.(*Reconciler).validateVM(0xc00213e0f0, 0xc0005bcc00, 0x0, 0x0)
	/remote-source/app/pkg/controller/plan/validation.go:359 +0x8d3
github.com/konveyor/forklift-controller/pkg/controller/plan.(*Reconciler).validate(0xc00213e0f0, 0xc0005bcc00, 0x0, 0x0)
	/remote-source/app/pkg/controller/plan/validation.go:107 +0x28a
github.com/konveyor/forklift-controller/pkg/controller/plan.Reconciler.Reconcile(0x24a0900, 0xc000a8b700, 0x24be300, 0xc000d43410, 0xc00091ce40, 0xc00087cdf0, 0xd, 0xc000657440, 0x2c, 0x0, ...)
	/remote-source/app/pkg/controller/plan/controller.go:217 +0x4a0
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0005541b0, 0x1e75060, 0xc00067e0e0, 0xc00057b000)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:244 +0x284
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0005541b0, 0x203000)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:218 +0xae
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker(0xc0005541b0)
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:197 +0x2b
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc00049a4f0)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc00049a4f0, 0x2462c20, 0xc00093c960, 0x1, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:156 +0xa3
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc00049a4f0, 0x3b9aca00, 0x0, 0x2206b01, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(0xc00049a4f0, 0x3b9aca00, 0xc000116180)
	/remote-source/deps/gomod/pkg/mod/k8s.io/apimachinery.3/pkg/util/wait/wait.go:90 +0x4d
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1
	/remote-source/deps/gomod/pkg/mod/sigs.k8s.io/controller-runtime.4/pkg/internal/controller/controller.go:179 +0x42d


Plan CR Example:
----------------
apiVersion: forklift.konveyor.io/v1beta1
kind: Plan
metadata:

  name: apiauto8fc25f4bb11546eb994f4886d600bfd8-plan
  namespace: openshift-mtv
 
spec:
  map:
    network:
      name: apiauto8fc25f4bb11546eb994f4886d600bfd8
      namespace: openshift-mtv
    storage:
      name: apiauto8fc25f4bb11546eb994f4886d600bfd8
      namespace: openshift-mtv
  provider:
    destination:
      name: host
      namespace: openshift-mtv
    source:
      name: apiauto8fc25f4bb11546eb994f4886d600bfd8
      namespace: openshift-mtv
  vms:
    - name: amos-rh7-cbt

Comment 1 Fabien Dupont 2021-06-23 20:26:45 UTC
@jortel I think that the targetNamespace field should be mandatory.

If I understand correctly, on this line https://github.com/konveyor/forklift-controller/blob/main/pkg/apis/forklift/v1beta1/plan.go#L34, we shouldn't set "omitempty", right?

Comment 2 Sam Lucidi 2021-06-24 19:11:03 UTC
The nil pointer dereference was unrelated to the targetNamespace field on the Plan spec, and can be fixed without changing the fallback behavior or making the field mandatory.

https://github.com/konveyor/forklift-controller/pull/294

Comment 3 Fabien Dupont 2021-07-05 19:52:38 UTC
Please verify with build 2.10-19 / iib:88267.

Comment 4 Amos Mastbaum 2021-08-09 03:09:23 UTC
2.1.0-44 iib:96817
The Plan xxx" is invalid: spec.targetNamespace: Required value

Comment 7 errata-xmlrpc 2021-08-26 07:09:10 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 (Migration Toolkit for Virtualization 2.1.0), 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/RHEA-2021:3278

Comment 8 Red Hat Bugzilla 2023-09-15 01:10:19 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


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