From 7d427aa40766c850ff81cea8b018dad5e273c70e Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Fri, 21 Aug 2026 08:26:20 +0200 Subject: [PATCH] feat(trait): deprecate knative eventing Closes #6648 --- .../ROOT/partials/apis/camel-k-crds.adoc | 4 + docs/modules/traits/pages/knative.adoc | 6 + e2e/install/kustomize/multi_namespace_test.go | 8 +- .../kustomize/single_namespace_test.go | 6 +- e2e/knative/files/PlatformHttpServer.java | 26 --- e2e/knative/files/knative1.yaml | 37 ----- e2e/knative/files/knative2.yaml | 23 --- e2e/knative/files/knative3.yaml | 23 --- e2e/knative/files/knativech1.yaml | 24 --- e2e/knative/files/knativech2.yaml | 22 --- e2e/knative/files/knativeevt1.yaml | 31 ---- e2e/knative/files/knativeevt2.yaml | 27 --- e2e/knative/files/knativegetpost1.yaml | 27 --- e2e/knative/files/knativegetpost2.yaml | 22 --- e2e/knative/files/knativemultihop1.yaml | 31 ---- e2e/knative/files/knativemultihop2.yaml | 25 --- e2e/knative/files/knativemultihop3.yaml | 29 ---- e2e/knative/files/petstore.yaml | 39 ----- e2e/knative/files/podtest-knative1.yaml | 25 --- e2e/knative/files/podtest-knative2.yaml | 23 --- e2e/knative/files/template-knative.yaml | 22 --- e2e/knative/files/test-kamelet-display.yaml | 22 --- e2e/knative/files/yaml.yaml | 29 ---- e2e/knative/kamelet_test.go | 92 ----------- e2e/knative/knative_pipes_test.go | 154 ------------------ e2e/knative/knative_platform_test.go | 45 ----- e2e/knative/knative_service_test.go | 20 +-- e2e/knative/pod_test.go | 47 ------ e2e/support/test_support.go | 101 +----------- pkg/apis/camel/v1/trait/knative.go | 6 + pkg/trait/knative.go | 11 +- pkg/trait/knative_test.go | 24 +-- 32 files changed, 59 insertions(+), 972 deletions(-) delete mode 100644 e2e/knative/files/PlatformHttpServer.java delete mode 100644 e2e/knative/files/knative1.yaml delete mode 100644 e2e/knative/files/knative2.yaml delete mode 100644 e2e/knative/files/knative3.yaml delete mode 100644 e2e/knative/files/knativech1.yaml delete mode 100644 e2e/knative/files/knativech2.yaml delete mode 100644 e2e/knative/files/knativeevt1.yaml delete mode 100644 e2e/knative/files/knativeevt2.yaml delete mode 100644 e2e/knative/files/knativegetpost1.yaml delete mode 100644 e2e/knative/files/knativegetpost2.yaml delete mode 100644 e2e/knative/files/knativemultihop1.yaml delete mode 100644 e2e/knative/files/knativemultihop2.yaml delete mode 100644 e2e/knative/files/knativemultihop3.yaml delete mode 100644 e2e/knative/files/petstore.yaml delete mode 100644 e2e/knative/files/podtest-knative1.yaml delete mode 100644 e2e/knative/files/podtest-knative2.yaml delete mode 100644 e2e/knative/files/template-knative.yaml delete mode 100644 e2e/knative/files/test-kamelet-display.yaml delete mode 100644 e2e/knative/files/yaml.yaml delete mode 100644 e2e/knative/kamelet_test.go delete mode 100644 e2e/knative/knative_pipes_test.go delete mode 100644 e2e/knative/knative_platform_test.go delete mode 100644 e2e/knative/pod_test.go diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc index 91639092df..adc2d0214a 100644 --- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc +++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc @@ -8525,9 +8525,13 @@ running integration. The Camel Knative component will then use the full configuration to configure the routes. +WARNING: The Knative trait is **deprecated** and will be removed in future release versions: +use Camel (Quarkus) Knative component instead. + The trait is enabled by default when the Knative profile is active. + [cols="2,2a",options="header"] |=== |Field diff --git a/docs/modules/traits/pages/knative.adoc b/docs/modules/traits/pages/knative.adoc index b9b6e8e32a..19cb217184 100755 --- a/docs/modules/traits/pages/knative.adoc +++ b/docs/modules/traits/pages/knative.adoc @@ -1,6 +1,8 @@ = Knative Trait // Start of autogenerated code - DO NOT EDIT! (badges) +[.badges] +[.badge-key]##Deprecated since##[.badge-unsupported]##2.11.0## // End of autogenerated code - DO NOT EDIT! (badges) // Start of autogenerated code - DO NOT EDIT! (description) The Knative trait automatically discovers addresses of Knative resources and inject them into the @@ -8,9 +10,13 @@ running integration. The Camel Knative component will then use the full configuration to configure the routes. +WARNING: The Knative trait is **deprecated** and will be removed in future release versions: +use Camel (Quarkus) Knative component instead. + The trait is enabled by default when the Knative profile is active. + This trait is available in the following profiles: **Knative**. // End of autogenerated code - DO NOT EDIT! (description) diff --git a/e2e/install/kustomize/multi_namespace_test.go b/e2e/install/kustomize/multi_namespace_test.go index 042a8d6e33..735d4b3e05 100644 --- a/e2e/install/kustomize/multi_namespace_test.go +++ b/e2e/install/kustomize/multi_namespace_test.go @@ -62,7 +62,7 @@ func TestKustomizeMultiNamespace(t *testing.T) { // Test a simple integration in "tenant-z" is not reconciled g.Expect(KamelRun(t, ctx, tenantNs, "files/yaml.yaml").Execute()).To(Succeed()) g.Consistently(IntegrationPhase(t, ctx, tenantNs, "yaml"), 30*time.Second).Should(BeEmpty()) - }, "tenant-z", true) + }, "tenant-z") // Test a simple integration in "tenant-a" is reconciled and runs correctly g.Expect(KamelRun(t, ctx, tenantANs, "files/yaml.yaml").Execute()).To(Succeed()) @@ -92,7 +92,7 @@ func TestKustomizeMultiNamespace(t *testing.T) { g.Eventually(OperatorPod(t, ctx, operatorNs)).Should(BeNil()) g.Eventually(CRDs(t)).Should(BeNil()) - }, "tenant-b", true) - }, "tenant-a", true) - }, "operators", true) + }, "tenant-b") + }, "tenant-a") + }, "operators") } diff --git a/e2e/install/kustomize/single_namespace_test.go b/e2e/install/kustomize/single_namespace_test.go index 7a8ab9a1f8..158401a6f3 100644 --- a/e2e/install/kustomize/single_namespace_test.go +++ b/e2e/install/kustomize/single_namespace_test.go @@ -61,7 +61,7 @@ func TestKustomizeSingleNamespace(t *testing.T) { // Test a simple integration in "tenant-b" is not reconciled g.Expect(KamelRun(t, ctx, tenantNs, "files/yaml.yaml").Execute()).To(Succeed()) g.Consistently(IntegrationPhase(t, ctx, tenantNs, "yaml"), 30*time.Second).Should(BeEmpty()) - }, "tenant-b", true) + }, "tenant-b") // Test a simple integration in "tenant-a" is reconciled and runs correctly g.Expect(KamelRun(t, ctx, tenantNs, "files/yaml.yaml").Execute()).To(Succeed()) @@ -82,6 +82,6 @@ func TestKustomizeSingleNamespace(t *testing.T) { g.Eventually(OperatorPod(t, ctx, operatorNs)).Should(BeNil()) g.Eventually(CRDs(t)).Should(BeNil()) - }, "tenant-a", true) - }, "operators", true) + }, "tenant-a") + }, "operators") } diff --git a/e2e/knative/files/PlatformHttpServer.java b/e2e/knative/files/PlatformHttpServer.java deleted file mode 100644 index 31d8d19f3e..0000000000 --- a/e2e/knative/files/PlatformHttpServer.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.apache.camel.builder.RouteBuilder; - -public class PlatformHttpServer extends RouteBuilder { - @Override - public void configure() throws Exception { - from("platform-http:/hello?httpMethodRestrict=GET") - .setBody(simple("Hello ${header.name}")); - } -} diff --git a/e2e/knative/files/knative1.yaml b/e2e/knative/files/knative1.yaml deleted file mode 100644 index 7ee49eef9e..0000000000 --- a/e2e/knative/files/knative1.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "" - - choice: - when: - - simple: "${random(0, 2)} == 0" - steps: - - to: - uri: "knative:endpoint/knative2" - - log: "Received from 2: ${body}" - otherwise: - steps: - - to: - uri: "knative:endpoint/knative3" - - log: "Received from 3: ${body}" - - diff --git a/e2e/knative/files/knative2.yaml b/e2e/knative/files/knative2.yaml deleted file mode 100644 index a6a0b03adf..0000000000 --- a/e2e/knative/files/knative2.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:endpoint/knative2" - steps: - - setBody: - constant: "Hello from knative2" diff --git a/e2e/knative/files/knative3.yaml b/e2e/knative/files/knative3.yaml deleted file mode 100644 index c80b7c47c6..0000000000 --- a/e2e/knative/files/knative3.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:endpoint/knative3" - steps: - - setBody: - constant: "Hello from knative3" diff --git a/e2e/knative/files/knativech1.yaml b/e2e/knative/files/knativech1.yaml deleted file mode 100644 index 3c63e8240b..0000000000 --- a/e2e/knative/files/knativech1.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "Hello from knativech1" - - to: "knative:channel/messages" diff --git a/e2e/knative/files/knativech2.yaml b/e2e/knative/files/knativech2.yaml deleted file mode 100644 index ca9aa38bda..0000000000 --- a/e2e/knative/files/knativech2.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:channel/messages" - steps: - - log: "Received: ${body}" diff --git a/e2e/knative/files/knativeevt1.yaml b/e2e/knative/files/knativeevt1.yaml deleted file mode 100644 index 395e0956de..0000000000 --- a/e2e/knative/files/knativeevt1.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "Hello 1" - - to: "knative:event/hello.1" - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "Hello 2" - - to: "knative:event/hello.2" diff --git a/e2e/knative/files/knativeevt2.yaml b/e2e/knative/files/knativeevt2.yaml deleted file mode 100644 index 8e91bb0070..0000000000 --- a/e2e/knative/files/knativeevt2.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:event/hello.1" - steps: - - log: "Received 1: ${body}" - -- from: - uri: "knative:event/hello.2" - steps: - - log: "Received 2: ${body}" diff --git a/e2e/knative/files/knativegetpost1.yaml b/e2e/knative/files/knativegetpost1.yaml deleted file mode 100644 index da0c2dc188..0000000000 --- a/e2e/knative/files/knativegetpost1.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "" - - setHeader: - name: "CamelHttpMethod" - constant: "GET" - - to: "knative:channel/messages" diff --git a/e2e/knative/files/knativegetpost2.yaml b/e2e/knative/files/knativegetpost2.yaml deleted file mode 100644 index 2faf7ecd35..0000000000 --- a/e2e/knative/files/knativegetpost2.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:channel/messages" - steps: - - log: "Received: [${body}]" diff --git a/e2e/knative/files/knativemultihop1.yaml b/e2e/knative/files/knativemultihop1.yaml deleted file mode 100644 index 78206859cc..0000000000 --- a/e2e/knative/files/knativemultihop1.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "message" - - to: "knative:channel/messages" - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "word" - - to: "knative:channel/words" diff --git a/e2e/knative/files/knativemultihop2.yaml b/e2e/knative/files/knativemultihop2.yaml deleted file mode 100644 index c7723dc81e..0000000000 --- a/e2e/knative/files/knativemultihop2.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:channel/messages" - steps: - - setBody: - simple: "transformed ${body}" - - log: "Forwarding: ${body}" - - to: "knative:channel/words" diff --git a/e2e/knative/files/knativemultihop3.yaml b/e2e/knative/files/knativemultihop3.yaml deleted file mode 100644 index 1e169880b0..0000000000 --- a/e2e/knative/files/knativemultihop3.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:channel/messages" - steps: - - log: "From messages: ${body}" - - to: "log:messages?showHeaders=true" - -- from: - uri: "knative:channel/words" - steps: - - log: "From words: ${body}" - - to: "log:words?showHeaders=true" diff --git a/e2e/knative/files/petstore.yaml b/e2e/knative/files/petstore.yaml deleted file mode 100644 index 72087814fe..0000000000 --- a/e2e/knative/files/petstore.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# camel-k: language=yaml - -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "direct:listPets" - steps: - - setBody: - simple: "listPets" - - to: "log:info" - -- from: - uri: "direct:createPets" - steps: - - setBody: - simple: "createPets" - - to: "log:info" - -- from: - uri: "direct:showPetById" - steps: - - setBody: - simple: "showPetById" - - to: "log:info" diff --git a/e2e/knative/files/podtest-knative1.yaml b/e2e/knative/files/podtest-knative1.yaml deleted file mode 100644 index 348cf24fe3..0000000000 --- a/e2e/knative/files/podtest-knative1.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:tick" - steps: - - setBody: - constant: "" - - to: "knative:endpoint/podtest-knative2" - - log: "Received: ${body}" diff --git a/e2e/knative/files/podtest-knative2.yaml b/e2e/knative/files/podtest-knative2.yaml deleted file mode 100644 index 7950f03614..0000000000 --- a/e2e/knative/files/podtest-knative2.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:endpoint/podtest-knative2" - steps: - - setBody: - constant: "{{TEST_ENV_VARIABLE}}" diff --git a/e2e/knative/files/template-knative.yaml b/e2e/knative/files/template-knative.yaml deleted file mode 100644 index 2c7ac347a6..0000000000 --- a/e2e/knative/files/template-knative.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -containers: - - name: integration - env: - - name: TEST_ENV_VARIABLE - value: "hello from the template" \ No newline at end of file diff --git a/e2e/knative/files/test-kamelet-display.yaml b/e2e/knative/files/test-kamelet-display.yaml deleted file mode 100644 index 9dc85e2c4e..0000000000 --- a/e2e/knative/files/test-kamelet-display.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "knative:channel/test-kamelet-messages" - steps: - - to: "log:info?showAll=false" diff --git a/e2e/knative/files/yaml.yaml b/e2e/knative/files/yaml.yaml deleted file mode 100644 index e69c8db7a8..0000000000 --- a/e2e/knative/files/yaml.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# camel-k: language=yaml -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -- from: - uri: "timer:yaml" - parameters: - period: "5000" - steps: - - setHeader: - name: "m" - constant: "string!" - - setBody: - simple: "Magic${header.m}" - - to: "log:info" diff --git a/e2e/knative/kamelet_test.go b/e2e/knative/kamelet_test.go deleted file mode 100644 index bd5a71c0fa..0000000000 --- a/e2e/knative/kamelet_test.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build integration -// +build integration - -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" - -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package knative - -import ( - "context" - "fmt" - "testing" - - . "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - - messaging "knative.dev/eventing/pkg/apis/messaging/v1" - - . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" -) - -// Test that a Pipe can be changed and the changes are propagated to the Integration -func TestKameletChange(t *testing.T) { - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - timerPipe := "timer-binding" - - knChannel := "test-kamelet-messages" - knChannelConf := fmt.Sprintf("%s:InMemoryChannel:%s", messaging.SchemeGroupVersion.String(), knChannel) - timerSource := "my-timer-source" - g.Expect(CreateTimerKamelet(t, ctx, ns, timerSource)()).To(Succeed()) - g.Expect(CreateKnativeChannel(t, ctx, ns, knChannel)()).To(Succeed()) - - // Consumer route that will read from the Knative channel - g.Expect(KamelRun(t, ctx, ns, "files/test-kamelet-display.yaml", "-w").Execute()).To(Succeed()) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "test-kamelet-display", v1.IntegrationConditionReady), TestTimeoutMedium). - Should(Equal(corev1.ConditionTrue)) - - // Create the Pipe - g.Expect(KamelBind(t, ctx, ns, timerSource, knChannelConf, - "-p", "source.message=HelloKnative!", - "--name", timerPipe, - ).Execute()).To(Succeed()) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, timerPipe, v1.IntegrationConditionReady), TestTimeoutMedium). - Should(Equal(corev1.ConditionTrue)) - - // Consume the message - g.Eventually(IntegrationLogs(t, ctx, ns, "test-kamelet-display"), TestTimeoutShort).Should(ContainSubstring("HelloKnative!")) - - g.Eventually(PipeCondition(t, ctx, ns, timerPipe, v1.PipeConditionReady), TestTimeoutMedium).Should(And( - WithTransform(PipeConditionStatusExtract, Equal(corev1.ConditionTrue)), - WithTransform(PipeConditionReason, Equal(v1.IntegrationConditionDeploymentReadyReason)), - WithTransform(PipeConditionMessage, Equal(fmt.Sprintf("1/1 ready replicas"))), - )) - - // Update the Pipe - g.Expect(KamelBind(t, ctx, ns, timerSource, knChannelConf, - "-p", "source.message=message is Hi", - "--name", timerPipe, - ).Execute()).To(Succeed()) - - g.Eventually(IntegrationConditionStatus(t, ctx, ns, timerPipe, v1.IntegrationConditionReady), TestTimeoutMedium). - Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, ns, "test-kamelet-display"), TestTimeoutShort).Should(ContainSubstring("message is Hi")) - - g.Eventually(PipeCondition(t, ctx, ns, timerPipe, v1.PipeConditionReady), TestTimeoutMedium). - Should(And( - WithTransform(PipeConditionStatusExtract, Equal(corev1.ConditionTrue)), - WithTransform(PipeConditionReason, Equal(v1.IntegrationConditionDeploymentReadyReason)), - WithTransform(PipeConditionMessage, Equal("1/1 ready replicas")), - )) - - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) -} diff --git a/e2e/knative/knative_pipes_test.go b/e2e/knative/knative_pipes_test.go deleted file mode 100644 index 7880ca9786..0000000000 --- a/e2e/knative/knative_pipes_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build integration -// +build integration - -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" - -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package knative - -import ( - "context" - "fmt" - "testing" - "time" - - . "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" - - . "github.com/apache/camel-k/v2/e2e/support" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" -) - -func TestKnativePipes(t *testing.T) { - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - knChannelMessages := "messages" - knChannelWords := "words" - g.Expect(CreateKnativeChannel(t, ctx, ns, knChannelMessages)()).To(Succeed()) - g.Expect(CreateKnativeChannel(t, ctx, ns, knChannelWords)()).To(Succeed()) - - t.Run("Service combo", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/knative2.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knative2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knative2", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) - g.Expect(KamelRun(t, ctx, ns, "files/knative3.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knative3"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knative3", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) - g.Expect(KamelRun(t, ctx, ns, "files/knative1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knative1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knative1", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) - // Correct logs - g.Eventually(IntegrationLogs(t, ctx, ns, "knative1"), TestTimeoutMedium).Should(ContainSubstring("Received from 2: Hello from knative2")) - g.Eventually(IntegrationLogs(t, ctx, ns, "knative1"), TestTimeoutMedium).Should(ContainSubstring("Received from 3: Hello from knative3")) - // Incorrect logs - g.Consistently(IntegrationLogs(t, ctx, ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 2: Hello from knative3")) - g.Consistently(IntegrationLogs(t, ctx, ns, "knative1"), 10*time.Second).ShouldNot(ContainSubstring("Received from 3: Hello from knative2")) - // Clean up - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Channel combo v1beta1", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/knativech2.yaml").Execute()).To(Succeed()) - g.Expect(KamelRun(t, ctx, ns, "files/knativech1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativech2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativech1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativech2"), TestTimeoutMedium).Should(ContainSubstring("Received: Hello from knativech1")) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Channel combo get to post", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/knativegetpost2.yaml").Execute()).To(Succeed()) - g.Expect(KamelRun(t, ctx, ns, "files/knativegetpost1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativegetpost2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativegetpost1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativegetpost2"), TestTimeoutMedium).Should(ContainSubstring("Received: []")) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Multi channel chain", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/knativemultihop3.yaml").Execute()).To(Succeed()) - g.Expect(KamelRun(t, ctx, ns, "files/knativemultihop2.yaml").Execute()).To(Succeed()) - g.Expect(KamelRun(t, ctx, ns, "files/knativemultihop1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativemultihop3"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativemultihop2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativemultihop1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), TestTimeoutMedium).Should(ContainSubstring(`From messages: message`)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), TestTimeoutMedium).Should(ContainSubstring(`From words: word`)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), TestTimeoutMedium).Should(ContainSubstring(`From words: transformed message`)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From messages: word`)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From words: message`)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativemultihop3"), 10*time.Second).ShouldNot(ContainSubstring(`From messages: transformed message`)) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Flow", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/flow.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "flow"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "flow", camelv1.IntegrationConditionReady), TestTimeoutLong).Should(Equal(v1.ConditionTrue)) - - t.Run("Scale to zero", func(t *testing.T) { - g.Eventually(IntegrationPod(t, ctx, ns, "flow"), TestTimeoutLong).Should(BeNil()) - }) - - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Knative-service disabled", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/http_out.yaml", "-t", "knative-service.enabled=false").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "http-out"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(Service(t, ctx, ns, "http-out"), TestTimeoutShort).ShouldNot(BeNil()) - g.Consistently(KnativeService(t, ctx, ns, "http-out"), TestTimeoutShort).Should(BeNil()) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Knative-service priority", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/http_out.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "http-out"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(KnativeService(t, ctx, ns, "http-out"), TestTimeoutShort).ShouldNot(BeNil()) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - - t.Run("Knative-service annotation", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/knative2.yaml", "-t", "knative-service.annotations.'haproxy.router.openshift.io/balance'=roundrobin").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knative2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(KnativeService(t, ctx, ns, "knative2"), TestTimeoutShort).ShouldNot(BeNil()) - ks := KnativeService(t, ctx, ns, "knative2")() - annotations := ks.ObjectMeta.Annotations - g.Expect(annotations["haproxy.router.openshift.io/balance"]).To(Equal("roundrobin")) - g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) - }) - }) -} - -func TestRunBroker(t *testing.T) { - t.Skip("This test is skipped as it will be removed by another incoming PR.") - - WithNewTestNamespaceWithKnativeBroker(t, func(ctx context.Context, g *WithT, ns string) { - // This test require an adhoc operator to run properly - operatorID := fmt.Sprintf("camel-k-%s", ns) - InstallOperatorWithConf(t, ctx, g, ns, operatorID, false, nil) - - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/knativeevt1.yaml").Execute()).To(Succeed()) - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/knativeevt2.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeevt1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeevt2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativeevt2"), TestTimeoutMedium).Should(ContainSubstring("Received 1: Hello 1")) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativeevt2"), TestTimeoutMedium).Should(ContainSubstring("Received 2: Hello 2")) - g.Eventually(IntegrationLogs(t, ctx, ns, "knativeevt2")).ShouldNot(ContainSubstring("Received 1: Hello 2")) - }) -} diff --git a/e2e/knative/knative_platform_test.go b/e2e/knative/knative_platform_test.go deleted file mode 100644 index 7fdbb1c4f4..0000000000 --- a/e2e/knative/knative_platform_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build integration -// +build integration - -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" - -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package knative - -import ( - "context" - "testing" - - . "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - - . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" -) - -func TestKnativePlatformDetection(t *testing.T) { - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - t.Run("run yaml on automatic profile", func(t *testing.T) { - g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "yaml"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationTraitProfile(t, ctx, ns, "yaml"), TestTimeoutShort).Should(Equal(v1.TraitProfileKnative)) - }) - }) -} diff --git a/e2e/knative/knative_service_test.go b/e2e/knative/knative_service_test.go index 79cf674205..bc62d54ea7 100644 --- a/e2e/knative/knative_service_test.go +++ b/e2e/knative/knative_service_test.go @@ -38,22 +38,22 @@ func TestKnativeServiceURL(t *testing.T) { t.Run("Service endpoint url check", func(t *testing.T) { g.Expect(KamelRun(t, ctx, ns, "files/knativeurl1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeurl1"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knativeurl1", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) - ks := KnativeService(t, ctx, ns, "knativeurl1") - g.Eventually(ks, TestTimeoutShort).ShouldNot(BeNil()) + g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knativeurl1", camelv1.IntegrationConditionReady), + TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeurl1")).Should(Equal(v1.PodRunning)) + g.Eventually(KnativeService(t, ctx, ns, "knativeurl1")).ShouldNot(BeNil()) url := "http://knativeurl1." + ns + ".svc.cluster.local" - g.Eventually(ks().Status.RouteStatusFields.URL.String(), TestTimeoutShort).Should(Equal(url)) + g.Eventually(KnativeService(t, ctx, ns, "knativeurl1")().Status.RouteStatusFields.URL.String()).Should(Equal(url)) }) t.Run("Service multiple endpoint url check", func(t *testing.T) { g.Expect(KamelRun(t, ctx, ns, "files/knativeurl2.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeurl2"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knativeurl2", camelv1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) - ks := KnativeService(t, ctx, ns, "knativeurl2") - g.Eventually(ks, TestTimeoutShort).ShouldNot(BeNil()) + g.Eventually(IntegrationConditionStatus(t, ctx, ns, "knativeurl2", camelv1.IntegrationConditionReady), + TestTimeoutMedium).Should(Equal(v1.ConditionTrue)) + g.Eventually(IntegrationPodPhase(t, ctx, ns, "knativeurl2")).Should(Equal(v1.PodRunning)) + g.Eventually(KnativeService(t, ctx, ns, "knativeurl2")).ShouldNot(BeNil()) url := "http://knativeurl2." + ns + ".svc.cluster.local" - g.Eventually(ks().Status.RouteStatusFields.URL.String(), TestTimeoutShort).Should(Equal(url)) + g.Eventually(KnativeService(t, ctx, ns, "knativeurl2")().Status.RouteStatusFields.URL.String()).Should(Equal(url)) }) g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) }) diff --git a/e2e/knative/pod_test.go b/e2e/knative/pod_test.go deleted file mode 100644 index d01434bef7..0000000000 --- a/e2e/knative/pod_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build integration -// +build integration - -// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration" - -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package knative - -import ( - "context" - "testing" - - . "github.com/onsi/gomega" - - corev1 "k8s.io/api/core/v1" - - . "github.com/apache/camel-k/v2/e2e/support" - v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" -) - -func TestPodTraitWithKnative(t *testing.T) { - WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) { - g.Expect(KamelRun(t, ctx, ns, "files/podtest-knative2.yaml", "--pod-template", "files/template-knative.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "podtest-knative2"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "podtest-knative2", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) - g.Expect(KamelRun(t, ctx, ns, "files/podtest-knative1.yaml").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "podtest-knative1"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) - g.Eventually(IntegrationConditionStatus(t, ctx, ns, "podtest-knative1", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, ns, "podtest-knative1"), TestTimeoutShort).Should(ContainSubstring("hello from the template")) - }) -} diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go index d87b52649e..4158b0a085 100644 --- a/e2e/support/test_support.go +++ b/e2e/support/test_support.go @@ -27,7 +27,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "io" "os" @@ -61,8 +60,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "sigs.k8s.io/controller-runtime/pkg/log/zap" - eventing "knative.dev/eventing/pkg/apis/eventing/v1" - messaging "knative.dev/eventing/pkg/apis/messaging/v1" servingv1 "knative.dev/serving/pkg/apis/serving/v1" "github.com/apache/camel-k/v2/e2e/support/util" @@ -1852,22 +1849,6 @@ func ClusterDomainName(t *testing.T, ctx context.Context) (string, error) { return dns.Spec.BaseDomain, nil } -func CreateKnativeChannel(t *testing.T, ctx context.Context, ns string, name string) func() error { - return func() error { - channel := messaging.InMemoryChannel{ - TypeMeta: metav1.TypeMeta{ - Kind: "InMemoryChannel", - APIVersion: messaging.SchemeGroupVersion.String(), - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: ns, - Name: name, - }, - } - return TestClient(t).Create(ctx, &channel) - } -} - func CreateKamelet(t *testing.T, ctx context.Context, ns string, name string, template map[string]interface{}, properties map[string]v1.JSONSchemaProp, labels map[string]string) func() error { return CreateKameletWithID(t, platform.DefaultPlatformName, ctx, ns, name, template, properties, labels) } @@ -1954,17 +1935,15 @@ func Pods(t *testing.T, ctx context.Context, ns string) func() []corev1.Pod { } func WithNewTestNamespace(t *testing.T, doRun func(context.Context, *gomega.WithT, string)) { - ns := NewTestNamespace(t, testContext, false) + ns := NewTestNamespace(t, testContext) defer deleteTestNamespace(t, testContext, ns) invokeUserTestCode(t, testContext, ns.GetName(), doRun) } -func WithNamedTestNamespace(t *testing.T, doRun func(context.Context, *gomega.WithT, string), namespace string, deleteOnCompletion bool) { - ns := NewNamedTestNamespace(t, testContext, namespace, false) - if deleteOnCompletion { - defer deleteTestNamespace(t, testContext, ns) - } +func WithNamedTestNamespace(t *testing.T, doRun func(context.Context, *gomega.WithT, string), namespace string) { + ns := NewNamedTestNamespace(t, testContext, namespace) + defer deleteTestNamespace(t, testContext, ns) invokeUserTestCode(t, testContext, ns.GetName(), doRun) } @@ -1983,14 +1962,6 @@ func WithExistingNamedTestNamespace(t *testing.T, doRun func(context.Context, *g invokeUserTestCode(t, testContext, namespace, doRun) } -func WithNewTestNamespaceWithKnativeBroker(t *testing.T, doRun func(context.Context, *gomega.WithT, string)) { - ns := NewTestNamespace(t, testContext, true) - defer deleteTestNamespace(t, testContext, ns) - defer deleteKnativeBroker(t, testContext, ns) - - invokeUserTestCode(t, testContext, ns.GetName(), doRun) -} - func invokeUserTestCode(t *testing.T, ctx context.Context, ns string, doRun func(context.Context, *gomega.WithT, string)) { defer func() { DumpNamespace(t, ctx, ns) @@ -2002,40 +1973,6 @@ func invokeUserTestCode(t *testing.T, ctx context.Context, ns string, doRun func doRun(ctx, g, ns) } -func deleteKnativeBroker(t *testing.T, ctx context.Context, ns metav1.Object) { - nsRef := corev1.Namespace{ - TypeMeta: metav1.TypeMeta{ - APIVersion: v1.SchemeGroupVersion.String(), - Kind: "Namespace", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: ns.GetName(), - }, - } - nsKey := ctrl.ObjectKeyFromObject(&nsRef) - if err := TestClient(t).Get(ctx, nsKey, &nsRef); err != nil { - failTest(t, err) - } - - nsRef.SetLabels(make(map[string]string, 0)) - if err := TestClient(t).Update(ctx, &nsRef); err != nil { - failTest(t, err) - } - broker := eventing.Broker{ - TypeMeta: metav1.TypeMeta{ - APIVersion: eventing.SchemeGroupVersion.String(), - Kind: "Broker", - }, - ObjectMeta: metav1.ObjectMeta{ - Namespace: ns.GetName(), - Name: TestDefaultNamespace, - }, - } - if err := TestClient(t).Delete(ctx, &broker); err != nil { - failTest(t, err) - } -} - func deleteTestNamespace(t *testing.T, ctx context.Context, ns ctrl.Object) { var oc bool var err error @@ -2100,7 +2037,7 @@ func DumpNamespace(t *testing.T, ctx context.Context, ns string) { } } -func NewTestNamespace(t *testing.T, ctx context.Context, injectKnativeBroker bool) ctrl.Object { +func NewTestNamespace(t *testing.T, ctx context.Context) ctrl.Object { name := "test-" + uuid.New().String() if exists, err := testNamespaceExists(t, ctx, name); err != nil { @@ -2110,11 +2047,10 @@ func NewTestNamespace(t *testing.T, ctx context.Context, injectKnativeBroker boo name = fmt.Sprintf("%s-%d", name, time.Now().Second()) } - return NewNamedTestNamespace(t, ctx, name, injectKnativeBroker) + return NewNamedTestNamespace(t, ctx, name) } -func NewNamedTestNamespace(t *testing.T, ctx context.Context, name string, injectKnativeBroker bool) ctrl.Object { - brokerLabel := "eventing.knative.dev/injection" +func NewNamedTestNamespace(t *testing.T, ctx context.Context, name string) ctrl.Object { c := TestClient(t) var namespaceOrProject ctrl.Object @@ -2155,23 +2091,7 @@ func NewNamedTestNamespace(t *testing.T, ctx context.Context, name string, injec if err != nil { failTest(t, err) } - // workaround https://github.com/openshift/origin/issues/3819 - if injectKnativeBroker { - // use Kubernetes API - https://access.redhat.com/solutions/2677921 - if namespace, err := TestClient(t).CoreV1().Namespaces().Get(ctx, name, metav1.GetOptions{}); err != nil { - failTest(t, err) - } else { - if _, ok := namespace.GetLabels()[brokerLabel]; !ok { - namespace.SetLabels(map[string]string{ - brokerLabel: "enabled", - }) - if err = TestClient(t).Update(ctx, namespace); err != nil { - failTest(t, errors.New("Unable to label project with knative-eventing-injection. This operation needs update permission on the project.")) - } - } - } - } - namespaceOrProject = project + return project } else { namespace := &corev1.Namespace{ TypeMeta: metav1.TypeMeta{ @@ -2182,11 +2102,6 @@ func NewNamedTestNamespace(t *testing.T, ctx context.Context, name string, injec Name: name, }, } - if injectKnativeBroker { - namespace.SetLabels(map[string]string{ - brokerLabel: "enabled", - }) - } if err := TestClient(t).Create(ctx, namespace); err != nil { failTest(t, err) } diff --git a/pkg/apis/camel/v1/trait/knative.go b/pkg/apis/camel/v1/trait/knative.go index 55d939eeca..eb3cc83951 100644 --- a/pkg/apis/camel/v1/trait/knative.go +++ b/pkg/apis/camel/v1/trait/knative.go @@ -22,10 +22,16 @@ package trait // // The Camel Knative component will then use the full configuration to configure the routes. // +// WARNING: The Knative trait is **deprecated** and will be removed in future release versions: +// use Camel (Quarkus) Knative component instead. +// // The trait is enabled by default when the Knative profile is active. // // +camel-k:trait=knative. // +// +camel-k:trait=logging. +// +camel-k:deprecated=2.11.0. +// //nolint:godoclint type KnativeTrait struct { Trait `json:",inline" property:",squash"` diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go index f5175bba6d..1c2cb0b695 100644 --- a/pkg/trait/knative.go +++ b/pkg/trait/knative.go @@ -140,7 +140,16 @@ func (t *knativeTrait) Configure(e *Environment) (bool, *TraitCondition, error) } } - return ptr.Deref(t.Enabled, false), nil, nil + condition := NewIntegrationCondition( + "Knative", + v1.IntegrationConditionTraitInfo, + corev1.ConditionTrue, + TraitConfigurationReason, + "Knative (eventing) trait is deprecated and may be removed in future versions. "+ + "Use Camel Knative component instead.", + ) + + return ptr.Deref(t.Enabled, false), condition, nil } func filterMetaItems(meta metadata.IntegrationMetadata, cst knativeapi.CamelServiceType, uriType string) []string { diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go index 18349ff964..cf53a1de6d 100644 --- a/pkg/trait/knative_test.go +++ b/pkg/trait/knative_test.go @@ -108,10 +108,9 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) { require.NoError(t, err) tr, _ := tc.GetTrait("knative").(*knativeTrait) - ok, condition, err := tr.Configure(&environment) + ok, _, err := tr.Configure(&environment) require.NoError(t, err) assert.True(t, ok) - assert.Nil(t, condition) err = tr.Apply(&environment) require.NoError(t, err) @@ -226,10 +225,9 @@ func TestKnativeEnvConfigurationFromSource(t *testing.T) { tr, _ := tc.GetTrait("knative").(*knativeTrait) - ok, condition, err := tr.Configure(&environment) + ok, _, err := tr.Configure(&environment) require.NoError(t, err) assert.True(t, ok) - assert.Nil(t, condition) err = tr.Apply(&environment) require.NoError(t, err) @@ -1154,10 +1152,9 @@ func TestKnativeEnabled(t *testing.T) { // configure the knative trait knTrait, _ := newKnativeTrait().(*knativeTrait) - ok, condition, err = knTrait.Configure(&environment) + ok, _, err = knTrait.Configure(&environment) require.NoError(t, err) assert.True(t, ok) - assert.Nil(t, condition) // apply the knative trait require.NoError(t, knTrait.Apply(&environment)) @@ -1215,10 +1212,9 @@ func TestKnativeNotEnabled(t *testing.T) { // configure the knative trait knTrait, _ := newKnativeTrait().(*knativeTrait) - ok, condition, err = knTrait.Configure(&environment) + ok, _, err = knTrait.Configure(&environment) require.NoError(t, err) assert.False(t, ok) - assert.Nil(t, condition) assert.NotContains(t, environment.Integration.Status.Capabilities, v1.CapabilityKnative) } @@ -1520,20 +1516,18 @@ func fromCamelProperties(appProps map[string]string) (*knativeapi.CamelEnvironme func TestKnativeSyntheticKitDefault(t *testing.T) { e := NewFakeEnvironmentForSyntheticKit(t) knTrait, _ := newKnativeTrait().(*knativeTrait) - ok, condition, err := knTrait.Configure(&e) + ok, _, err := knTrait.Configure(&e) require.NoError(t, err) assert.False(t, ok) - assert.Nil(t, condition) } func TestKnativeSyntheticKitEnabled(t *testing.T) { e := NewFakeEnvironmentForSyntheticKit(t) knTrait, _ := newKnativeTrait().(*knativeTrait) knTrait.Enabled = ptr.To(true) - ok, condition, err := knTrait.Configure(&e) + ok, _, err := knTrait.Configure(&e) require.NoError(t, err) assert.True(t, ok) - assert.Nil(t, condition) } func TestRunKnativeEndpointWithKnativeNotInstalled(t *testing.T) { @@ -1578,9 +1572,8 @@ func TestRunNonKnativeEndpointWithKnativeNotInstalled(t *testing.T) { }, } - configured, condition, err := trait.Configure(environment) + configured, _, err := trait.Configure(environment) require.NoError(t, err) - assert.Nil(t, condition) assert.False(t, configured) conditions := environment.Integration.Status.Conditions assert.Empty(t, conditions) @@ -1657,9 +1650,8 @@ func TestKnativeAutoConfiguration(t *testing.T) { }, } - configured, condition, err := trait.Configure(environment) + configured, _, err := trait.Configure(environment) require.NoError(t, err) - assert.Nil(t, condition) assert.True(t, configured) err = trait.Apply(environment) require.NoError(t, err)