squakez commented on code in PR #5419:
URL: https://github.com/apache/camel-k/pull/5419#discussion_r1580833131
##########
pkg/util/knative/knative.go:
##########
@@ -75,7 +75,27 @@ func CreateSubscription(channelReference
corev1.ObjectReference, serviceName str
}
}
-func CreateTrigger(brokerReference corev1.ObjectReference, serviceName string,
eventType string, path string) *eventing.Trigger {
+// CreateServiceTrigger create Knative trigger with arbitrary Kubernetes
Service as a subscriber - usually used when no Knative Serving is available on
the cluster.
+func CreateServiceTrigger(brokerReference corev1.ObjectReference, serviceName
string, eventType string, path string) (*eventing.Trigger, error) {
+ subscriberRef := duckv1.KReference{
+ APIVersion: "v1",
+ Kind: "Service",
+ Name: serviceName,
+ }
+ return CreateTrigger(brokerReference, subscriberRef, eventType, path)
+}
+
+// CreateKnativeServiceTrigger create Knative trigger with Knative Serving
Service as a subscriber - default option when Knative Serving is available on
the cluster.
+func CreateKnativeServiceTrigger(brokerReference corev1.ObjectReference,
serviceName string, eventType string, path string) (*eventing.Trigger, error) {
+ subscriberRef := duckv1.KReference{
+ APIVersion: serving.SchemeGroupVersion.String(),
+ Kind: "Service",
+ Name: serviceName,
+ }
+ return CreateTrigger(brokerReference, subscriberRef, eventType, path)
+}
+
+func CreateTrigger(brokerReference corev1.ObjectReference, subscriberRef
duckv1.KReference, eventType string, path string) (*eventing.Trigger, error) {
Review Comment:
I think it makes sense to have this with a private scope as I think any
client has to call either Service or KnativeService on purpose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]