Closed matzew closed 5 months ago
Hello Matthias,
I think this error is happening when K_SINK envvar injection is not happening for the Integration deployment. I recall that the K_SINK injection requires Knative serving to be available on the cluster, too.
You should be able to explicitly set the Knative broker as a property on the Pipe sink reference. I need to check for the property name.
Do you have any idea how we could handle the Knative broker URL resolving for the Pipe when K_SINK and Knative serving is not available?
I have no usage of Knative Serving, as that is a separate component. and I dont want to use it :smile:
The pipe has the broker already, as reference:
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: beer-source-pipe
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: beer-source
sink:
properties:
cloudEventsType: com.corp.my.beer.source
ref:
kind: Broker
apiVersion: eventing.knative.dev/v1
name: kamelet
This was working in the past, however for that I had to run a fewer other hacks, see the referenced commit above. (Those I now removed)
I guess one of the hacks was to also install Knative serving. I do not fully understand how the Camel K operator should resolve the Knative broker URL if there is no serving available (with K_SINK SinkBinding injection).
There was no serving installed. I just added the "serivce" CRD, but not more.
A broker is an addressable type, see: https://knative.dev/docs/concepts/duck-typing/#addressable and there are golang apis to resolve the url from those
Really no serving is needed
We have a resolver for addressables: https://github.com/knative/pkg/blob/main/resolver/addressable_resolver.go
And the addressable is basically a named type w/ a apis.URL
(and optional things like certs):
https://github.com/knative/pkg/blob/main/apis/duck/v1/addressable_types.go#L40-L45
You can use it like here, where we want the addressable
/ URI from the subscriber reference of the Trigger:
addressable, err := r.Resolver.AddressableFromDestinationV1(ctx, trigger.Spec.Subscriber, trigger)
...
That way you can resolve the URL. However, I guess you do not directly use our types (e.g. Destination or even KRefs), but we have wrappers for that. see URIFromObjectReference
in the resolver.go file
okay, many thanks for the clarification. Addressable resolver makes sense and I recall that we have that in place somewhere else in Camel K, too.
For the K_SINK injection - just to be sure. Does that mean that the K_SINK is injected by Knative eventing? Serving does not deal with K_SINK at all?
Could be that we create the SinkBinding only when Knative serving is found on the cluster and that needs to be fixed in Camel K.
From an historical POV, the initial integration with Knative was based on the addressable resolver (hand written) which lead to the Knative Environment as we were collecting much more info about the sink. Then, KNative added the K_SINK
injection and we switched to it as it was much simpler from the operator POV.
OK. After I sorted the RBAC in #5410 and I was able to work around on this, by simply applying the Serving CRD. This should not be needed, but it gets me beyond the point.
kubectl apply -f https://raw.githubusercontent.com/knative/serving/main/config/core/300-resources/service.yaml
I am having a look why Camel K requires Knative serving to use K_SINK SinkBinding
What happened?
Installing pure Knative Eventing (just upstream knative eventing) and Camel-K 2.3 via helm, from scripts:
But unable to use Eventing with a simple "beer source" kamelet/pipe. Doing so gives me the following in the pod of the pipe:
In the past I had to add a few hacks to get this working, but w/ the new 2.3.0 release out there I removed those hacks yesterday: https://github.com/matzew/eventing-cloud-integraton/commit/c607fa88eb065fc2b40193b7fa5ead1dcfe74ebb
The fact that the error above says Failed to resolve endpoint: knative://event?apiVersion=eventing.knative.dev%2Fv1&cloudEventsType=com.corp.my.beer.source&kind=Broker seem to me wrong, b/c the addressable broker is there. and is ready:
Steps to reproduce
samples
app folder on the repo (https://github.com/matzew/eventing-cloud-integraton/tree/main/samples/01-local-integrations)Relevant log output
Camel K version
2.3.0