knative-extensions / sample-source

A template project for writing your own Knative eventing source.
Apache License 2.0
28 stars 45 forks source link

Sample source controller panic #643

Open Cali0707 opened 1 week ago

Cali0707 commented 1 week ago

When building the sample source controller from source & deploying with ko, the controller panics:

2024/11/03 19:27:05 Registering 3 clients
2024/11/03 19:27:05 Registering 4 informer factories
2024/11/03 19:27:05 Registering 2 informers
2024/11/03 19:27:05 Registering 1 controllers
{"level":"info","ts":"2024-11-03T19:27:06.036Z","logger":"sample-source-controller","caller":"profiling/server.go:65","msg":"Profiling enabled: false","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":"2024-11-03T19:27:06.041Z","logger":"sample-source-controller","caller":"leaderelection/context.go:47","msg":"Running with Standard leader election","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":"2024-11-03T19:27:06.060Z","logger":"sample-source-controller","caller":"sharedmain/main.go:282","msg":"Starting configuration manager...","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":1730662026.1630673,"logger":"fallback","caller":"injection/injection.go:63","msg":"Starting informers..."}
{"level":"info","ts":"2024-11-03T19:27:06.264Z","logger":"sample-source-controller","caller":"sharedmain/main.go:315","msg":"Starting controllers...","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":"2024-11-03T19:27:06.265Z","logger":"sample-source-controller","caller":"injection/health_check.go:43","msg":"Probes server listening on port 8080","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":"2024-11-03T19:27:06.266Z","logger":"sample-source-controller","caller":"leaderelection/context.go:147","msg":"sample-source-controller.knative.dev.sample-source.pkg.reconciler.sample.reconciler.00-of-01 will run in leader-elected mode with id \"sample-source-controller-757cbc7486-9xhlp_609c93e3-e5ea-489d-a12b-335dc004f175\"","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
{"level":"info","ts":"2024-11-03T19:27:06.266Z","logger":"sample-source-controller","caller":"controller/controller.go:484","msg":"Starting controller and workers","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp","knative.dev/controller":"knative.dev.sample-source.pkg.reconciler.sample.Reconciler","knative.dev/kind":"samples.knative.dev.SampleSource"}
{"level":"info","ts":"2024-11-03T19:27:06.266Z","logger":"sample-source-controller","caller":"controller/controller.go:494","msg":"Started workers","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp","knative.dev/controller":"knative.dev.sample-source.pkg.reconciler.sample.Reconciler","knative.dev/kind":"samples.knative.dev.SampleSource"}
I1103 19:27:06.268249       1 leaderelection.go:250] attempting to acquire leader lease knative-samples/sample-source-controller.knative.dev.sample-source.pkg.reconciler.sample.reconciler.00-of-01...
I1103 19:28:15.328808       1 leaderelection.go:260] successfully acquired lease knative-samples/sample-source-controller.knative.dev.sample-source.pkg.reconciler.sample.reconciler.00-of-01
{"level":"info","ts":"2024-11-03T19:28:15.329Z","logger":"sample-source-controller","caller":"leaderelection/context.go:156","msg":"\"sample-source-controller-757cbc7486-9xhlp_609c93e3-e5ea-489d-a12b-335dc004f175\" has started leading \"sample-source-controller.knative.dev.sample-source.pkg.reconciler.sample.reconciler.00-of-01\"","commit":"21cba37-dirty","knative.dev/pod":"sample-source-controller-757cbc7486-9xhlp"}
panic: No ConfigMapLister found in context.

goroutine 149 [running]:
knative.dev/eventing/pkg/apis/sources/v1.GetTrustBundleConfigMapLister(...)
    knative.dev/eventing@v0.42.1-0.20240926123447-e7fca7646f4a/pkg/apis/sources/v1/sinkbinding_lifecycle.go:322
knative.dev/eventing/pkg/apis/sources/v1.(*SinkBinding).Do(0xc000b1e000, {0x2217688, 0xc000b12540}, 0xc000c05e60)
    knative.dev/eventing@v0.42.1-0.20240926123447-e7fca7646f4a/pkg/apis/sources/v1/sinkbinding_lifecycle.go:200 +0x1b05
knative.dev/sample-source/pkg/reconciler.syncSink(...)
    knative.dev/sample-source/pkg/reconciler/deployment.go:121
