camel-k icon indicating copy to clipboard operation
camel-k copied to clipboard

Pipe with Addressable as `sink` does crash and does not report anything on the status

Open matzew opened this issue 1 year ago • 2 comments

What happened?

Creating a Pipe, and using Knative Broker as source and a regular addressable as the sink does not work.

Here is the pipe:

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
  name: log-sink-pipe
spec:
  source:
    ref:
      kind: Broker
      apiVersion: eventing.knative.dev/v1
      name: test-broker-2
    properties:
      type: com.corp.my.beer.source
  sink:
    ref:
      # kind: Kamelet
      # apiVersion: camel.apache.org/v1
      # name: log-sink
      apiVersion: v1
      kind: Service
      name: kamelet-receiver-function

It seems to work only with a Kamelet. Unfortunately this is not reported on the Pipe's status or the like. See:

k get pipes.camel.apache.org   
NAME               PHASE   REPLICAS
beer-source-pipe   Ready   1
log-sink-pipe              

Or:

k describe pipes.camel.apache.org log-sink-pipe 
Name:         log-sink-pipe
Namespace:    default
Labels:       <none>
Annotations:  <none>
API Version:  camel.apache.org/v1
Kind:         Pipe
Metadata:
  Creation Timestamp:  2024-05-22T07:50:30Z
  Generation:          1
  Resource Version:    6844
  UID:                 7518a953-afe1-4030-be4f-450bc337d363
Spec:
  Sink:
    Ref:
      API Version:  v1
      Kind:         Service
      Name:         kamelet-receiver-function
  Source:
    Properties:
      Type:  com.corp.my.beer.source
    Ref:
      API Version:  eventing.knative.dev/v1
      Kind:         Broker
      Name:         test-broker-2
Events:             <none>

Instead I see log crashes on the log output of the Apache Camel-K Operator

Steps to reproduce

No response

Relevant log output

The log output from the Operator pod:



k logs -f camel-k-operator-69f584d6d9-lwg8w
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"maxprocs: Leaving GOMAXPROCS=[10]: CPU quota undefined"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Go Version: go1.21.0"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Camel K Operator Version: 2.3.1"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Camel K Default Runtime Version: 3.8.1"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Camel K Git Commit: 7e452d288e0a63b07fa39a865c96ac4363465e9c"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Camel K Operator ID: camel-k"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"controller-runtime.metrics","msg":"Metrics server is starting to listen","addr":":8080"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Configuring manager"}
{"level":"info","ts":"2024-05-22T07:54:38Z","logger":"camel-k.cmd","msg":"Installing operator resources"}
{"level":"info","ts":"2024-05-22T07:54:39Z","logger":"camel-k.cmd","msg":"Waited for 1.032406071s due to client-side throttling, not priority and fairness, request: PATCH:https://10.96.0.1:443/apis/camel.apache.org/v1/namespaces/default/kamelets/nats-sink?fieldManager=camel-k-operator&force=true"}
{"level":"info","ts":"2024-05-22T07:54:40Z","logger":"camel-k.cmd","msg":"Synthetic Integration manager not configured, skipping"}
{"level":"info","ts":"2024-05-22T07:54:40Z","logger":"camel-k.cmd","msg":"Starting the manager"}
{"level":"info","ts":"2024-05-22T07:54:40Z","msg":"Starting server","kind":"health probe","addr":"[::]:8081"}
{"level":"info","ts":"2024-05-22T07:54:40Z","msg":"starting server","path":"/metrics","kind":"metrics","addr":"[::]:8080"}
{"level":"info","ts":"2024-05-22T07:54:40Z","logger":"camel-k.cmd","msg":"attempting to acquire leader lease default/camel-k-lock..."}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.cmd","msg":"successfully acquired lease default/camel-k-lock"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.Integration"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"catalog-controller","controllerGroup":"camel.apache.org","controllerKind":"CamelCatalog","source":"kind source: *v1.CamelCatalog"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"catalog-controller","controllerGroup":"camel.apache.org","controllerKind":"CamelCatalog"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.Deployment"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.CronJob"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.IntegrationKit"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"pipe-controller","source":"kind source: *v1.Pipe"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"pipe-controller","source":"kind source: *v1.Integration"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"pipe-controller"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.IntegrationPlatform"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integrationplatform-controller","source":"kind source: *v1.IntegrationPlatform"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"integrationplatform-controller"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.IntegrationProfile"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.ConfigMap"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.Secret"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","source":"kind source: *v1.Pod"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"kamelet-binding-controller","source":"kind source: *v1alpha1.KameletBinding"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"build-controller","controllerGroup":"camel.apache.org","controllerKind":"Build","source":"kind source: *v1.Build"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"build-controller","controllerGroup":"camel.apache.org","controllerKind":"Build"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integrationkit-controller","source":"kind source: *v1.IntegrationKit"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integrationkit-controller","source":"kind source: *v1.Build"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integrationprofile-controller","source":"kind source: *v1.IntegrationProfile"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"integrationkit-controller","source":"kind source: *v1.IntegrationPlatform"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"integrationprofile-controller"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"integrationkit-controller"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting EventSource","controller":"kamelet-binding-controller","source":"kind source: *v1.Integration"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting Controller","controller":"kamelet-binding-controller"}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.cmd","msg":"v1apha1.KameletBinding is deprecated, please, use v1.Pipe instead"}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.cmd","msg":"v1apha1.KameletBinding is deprecated, please, use v1.Pipe instead"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"catalog-controller","controllerGroup":"camel.apache.org","controllerKind":"CamelCatalog","worker count":10}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k","msg":"Kit kit-cp6q6l1vfmp2m1f4mk10 ready, notify integration: beer-source-pipe"}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.controller.catalog","msg":"Invoking action monitor","request-namespace":"default","request-name":"camel-catalog-3.8.1","api-version":"camel.apache.org/v1","kind":"CamelCatalog","ns":"default","name":"camel-catalog-3.8.1"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"integrationplatform-controller","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.controller.integrationplatform","msg":"Invoking action monitor","request-namespace":"default","request-name":"camel-k","api-version":"camel.apache.org/v1","kind":"IntegrationPlatform","ns":"default","name":"camel-k"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"kamelet-binding-controller","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"integrationprofile-controller","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"integrationkit-controller","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"integration-controller","controllerGroup":"camel.apache.org","controllerKind":"Integration","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"build-controller","controllerGroup":"camel.apache.org","controllerKind":"Build","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Starting workers","controller":"pipe-controller","worker count":1}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.controller.integrationkit","msg":"Invoking action monitor","request-namespace":"default","request-name":"kit-cp6q6l1vfmp2m1f4mk10","api-version":"camel.apache.org/v1","kind":"IntegrationKit","ns":"default","name":"kit-cp6q6l1vfmp2m1f4mk10"}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.traits","msg":"Found URL for broker for event test-broker-2: http://broker-ingress.knative-eventing.svc.cluster.local/default/test-broker-2","trait":"knative"}
{"level":"info","ts":"2024-05-22T07:54:56Z","logger":"camel-k.controller.pipe","msg":"Initializing Pipe","request-namespace":"default","request-name":"log-sink-pipe","api-version":"camel.apache.org/v1","kind":"Pipe","ns":"default","name":"log-sink-pipe"}
{"level":"info","ts":"2024-05-22T07:54:56Z","msg":"Observed a panic in reconciler: runtime error: invalid memory address or nil pointer dereference","controller":"pipe-controller","object":{"name":"log-sink-pipe","namespace":"default"},"namespace":"default","name":"log-sink-pipe","reconcileID":"cdad71bd-9566-4a4b-b4f6-5efa5952de41"}
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=0x10 pc=0x1f64633]

