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

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f57150  Cannot expose knative endpoints in YAML (#1540)
2f57150 is described below

commit 2f571506734ae21dcdea798f02b27e26f45dae5f
Author: Luca Burgazzoli <[email protected]>
AuthorDate: Wed Jun 17 14:14:42 2020 +0200

    Cannot expose knative endpoints in YAML (#1540)
    
    * Cannot expose knative endpoints in YAML #1539
    
    * Regen
    
    * Fix lint findings
---
 deploy/resources.go         |  4 ++--
 e2e/knative/files/flow.yaml | 23 +++++++++++++++++++++++
 e2e/knative/knative_test.go | 10 ++++++++++
 pkg/trait/knative.go        | 12 ++++++------
 pkg/trait/service_test.go   |  4 ++--
 5 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/deploy/resources.go b/deploy/resources.go
index 8b5ec60..9a18b5f 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -112,9 +112,9 @@ var assets = func() http.FileSystem {
                "/crd-build.yaml": &vfsgen۰CompressedFileInfo{
                        name:             "crd-build.yaml",
                        modTime:          time.Time{},
-                       uncompressedSize: 2190,
+                       uncompressedSize: 2218,
 
-                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x55\x4d\x6f\xdb\x46\x13\xbe\xf3\x57\x3c\x30\x2f\x09\x60\x51\x6f\xde\xb6\x40\xc0\x9e\x14\xd9\x46\xd5\x18\x92\x61\x2a\x0d\x72\x1c\x91\x23\x72\x61\x72\x97\xdd\x9d\x15\x2d\x14\xfd\xef\xc5\xae\x28\x4b\xaa\x6b\xf4\xd0\xf0\xc6\xdd\x99\x79\x3e\x66\x38\x4c\x31\xf9\x7e\x4f\x92\xe2\x5e\x95\xac\x1d\x57\x10\x03\x69\x18\xb3\x9e\xca\x86\x51\x98\xad\x0c\x64\x19\x77\xc6\xeb\x8a\x44\x19\x8d\x77\xb3\xe2\xee\x3d\xbc\xae\xd8\xc2\x68\x
 [...]
+                       compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x55\x4d\x6f\xdb\x46\x13\xbe\xf3\x57\x3c\x30\x2f\x09\x60\x51\x6f\xde\xb6\x40\xc0\x9e\x14\xd9\x46\xd5\x18\x92\x61\x2a\x0d\x72\x1c\x91\x23\x72\x61\x72\x97\xdd\x9d\x15\x2d\x14\xfd\xef\xc5\xae\x28\x4b\xaa\x6b\xf4\xd0\xf0\xc6\xdd\x99\x79\x3e\x66\x38\x4c\x31\xf9\x7e\x4f\x92\xe2\x5e\x95\xac\x1d\x57\x10\x03\x69\x18\xb3\x9e\xca\x86\x51\x98\xad\x0c\x64\x19\x77\xc6\xeb\x8a\x44\x19\x8d\x77\xb3\xe2\xee\x3d\xbc\xae\xd8\xc2\x68\x
 [...]
                },
                "/crd-camel-catalog.yaml": &vfsgen۰CompressedFileInfo{
                        name:             "crd-camel-catalog.yaml",
diff --git a/e2e/knative/files/flow.yaml b/e2e/knative/files/flow.yaml
new file mode 100644
index 0000000..2108deb
--- /dev/null
+++ b/e2e/knative/files/flow.yaml
@@ -0,0 +1,23 @@
+# ---------------------------------------------------------------------------
+# 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/example"
+    steps:
+      - set-body:
+          constant: "Hello Camel K from yaml"
+      - to: "log:info"
\ No newline at end of file
diff --git a/e2e/knative/knative_test.go b/e2e/knative/knative_test.go
index 916476c..28e06e0 100644
--- a/e2e/knative/knative_test.go
+++ b/e2e/knative/knative_test.go
@@ -134,3 +134,13 @@ func TestRunBroker(t *testing.T) {
                Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).Should(BeNil())
        })
 }
+
+func TestRunFlow(t *testing.T) {
+       WithNewTestNamespace(t, func(ns string) {
+               Expect(Kamel("install", "-n", ns, "--trait-profile", 
"knative").Execute()).Should(BeNil())
+               Expect(Kamel("run", "-n", ns, 
"files/flow.yaml").Execute()).Should(BeNil())
+               Eventually(IntegrationPodPhase(ns, "flow"), 
TestTimeoutLong).Should(Equal(v1.PodRunning))
+               Eventually(IntegrationCondition(ns, "flow", 
camelv1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(v1.ConditionTrue))
+               Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).Should(BeNil())
+       })
+}
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index f66db3b..ae5d8c7 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -105,7 +105,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.ChannelSources == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.FromURIs, knativeapi.CamelServiceTypeChannel)...)
                                return true
                        })
@@ -115,7 +115,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.ChannelSinks == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.ToURIs, knativeapi.CamelServiceTypeChannel)...)
                                return true
                        })
@@ -125,7 +125,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.EndpointSources == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.FromURIs, knativeapi.CamelServiceTypeEndpoint)...)
                                return true
                        })
@@ -135,7 +135,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.EndpointSinks == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.ToURIs, knativeapi.CamelServiceTypeEndpoint)...)
                                return true
                        })
@@ -145,7 +145,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.EventSources == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.FromURIs, knativeapi.CamelServiceTypeEvent)...)
                                return true
                        })
@@ -155,7 +155,7 @@ func (t *knativeTrait) Configure(e *Environment) (bool, 
error) {
                if t.EventSinks == "" {
                        items := make([]string, 0)
 
-                       metadata.Each(e.CamelCatalog, 
e.Integration.Spec.Sources, func(_ int, meta metadata.IntegrationMetadata) bool 
{
+                       metadata.Each(e.CamelCatalog, e.Integration.Sources(), 
func(_ int, meta metadata.IntegrationMetadata) bool {
                                items = append(items, 
knativeutil.FilterURIs(meta.ToURIs, knativeapi.CamelServiceTypeEvent)...)
                                return true
                        })
diff --git a/pkg/trait/service_test.go b/pkg/trait/service_test.go
index 229d4a4..480d54e 100644
--- a/pkg/trait/service_test.go
+++ b/pkg/trait/service_test.go
@@ -328,8 +328,8 @@ func TestServiceWithNodeport(t *testing.T) {
                                Traits: map[string]v1.TraitSpec{
                                        "service": {
                                                Configuration: 
map[string]string{
-                                                       "enabled":      "true",
-                                                       "auto":         "false",
+                                                       "enabled":  "true",
+                                                       "auto":     "false",
                                                        "nodeport": "true",
                                                },
                                        },

Reply via email to