You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/08/19 04:52:53 UTC

[camel-k] branch main updated: fix(knative): Fix the knative pods created unitl exhaustion

This is an automated email from the ASF dual-hosted git repository.

tsato 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 e7510e29a fix(knative): Fix the knative pods created unitl exhaustion
e7510e29a is described below

commit e7510e29a179b0854de94704dfd6bb6758db4c49
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Mon Aug 15 20:58:43 2022 -0300

    fix(knative): Fix the knative pods created unitl exhaustion
    
    Setting the sinkbing label when the knative service is
    created seems the right place, instead to update the label
    seens to trigger a new knative configuration
    https://github.com/apache/camel-k/issues/3522
---
 pkg/trait/knative.go         | 9 ---------
 pkg/trait/knative_service.go | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index 4db8a43f3..3b59c6fdf 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -472,15 +472,6 @@ func (t *knativeTrait) configureSinkBinding(e *Environment, env *knativeapi.Came
 					// before the reference source, so that the SinkBinding webhook has
 					// all the information to perform injection.
 					e.Resources.AddFirst(knativeutil.CreateSinkBinding(source, target))
-
-					// Make sure the Eventing webhook will select the source resource,
-					// in order to inject the sink information.
-					// This is necessary for Knative environments, that are configured
-					// with SINK_BINDING_SELECTION_MODE=inclusion.
-					// See:
-					// - https://knative.dev/v0.20-docs/eventing/sources/sinkbinding/
-					// - https://github.com/knative/operator/blob/c60e62bb86ff318c44d1520927d2182659cfdeb5/docs/configuration.md#specsinkbindingselectionmode
-					controller.GetLabels()["bindings.knative.dev/include"] = "true"
 				}
 				return nil
 			})
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index e0a8bf62a..606aafd14 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -228,6 +228,14 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, e
 
 	serviceLabels := map[string]string{
 		v1.IntegrationLabel: e.Integration.Name,
+		// Make sure the Eventing webhook will select the source resource,
+		// in order to inject the sink information.
+		// This is necessary for Knative environments, that are configured
+		// with SINK_BINDING_SELECTION_MODE=inclusion.
+		// See:
+		// - https://knative.dev/v1.3-docs/eventing/custom-event-source/sinkbinding/create-a-sinkbinding/#optional-choose-sinkbinding-namespace-selection-behavior
+		// - https://github.com/knative/operator/blob/release-1.2/docs/configuration.md#specsinkbindingselectionmode
+		"bindings.knative.dev/include": "true",
 	}
 	if t.Visibility != "" {
 		serviceLabels[knativeServingVisibilityLabel] = t.Visibility