goroutine 1098 [running]:
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile.func1()
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:115 +0x1e5
panic({0x2283160?, 0x40e66a0?})
	runtime/panic.go:914 +0x21f
github.com/apache/camel-k/v2/pkg/controller/pipe.CreateIntegrationFor({0x2c92e80, 0xc000d443c0}, {0x2cbe5f0, 0xc0007a3480}, 0xc00042cb40)
	github.com/apache/camel-k/v2/pkg/controller/pipe/integration.go:136 +0xd73
github.com/apache/camel-k/v2/pkg/controller/pipe.(*initializeAction).Handle(0xc000d444b0, {0x2c92e80, 0xc000d443c0}, 0xc00042cb40)
	github.com/apache/camel-k/v2/pkg/controller/pipe/initialize.go:66 +0x14a
github.com/apache/camel-k/v2/pkg/controller/pipe.(*ReconcilePipe).Reconcile(0xc0003e98f0, {0x2c92e80, 0xc000d443c0}, {{{0xc0027251d6?, 0x7f7a6f85fc18?}, {0xc0027251e0?, 0x40?}}})
	github.com/apache/camel-k/v2/pkg/controller/pipe/pipe_controller.go:199 +0x608
github.com/apache/camel-k/v2/pkg/util/monitoring.(*instrumentedReconciler).Reconcile(0xc0003f9180, {0x2c92e80, 0xc000d443c0}, {{{0xc0027251d6?, 0x0?}, {0xc0027251e0?, 0x410925?}}})
	github.com/apache/camel-k/v2/pkg/util/monitoring/controller.go:70 +0xd8
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile(0x2c92e80?, {0x2c92e80?, 0xc000d443c0?}, {{{0xc0027251d6?, 0x211be40?}, {0xc0027251e0?, 0xc00040c460?}}})
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:118 +0xb7
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000926dc0, {0x2c92eb8, 0xc000371630}, {0x238dee0?, 0xc00040c460?})
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:314 +0x365
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000926dc0, {0x2c92eb8, 0xc000371630})
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:265 +0x1af
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:226 +0x79
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2 in goroutine 887
	sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:222 +0x565

Camel K version

2.3.1

matzew avatar May 22 '24 07:05 matzew

We have a limited supported set of Sinks and that one is not going to work for sure. We probably need to work on the documentation side in order to let the user know what's supported and what not and on the logic itself which should not panic and crash the operator. Thanks for reporting.

squakez avatar May 22 '24 08:05 squakez

It relates to https://github.com/apache/camel-k/issues/3501, however for a service we would probably need to enhance that proposal as it is quite hard to determine the right protocol from just the service.

i.e. in the example provided the backing service could be an http endpoint, a kafka broker, etc. ant there is no real way to know about what component to use by leveraging only the service object.

lburgazzoli avatar May 22 '24 08:05 lburgazzoli