knative.dev/sample-source/pkg/reconciler.podSpecSync({_, _}, _, {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc000b22000, ...}, ...}, ...)
    knative.dev/sample-source/pkg/reconciler/deployment.go:111 +0x3b8
knative.dev/sample-source/pkg/reconciler.(*DeploymentReconciler).ReconcileDeployment(0xc0004b4b10, {0x2217688, 0xc000b12540}, {0x21fed10, 0xc0008e0a80}, 0xc000b1e000, 0xc0008c4a08)
    knative.dev/sample-source/pkg/reconciler/deployment.go:71 +0x2f3
knative.dev/sample-source/pkg/reconciler/sample.(*Reconciler).ReconcileKind(0xc0004b7380, {0x2217688?, 0xc000b12450?}, 0xc0008e0a80)
    knative.dev/sample-source/pkg/reconciler/sample/samplesource.go:59 +0x38f
knative.dev/sample-source/pkg/client/injection/reconciler/samples/v1alpha1/samplesource.(*reconcilerImpl).Reconcile(0xc0002da140, {0x2217688, 0xc000b12420}, {0xc0001c2f60, 0x27})
    knative.dev/sample-source/pkg/client/injection/reconciler/samples/v1alpha1/samplesource/reconciler.go:240 +0x52b
knative.dev/pkg/controller.(*Impl).processNextWorkItem(0xc0004b09c0)
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:540 +0x508
knative.dev/pkg/controller.(*Impl).RunContext.func3()
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:489 +0x59
created by knative.dev/pkg/controller.(*Impl).RunContext in goroutine 147
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:487 +0x31f
panic: No ConfigMapLister found in context.

goroutine 150 [running]:
knative.dev/eventing/pkg/apis/sources/v1.GetTrustBundleConfigMapLister(...)
    knative.dev/eventing@v0.42.1-0.20240926123447-e7fca7646f4a/pkg/apis/sources/v1/sinkbinding_lifecycle.go:322
knative.dev/eventing/pkg/apis/sources/v1.(*SinkBinding).Do(0xc000adc000, {0x2217688, 0xc000abfb00}, 0xc000b3fe60)
    knative.dev/eventing@v0.42.1-0.20240926123447-e7fca7646f4a/pkg/apis/sources/v1/sinkbinding_lifecycle.go:200 +0x1b05
knative.dev/sample-source/pkg/reconciler.syncSink(...)
    knative.dev/sample-source/pkg/reconciler/deployment.go:121
knative.dev/sample-source/pkg/reconciler.podSpecSync({_, _}, _, {{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc000ad6480, ...}, ...}, ...)
    knative.dev/sample-source/pkg/reconciler/deployment.go:111 +0x3b8
knative.dev/sample-source/pkg/reconciler.(*DeploymentReconciler).ReconcileDeployment(0xc0004b4b10, {0x2217688, 0xc000abfb00}, {0x21fed10, 0xc00081a380}, 0xc000adc000, 0xc00082ea08)
    knative.dev/sample-source/pkg/reconciler/deployment.go:71 +0x2f3
knative.dev/sample-source/pkg/reconciler/sample.(*Reconciler).ReconcileKind(0xc0004b7380, {0x2217688?, 0xc000abfa40?}, 0xc00081a380)
    knative.dev/sample-source/pkg/reconciler/sample/samplesource.go:59 +0x38f
knative.dev/sample-source/pkg/client/injection/reconciler/samples/v1alpha1/samplesource.(*reconcilerImpl).Reconcile(0xc0002da140, {0x2217688, 0xc000abfa10}, {0xc000628ca0, 0x1d})
    knative.dev/sample-source/pkg/client/injection/reconciler/samples/v1alpha1/samplesource/reconciler.go:240 +0x52b
knative.dev/pkg/controller.(*Impl).processNextWorkItem(0xc0004b09c0)
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:540 +0x508
knative.dev/pkg/controller.(*Impl).RunContext.func3()
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:489 +0x59
created by knative.dev/pkg/controller.(*Impl).RunContext in goroutine 147
    knative.dev/pkg@v0.0.0-20240930065954-503173341499/controller/controller.go:487 +0x31f
Cali0707 commented 1 week ago

/cc @pierDipi @creydr