Open ss025 opened 1 year ago
I am also facing a Reconciler error, but for me its related to array index out of bounds
2023-12-21T17:10:48Z INFO controller-runtime.metrics Metrics server is starting to listen {"addr": "127.0.0.1:8080"} │
│ 2023-12-21T17:10:48Z INFO setup starting manager │
│ 2023-12-21T17:10:48Z INFO Starting server {"kind": "health probe", "addr": ":8081"} │
│ 2023-12-21T17:10:48Z INFO starting server {"path": "/metrics", "kind": "metrics", "addr": "127.0.0.1:8080"} │
│ I1221 17:10:48.008736 1 leaderelection.go:250] attempting to acquire leader lease nginx-operator-system/624297ef.example.com... │
│ I1221 17:11:05.429593 1 leaderelection.go:260] successfully acquired lease nginx-operator-system/624297ef.example.com │
│ 2023-12-21T17:11:05Z INFO Starting EventSource {"controller": "nginxoperator", "controllerGroup": "operator.example.com", "controllerKind": "NginxOperator", "source": "kind source: *v1alpha1.NginxOper │
│ 2023-12-21T17:11:05Z INFO Starting EventSource {"controller": "nginxoperator", "controllerGroup": "operator.example.com", "controllerKind": "NginxOperator", "source": "kind source: *v1.Deployment"} │
│ 2023-12-21T17:11:05Z INFO Starting Controller {"controller": "nginxoperator", "controllerGroup": "operator.example.com", "controllerKind": "NginxOperator"} │
│ 2023-12-21T17:11:05Z DEBUG events nginx-operator-controller-manager-66bcbcfd98-jcxqv_be110471-8a47-4879-b828-c6e1e9014569 became leader {"type": "Normal", "object": {"kind":"Lease","namespace":"ngi │
│ 2023-12-21T17:11:05Z INFO Starting workers {"controller": "nginxoperator", "controllerGroup": "operator.example.com", "controllerKind": "NginxOperator", "worker count": 1} │
│ 2023-12-21T17:11:05Z INFO Observed a panic in reconciler: runtime error: index out of range [0] with length 0 {"controller": "nginxoperator", "controllerGroup": "operator.example.com", "controllerKind │
│ panic: runtime error: index out of range [0] with length 0 [recovered] │
│ panic: runtime error: index out of range [0] with length 0 │
│ │
│ goroutine 178 [running]: │
│ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1() │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:115 +0x1fa │
│ panic({0x1715b20, 0xc00004bc20}) │
│ /usr/local/go/src/runtime/panic.go:884 +0x212 │
│ github.com/Lucifergene/nginx-operator/controllers.(*NginxOperatorReconciler).Reconcile(0xc000010e58, {0x1a826f8, 0xc00028cab0}, {{{0xc00004a8d0?, 0x10?}, {0xc00004fb70?, 0x40dc07?}}}) │
│ /workspace/controllers/nginxoperator_controller.go:107 +0xebd │
│ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x1a826f8?, {0x1a826f8?, 0xc00028cab0?}, {{{0xc00004a8d0?, 0x15af940?}, {0xc00004fb70?, 0x10?}}}) │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:118 +0xc8 │
│ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000120460, {0x1a82650, 0xc0006aa500}, {0x16a04c0?, 0xc00050c280?}) │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:314 +0x3a5 │
│ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000120460, {0x1a82650, 0xc0006aa500}) │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:265 +0x1d9 │
│ sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2() │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:226 +0x85 │
│ created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 │
│ /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.3/pkg/internal/controller/controller.go:222 +0x333 │
│ Stream closed EOF for nginx-operator-system/nginx-operator-controller-manager-66bcbcfd98-jcxqv (manager) │
│
Sent a mail to the author requesting him to look into the Reconciler logic once.
Hi, thanks for reporting these. I have been out of the office for a few months and am catching back up. Will take a look and update here once I have it figured out. It's possible that more recent updates to the operator framework and sdk after the book was published (along with this code) have broken some things.
@ss025 @Lucifergene if you could, in the meantime, please try running the code from this repo exactly as cloned (without running any go mod tidy
or go get
, etc commands). From the stack trace you provided @Lucifergene I see you are running v0.15.3
of the controller-runtime
dependency while the code in this repo was written with v0.11.0. This may or may not help, but it can at least rule out dependency skew. Thanks!
Thanks @damemi
I ran the code from the repo without any package update, and the issue I pointed out -"Array index out of bounds" was not visible anymore. Thanks for your advice!
But now, I can see the error @ss025 had pointed out initially, i.e. "environment variable OPERATOR_CONDITION_NAME not set".
I think I need to install the OLM to get this env. Will verify it once and reply.
Although, make deploy
helps to install the operator on the cluster, this error prevents the deployments from persisting in the cluster.
I am facing error while deploying sample-cr.yaml