You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/05/10 10:27:07 UTC
[camel-k] branch main updated: fix(#4336): Restrict Knative binding provider execution for v1alpha1
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 24172037c fix(#4336): Restrict Knative binding provider execution for v1alpha1
24172037c is described below
commit 24172037c0a71caf96fa88afc5282d5edfddfde2
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Tue May 9 19:31:13 2023 +0200
fix(#4336): Restrict Knative binding provider execution for v1alpha1
- Also restrict v1alpha1 binding provider
- Only run the binding provider when Knative is installed on the cluster
- Only run the binding provider when referencing a known Knative resource (e.g. broker, channel, service)
---
pkg/util/bindings/knative_ref.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/pkg/util/bindings/knative_ref.go b/pkg/util/bindings/knative_ref.go
index 0bd0d7bcf..1ab488c1d 100644
--- a/pkg/util/bindings/knative_ref.go
+++ b/pkg/util/bindings/knative_ref.go
@@ -150,6 +150,17 @@ func (k V1alpha1KnativeRefBindingProvider) Translate(ctx V1alpha1BindingContext,
return nil, nil
}
+ if ok, err := isKnownKnativeResource(e.Ref); !ok {
+ // only operates on known Knative endpoint resources (e.g. channels, brokers)
+ return nil, err
+ }
+
+ if knativeInstalled, _ := knative.IsInstalled(ctx.Client); !knativeInstalled {
+ // works only when Knative is installed
+ return nil, fmt.Errorf("integration referencing Knative endpoint '%s' that cannot run, "+
+ "because Knative is not installed on the cluster", e.Ref.Name)
+ }
+
serviceType, err := knative.GetServiceType(*e.Ref)
if err != nil {
return nil, err