The noobaa operator is crashing with panic: runtime error: invalid memory address or nil pointer dereference [recovered] #1375
Open
Description
Environment info
- NooBaa Operator Version: noobaa-operator:5.15.2
- Platform: minikube v1.33.1 on Ubuntu 22.04.4 LTS and OpenShift 4.14
Actual behavior
- When we apply noobaaccount, the noobaa operator will crash with the error.
root@ubuntu-011:~# oc create -f noobaaacount_cr.yaml
noobaaaccount.noobaa.io/default created
root@ubuntu-011:~#
root@ubuntu-011:~# oc get pods
NAME READY STATUS RESTARTS AGE
noobaa-core-0 1/1 Running 0 2d13h
noobaa-db-pg-0 1/1 Running 0 2d13h
noobaa-default-backing-store-noobaa-pod-4e5fdaa7 1/1 Running 0 2d13h
noobaa-endpoint-6d78f84dcd-8dgvg 1/1 Running 0 2d13h
noobaa-operator-5b57c57687-tnk46 0/1 CrashLoopBackOff 4 (60s ago) 2d13h
root@ubuntu-011:~#
time="2024-06-14T03:08:18Z" level=info msg="✅ Exists: BackingStore \"noobaa-default-backing-store\"\n"
time="2024-06-14T03:08:18Z" level=info msg="✅ Exists: Secret \"noobaa-admin\"\n"
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=0x0 pc=0x1f48c44]
goroutine 1673 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:116 +0x1e5
panic({0x22d49c0?, 0x4299610?})
/opt/homebrew/Cellar/go/1.22.2/libexec/src/runtime/panic.go:770 +0x132
github.com/noobaa/noobaa-operator/v5/pkg/noobaaaccount.(*Reconciler).CreateNooBaaAccount(0xc0011ab5e0)
/Users/usrivast/dev/noobaa/origs/noobaa-operator/pkg/noobaaaccount/reconciler.go:336 +0xe4
github.com/noobaa/noobaa-operator/v5/pkg/noobaaaccount.(*Reconciler).ReconcilePhaseConfiguring(0xc0011ab5e0)
/Users/usrivast/dev/noobaa/origs/noobaa-operator/pkg/noobaaaccount/reconciler.go:266 +0x9b
github.com/noobaa/noobaa-operator/v5/pkg/noobaaaccount.(*Reconciler).ReconcilePhases(0xc0011ab5e0)
/Users/usrivast/dev/noobaa/origs/noobaa-operator/pkg/noobaaaccount/reconciler.go:154 +0x36
github.com/noobaa/noobaa-operator/v5/pkg/noobaaaccount.(*Reconciler).Reconcile(0xc0011ab5e0)
/Users/usrivast/dev/noobaa/origs/noobaa-operator/pkg/noobaaaccount/reconciler.go:111 +0x105
github.com/noobaa/noobaa-operator/v5/pkg/controller/noobaaaccount.Add.func1({0xc000101808?, 0xc000d0e980?}, {{{0xc001053f78?, 0xc001588d20?}, {0xc001053f70?, 0xc001588cf0?}}})
/Users/usrivast/dev/noobaa/origs/noobaa-operator/pkg/controller/noobaaaccount/noobaaaccount_controller.go:33 +0xd6
sigs.k8s.io/controller-runtime/pkg/reconcile.Func.Reconcile(0x7f4347e125b8?, {0x2e5fc48?, 0xc00110d3b0?}, {{{0xc001053f78?, 0xc000d0e980?}, {0xc001053f70?, 0xc001588d50?}}})
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/reconcile/reconcile.go:111 +0x3d
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x2e65b18?, {0x2e5fc48?, 0xc00110d3b0?}, {{{0xc001053f78?, 0xb?}, {0xc001053f70?, 0x0?}}})
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:119 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc0005e8c80, {0x2e5fc80, 0xc0007f6af0}, {0x23ed400, 0xc001510ea0})
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:316 +0x3bc
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc0005e8c80, {0x2e5fc80, 0xc0007f6af0})
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266 +0x1c9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 209
/Users/usrivast/dev/noobaa/origs/noobaa-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:223 +0x50c
root@ubuntu-011:~#
Expected behavior
- The noobaaccunt CR https://github.com/noobaa/noobaa-operator/blob/master/deploy/crds/noobaa.io_v1alpha1_noobaaaccount_cr.yaml needs an update, this one will not get applied.
root@ubuntu-011:~# oc create -f noobaaacount_cr.yaml
The NooBaaAccount "default" is invalid: spec.allow_bucket_creation: Required value
root@ubuntu-011:~#
- The https://github.com/noobaa/noobaa-operator/blob/master/deploy/crds/noobaa.io_noobaaaccounts.yaml has only one property required, this is also need inspection.
Steps to reproduce
- nooba install using CLI is installing nooba perfectly. This do not apply noobaaaccount CR.
- This time the pods can see in Running state without restart as shown below.
root@ubuntu-011:~# oc get pods
NAME READY STATUS RESTARTS AGE
noobaa-core-0 1/1 Running 0 2d13h
noobaa-db-pg-0 1/1 Running 0 2d13h
noobaa-default-backing-store-noobaa-pod-4e5fdaa7 1/1 Running 0 2d13h
noobaa-endpoint-6d78f84dcd-8dgvg 1/1 Running 0 2d13h
noobaa-operator-5b57c57687-tnk46 1/1 Running 0 2d13h
root@ubuntu-011:~#
root@ubuntu-011:~# oc get noobaa
NAME S3-ENDPOINTS STS-ENDPOINTS IMAGE PHASE AGE
noobaa ["https://192.168.49.2:32420"] ["https://192.168.49.2:30220"] noobaa/noobaa-core:master-20230920 Ready 2d13h
root@ubuntu-011:~#
- Then apply the
noobaaaccount_cr
as shown below.
root@ubuntu-011:~# cat noobaaacount_cr.yaml
apiVersion: noobaa.io/v1alpha1
kind: NooBaaAccount
metadata:
name: default
spec:
allow_bucket_creation: true
default_resource: noobaa-default-backing-store
root@ubuntu-011:~#
root@ubuntu-011:~# oc create -f noobaaacount_cr.yaml
noobaaaccount.noobaa.io/default created
root@ubuntu-011:~#
- Then when you look at the pods status, we can see nooba operator pods started restarting.
root@ubuntu-011:~# oc get pods
NAME READY STATUS RESTARTS AGE
noobaa-core-0 1/1 Running 0 2d13h
noobaa-db-pg-0 1/1 Running 0 2d13h
noobaa-default-backing-store-noobaa-pod-4e5fdaa7 1/1 Running 0 2d13h
noobaa-endpoint-6d78f84dcd-8dgvg 1/1 Running 0 2d13h
noobaa-operator-5b57c57687-tnk46 0/1 CrashLoopBackOff 4 (60s ago) 2d13h
root@ubuntu-011:~#
root@ubuntu-011:~# kubectl get noobaaaccount
NAME PHASE AGE
default 116m
root@ubuntu-011:~#
More information - Screenshots / Logs / Other output
To satisfy nooba operator. the following CR (with force_md5_etag: no) needs to be applied, then the operator will not crash and the noobaccount will get into ready state.
root@ubuntu-011:~# cat noobaaacount_cr.yaml
apiVersion: noobaa.io/v1alpha1
kind: NooBaaAccount
metadata:
name: default
spec:
allow_bucket_creation: true
default_resource: noobaa-default-backing-store
force_md5_etag: no
root@ubuntu-011:~#
root@ubuntu-011:~# oc delete -f noobaaacount_cr.yaml
noobaaaccount.noobaa.io "default" deleted
root@ubuntu-011:~#
And then operator will get settled, no more new restarts.
root@ubuntu-011:~# kubectl get pods -w
NAME READY STATUS RESTARTS AGE
noobaa-core-0 1/1 Running 0 2d15h
noobaa-db-pg-0 1/1 Running 0 2d15h
noobaa-default-backing-store-noobaa-pod-4e5fdaa7 1/1 Running 0 2d15h
noobaa-endpoint-6d78f84dcd-8dgvg 1/1 Running 0 2d15h
noobaa-operator-5b57c57687-tnk46 1/1 Running 28 (8m32s ago) 2d15h
Then can see noobaaaccount ready.
root@ubuntu-011:~# oget noobaaaccountl
NAME PHASE AGE
default Ready 2m31s
root@ubuntu-011:~#
I will attach the nooba operator log during crash.
Metadata
Assignees
Labels
No labels