You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2019/10/01 13:53:43 UTC

[camel-k] branch master updated (a751302 -> 6928b9c)

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

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


    from a751302  Added unit tests for the camel trait #255
     new c77912d  Fix #952, #888: upgrade to Knative 0.9.0
     new 8446055  chore(build): regen resources and use docker builder
     new b5e6e37  Fix #952, #888: fix findings
     new dcff4af  Fix #952: add Knative 0.8.0 compatibility hack
     new ed724b8  Fix #952: add Knative 0.8.0 compatibility hack (refactor)
     new 57a9822  Fix #952: fix error while replacing knative services (immutable annotation)
     new 0917c9a  Fix #952: updated OLM manifest
     new 6928b9c  Fix #952: fix findings

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml |   1 +
 deploy/operator-role-knative.yaml                  |   1 +
 deploy/resources.go                                |   1 +
 e2e/test_support.go                                |  15 +-
 examples/knative/messages-channel.yaml             |   9 +-
 examples/knative/words-channel.yaml                |   9 +-
 go.mod                                             |  11 +-
 go.sum                                             |  64 +++++--
 ...oscheme_knative_eventing_08_compat_v1alpha1.go} |  31 ++--
 pkg/apis/addtoscheme_knative_eventing_v1alpha1.go  |   4 +-
 pkg/apis/addtoscheme_knative_serving_v1alpha1.go   |   2 +-
 pkg/apis/knative08compat/knative08compat.go        | 102 ++++++++++++
 pkg/trait/classpath_test.go                        |   5 +-
 pkg/trait/container.go                             |   6 +-
 pkg/trait/istio.go                                 |   6 +-
 pkg/trait/istio_test.go                            |  38 +++--
 pkg/trait/knative.go                               | 184 +++++++++++++++------
 pkg/trait/knative_service.go                       |  18 +-
 pkg/trait/knative_service_test.go                  |  12 +-
 pkg/trait/knative_test.go                          |  76 ++++++---
 pkg/trait/owner.go                                 |   4 +-
 pkg/trait/probes_test.go                           |  26 ++-
 pkg/util/knative/knative.go                        | 154 +++++++++++------
 pkg/util/kubernetes/collection.go                  |  12 +-
 pkg/util/kubernetes/errors.go                      |   9 +
 pkg/util/kubernetes/replace.go                     |  42 ++++-
 script/Makefile                                    |   4 +-
 27 files changed, 598 insertions(+), 248 deletions(-)
 copy pkg/apis/{camel/v1alpha1/common_types_support.go => addtoscheme_knative_eventing_08_compat_v1alpha1.go} (54%)
 create mode 100644 pkg/apis/knative08compat/knative08compat.go
 create mode 100644 pkg/util/kubernetes/errors.go


[camel-k] 06/08: Fix #952: fix error while replacing knative services (immutable annotation)

Posted by nf...@apache.org.
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

commit 57a982233fdb2cb3c8aaaa6ed941184a27ddf9b5
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 18:24:09 2019 +0200

    Fix #952: fix error while replacing knative services (immutable annotation)
---
 pkg/util/kubernetes/replace.go | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/pkg/util/kubernetes/replace.go b/pkg/util/kubernetes/replace.go
index 927a625..cbf5029 100644
--- a/pkg/util/kubernetes/replace.go
+++ b/pkg/util/kubernetes/replace.go
@@ -29,6 +29,8 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
 )
 
 // ReplaceResources allows to completely replace a list of resources on Kubernetes, taking care of immutable fields and resource versions
@@ -60,6 +62,8 @@ func ReplaceResource(ctx context.Context, c client.Client, res runtime.Object) e
 		mapRequiredServiceData(existing, res)
 		mapRequiredRouteData(existing, res)
 		mapRequiredKnativeData(existing, res)
+		mapRequiredKnativeServiceV1Beta1Data(existing, res)
+		mapRequiredKnativeServiceV1Data(existing, res)
 		err = c.Update(ctx, res)
 	}
 	if err != nil {
@@ -100,6 +104,38 @@ func mapRequiredKnativeData(from runtime.Object, to runtime.Object) {
 	}
 }
 
+func mapRequiredKnativeServiceV1Beta1Data(from runtime.Object, to runtime.Object) {
+	if fromC, ok := from.(*serving.Service); ok {
+		if toC, ok := to.(*serving.Service); ok {
+			if toC.ObjectMeta.Annotations == nil {
+				toC.ObjectMeta.Annotations = make(map[string]string)
+			}
+			if v, present := fromC.ObjectMeta.Annotations["serving.knative.dev/creator"]; present {
+				toC.ObjectMeta.Annotations["serving.knative.dev/creator"] = v
+			}
+			if v, present := fromC.ObjectMeta.Annotations["serving.knative.dev/lastModifier"]; present {
+				toC.ObjectMeta.Annotations["serving.knative.dev/lastModifier"] = v
+			}
+		}
+	}
+}
+
+func mapRequiredKnativeServiceV1Data(from runtime.Object, to runtime.Object) {
+	if fromC, ok := from.(*servingv1.Service); ok {
+		if toC, ok := to.(*servingv1.Service); ok {
+			if toC.ObjectMeta.Annotations == nil {
+				toC.ObjectMeta.Annotations = make(map[string]string)
+			}
+			if v, present := fromC.ObjectMeta.Annotations["serving.knative.dev/creator"]; present {
+				toC.ObjectMeta.Annotations["serving.knative.dev/creator"] = v
+			}
+			if v, present := fromC.ObjectMeta.Annotations["serving.knative.dev/lastModifier"]; present {
+				toC.ObjectMeta.Annotations["serving.knative.dev/lastModifier"] = v
+			}
+		}
+	}
+}
+
 func findResourceDetails(res runtime.Object) string {
 	if res == nil {
 		return "nil resource"


[camel-k] 02/08: chore(build): regen resources and use docker builder

Posted by nf...@apache.org.
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

commit 84460555c629545a2241c0ce44903f43e516cb5c
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 11:42:14 2019 +0200

    chore(build): regen resources and use docker builder
---
 script/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index b151003..b2736df 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -159,13 +159,13 @@ images: test
 	mkdir -p build/_maven_output
 	mkdir -p build/_output/bin
 	cp kamel build/_output/bin
-	operator-sdk build $(IMAGE_NAME):$(VERSION)
+	operator-sdk build --image-builder docker $(IMAGE_NAME):$(VERSION)
 
 images-dev: test package-artifacts
 	mkdir -p build/_maven_output
 	mkdir -p build/_output/bin
 	cp kamel build/_output/bin
-	operator-sdk build $(IMAGE_NAME):$(VERSION)
+	operator-sdk build --image-builder docker $(IMAGE_NAME):$(VERSION)
 
 images-push:
 	docker push $(IMAGE_NAME):$(VERSION)


[camel-k] 08/08: Fix #952: fix findings

Posted by nf...@apache.org.
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

commit 6928b9cd7db36589025161f8af1be12c38a4f8e0
Author: nferraro <ni...@gmail.com>
AuthorDate: Fri Sep 27 13:07:16 2019 +0200

    Fix #952: fix findings
---
 pkg/apis/knative08compat/knative08compat.go | 2 --
 pkg/trait/knative_test.go                   | 4 ++--
 pkg/util/knative/knative.go                 | 8 ++------
 pkg/util/kubernetes/collection.go           | 5 ++---
 pkg/util/kubernetes/replace.go              | 6 +++---
 5 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/pkg/apis/knative08compat/knative08compat.go b/pkg/apis/knative08compat/knative08compat.go
index a43a73f..d3b1cdf 100644
--- a/pkg/apis/knative08compat/knative08compat.go
+++ b/pkg/apis/knative08compat/knative08compat.go
@@ -49,7 +49,6 @@ func (in *Subscription) DeepCopyInto(out *Subscription) {
 	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
 	in.Spec.DeepCopyInto(&out.Spec)
 	in.Status.DeepCopyInto(&out.Status)
-	return
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription.
@@ -82,7 +81,6 @@ func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) {
 			(*in)[i].DeepCopyInto(&(*out)[i])
 		}
 	}
-	return
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList.
diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go
index 35b0a66..422eccd 100644
--- a/pkg/trait/knative_test.go
+++ b/pkg/trait/knative_test.go
@@ -19,8 +19,6 @@ package trait
 
 import (
 	"context"
-	"k8s.io/apimachinery/pkg/runtime/schema"
-	"knative.dev/pkg/apis"
 	"testing"
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
@@ -36,7 +34,9 @@ import (
 	k8sutils "github.com/apache/camel-k/pkg/util/kubernetes"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/runtime/schema"
 	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
+	"knative.dev/pkg/apis"
 	duckv1 "knative.dev/pkg/apis/duck/v1"
 	duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
 	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
diff --git a/pkg/util/knative/knative.go b/pkg/util/knative/knative.go
index bfa7343..bc5b3bd 100644
--- a/pkg/util/knative/knative.go
+++ b/pkg/util/knative/knative.go
@@ -114,9 +114,7 @@ func GetAnySinkURL(ctx context.Context, c client.Client, types []schema.GroupVer
 		}
 
 		res, err := GetSinkURI(ctx, c, &sink, namespace)
-		if err != nil && k8serrors.IsNotFound(err) {
-			continue
-		} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
+		if err != nil && (k8serrors.IsNotFound(err) || kubernetesutils.IsUnknownAPIError(err)) {
 			continue
 		} else if err != nil {
 			return nil, err
@@ -137,9 +135,7 @@ func GetAddressableReference(ctx context.Context, c client.Client, types []schem
 		}
 
 		_, err := GetSinkURI(ctx, c, &sink, namespace)
-		if err != nil && k8serrors.IsNotFound(err) {
-			continue
-		} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
+		if err != nil && (k8serrors.IsNotFound(err) || kubernetesutils.IsUnknownAPIError(err)) {
 			continue
 		} else if err != nil {
 			return nil, err
diff --git a/pkg/util/kubernetes/collection.go b/pkg/util/kubernetes/collection.go
index 0f52d4a..bc84cea 100644
--- a/pkg/util/kubernetes/collection.go
+++ b/pkg/util/kubernetes/collection.go
@@ -19,14 +19,13 @@ package kubernetes
 
 import (
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
-	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
 	routev1 "github.com/openshift/api/route/v1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
 	"k8s.io/apimachinery/pkg/runtime"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 // A Collection is a container of Kubernetes resources
diff --git a/pkg/util/kubernetes/replace.go b/pkg/util/kubernetes/replace.go
index cbf5029..7a25ab3 100644
--- a/pkg/util/kubernetes/replace.go
+++ b/pkg/util/kubernetes/replace.go
@@ -21,16 +21,16 @@ import (
 	"context"
 
 	"github.com/apache/camel-k/pkg/client"
-	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	routev1 "github.com/openshift/api/route/v1"
 	"github.com/pkg/errors"
 	corev1 "k8s.io/api/core/v1"
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
-	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
-	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
+	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
 // ReplaceResources allows to completely replace a list of resources on Kubernetes, taking care of immutable fields and resource versions


[camel-k] 04/08: Fix #952: add Knative 0.8.0 compatibility hack

Posted by nf...@apache.org.
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

commit dcff4af821f01b3e37817d58c7bde167ec619a2b
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 16:05:52 2019 +0200

    Fix #952: add Knative 0.8.0 compatibility hack
---
 e2e/test_support.go                                |  4 +-
 ...toscheme_knative_eventing_08_compat_v1alpha1.go | 43 ++++++++++++++++++++++
 pkg/apis/knative08compat/knative08compat.go        | 22 +++++++++++
 pkg/trait/istio_test.go                            |  5 +++
 pkg/trait/knative.go                               | 37 ++++++++++++++++++-
 pkg/trait/knative_service_test.go                  |  6 +++
 pkg/util/knative/knative.go                        | 38 ++++++++++++++-----
 pkg/util/kubernetes/errors.go                      |  9 +++++
 8 files changed, 150 insertions(+), 14 deletions(-)

diff --git a/e2e/test_support.go b/e2e/test_support.go
index fd0b1b0..04a5203 100644
--- a/e2e/test_support.go
+++ b/e2e/test_support.go
@@ -39,7 +39,6 @@ import (
 	"github.com/apache/camel-k/pkg/util/log"
 	"github.com/apache/camel-k/pkg/util/openshift"
 	"github.com/google/uuid"
-	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	"github.com/onsi/gomega"
 	projectv1 "github.com/openshift/api/project/v1"
 	"github.com/spf13/cobra"
@@ -49,6 +48,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/labels"
 	"k8s.io/apimachinery/pkg/runtime"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
@@ -498,7 +498,7 @@ func createKnativeChannel(ns string, name string) func() error {
 	return func() error {
 		channel := messaging.InMemoryChannel{
 			TypeMeta: metav1.TypeMeta{
-				Kind:       "Channel",
+				Kind:       "InMemoryChannel",
 				APIVersion: messaging.SchemeGroupVersion.String(),
 			},
 			ObjectMeta: metav1.ObjectMeta{
diff --git a/pkg/apis/addtoscheme_knative_eventing_08_compat_v1alpha1.go b/pkg/apis/addtoscheme_knative_eventing_08_compat_v1alpha1.go
new file mode 100644
index 0000000..51734f4
--- /dev/null
+++ b/pkg/apis/addtoscheme_knative_eventing_08_compat_v1alpha1.go
@@ -0,0 +1,43 @@
+/*
+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 apis
+
+import (
+	"github.com/apache/camel-k/pkg/apis/knative08compat"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/runtime"
+)
+
+var (
+	compat08SchemeBuilder = runtime.NewSchemeBuilder(eventing08CompatKnownTypes)
+	compat08AddToScheme   = compat08SchemeBuilder.AddToScheme
+)
+
+func init() {
+	AddToSchemes = append(AddToSchemes, compat08AddToScheme)
+}
+
+// eventing08CompatKnownTypes Adds the list of known types to Scheme.
+func eventing08CompatKnownTypes(scheme *runtime.Scheme) error {
+	scheme.AddKnownTypes(knative08compat.CompatSchemeGroupVersion,
+		&knative08compat.Subscription{},
+		&knative08compat.SubscriptionList{},
+	)
+	metav1.AddToGroupVersion(scheme, knative08compat.CompatSchemeGroupVersion)
+	return nil
+}
diff --git a/pkg/apis/knative08compat/knative08compat.go b/pkg/apis/knative08compat/knative08compat.go
new file mode 100644
index 0000000..7939754
--- /dev/null
+++ b/pkg/apis/knative08compat/knative08compat.go
@@ -0,0 +1,22 @@
+package knative08compat
+
+import (
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
+)
+
+// CompatSchemeGroupVersion is the old group version used in Knative 0.8
+var CompatSchemeGroupVersion = schema.GroupVersion{
+	Group:   "eventing.knative.dev",
+	Version: "v1alpha1",
+}
+
+// Subscription is a Knative 0.8 compatibility version for messaging.Subscription
+type Subscription struct {
+	messaging.Subscription
+}
+
+// SubscriptionList is a Knative 0.8 compatibility version for messaging.SubscriptionList
+type SubscriptionList struct {
+	messaging.SubscriptionList
+}
diff --git a/pkg/trait/istio_test.go b/pkg/trait/istio_test.go
index 7f804e4..cd5830f 100644
--- a/pkg/trait/istio_test.go
+++ b/pkg/trait/istio_test.go
@@ -49,6 +49,11 @@ func NewIstioTestEnv(t *testing.T, d *appsv1.Deployment, s *serving.Service, ena
 					"istio": {
 						Configuration: make(map[string]string),
 					},
+					"knative": {
+						Configuration: map[string]string{
+							"knative-08-compat-mode": "false", // disable it so it does not check resources in the cluster
+						},
+					},
 				},
 			},
 		},
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index 14705ad..f64929a 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -25,6 +25,7 @@ import (
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/metadata"
 	"github.com/apache/camel-k/pkg/util/envvar"
+	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/pkg/errors"
 	"github.com/scylladb/go-set/strset"
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
@@ -32,6 +33,9 @@ import (
 
 	knativeapi "github.com/apache/camel-k/pkg/apis/camel/v1alpha1/knative"
 	knativeutil "github.com/apache/camel-k/pkg/util/knative"
+	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
+	kubeclient "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
 type knativeTrait struct {
@@ -44,6 +48,7 @@ type knativeTrait struct {
 	FilterSourceChannels *bool    `property:"filter-source-channels"`
 	ChannelAPIs          []string `property:"channel-apis"`
 	EndpointAPIs         []string `property:"endpoint-apis"`
+	Knative08CompatMode  *bool    `property:"knative-08-compat-mode"`
 	Auto                 *bool    `property:"auto"`
 }
 
@@ -147,6 +152,14 @@ func (t *knativeTrait) Configure(e *Environment) (bool, error) {
 			filter := true
 			t.FilterSourceChannels = &filter
 		}
+
+		if t.Knative08CompatMode == nil {
+			compat, err := t.shouldUseKnative08CompatMode(e.Integration.Namespace)
+			if err != nil {
+				return false, err
+			}
+			t.Knative08CompatMode = &compat
+		}
 	}
 
 	return true, nil
@@ -194,13 +207,16 @@ func (t *knativeTrait) createSubscriptions(e *Environment) error {
 	if err != nil {
 		return err
 	}
+
+	compat := t.Knative08CompatMode != nil && *t.Knative08CompatMode
+
 	for _, ch := range channels {
 		chRef, err := knativeutil.GetAddressableReference(t.ctx, t.client, types, e.Integration.Namespace, ch)
 		if err != nil {
 			return err
 		}
-		sub := knativeutil.CreateSubscription(*chRef, e.Integration.Name)
-		e.Resources.Add(&sub)
+		sub := knativeutil.CreateSubscription(*chRef, e.Integration.Name, compat)
+		e.Resources.Add(sub)
 	}
 
 	return nil
@@ -347,6 +363,23 @@ func (t *knativeTrait) extractNames(names string) []string {
 	return answer
 }
 
+func (t *knativeTrait) shouldUseKnative08CompatMode(namespace string) (bool, error) {
+	lst := messaging.SubscriptionList{
+		TypeMeta: v1.TypeMeta{
+			Kind:       "Subscription",
+			APIVersion: messaging.SchemeGroupVersion.String(),
+		},
+	}
+	opts := kubeclient.ListOptions{
+		Namespace: namespace,
+	}
+	err := t.client.List(t.ctx, &opts, &lst)
+	if err != nil && kubernetes.IsUnknownAPIError(err) {
+		return true, nil
+	}
+	return false, err
+}
+
 func decodeKindAPIGroupVersions(specs []string) ([]schema.GroupVersionKind, error) {
 	lst := make([]schema.GroupVersionKind, 0, len(specs))
 	for _, spec := range specs {
diff --git a/pkg/trait/knative_service_test.go b/pkg/trait/knative_service_test.go
index 04a21c4..0af56d9 100644
--- a/pkg/trait/knative_service_test.go
+++ b/pkg/trait/knative_service_test.go
@@ -45,6 +45,9 @@ func TestKnativeService(t *testing.T) {
 	assert.Nil(t, err)
 
 	traitCatalog := NewCatalog(context.TODO(), nil)
+	knativeTrait := traitCatalog.GetTrait("knative").(*knativeTrait)
+	falze := false
+	knativeTrait.Knative08CompatMode = &falze
 
 	environment := Environment{
 		CamelCatalog: catalog,
@@ -184,6 +187,9 @@ func TestKnativeServiceWithCustomContainerName(t *testing.T) {
 	assert.Nil(t, err)
 
 	traitCatalog := NewCatalog(context.TODO(), nil)
+	knativeTrait := traitCatalog.GetTrait("knative").(*knativeTrait)
+	falze := false
+	knativeTrait.Knative08CompatMode = &falze
 
 	environment := Environment{
 		CamelCatalog: catalog,
diff --git a/pkg/util/knative/knative.go b/pkg/util/knative/knative.go
index 2653701..874c108 100644
--- a/pkg/util/knative/knative.go
+++ b/pkg/util/knative/knative.go
@@ -20,13 +20,16 @@ package knative
 import (
 	"context"
 	"fmt"
-	"k8s.io/apimachinery/pkg/runtime/schema"
 	"net/url"
 
+	"github.com/apache/camel-k/pkg/apis/knative08compat"
 	"github.com/apache/camel-k/pkg/client"
+	kubernetesutils "github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/log"
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/apimachinery/pkg/runtime/schema"
 	"k8s.io/client-go/kubernetes"
 	controller "sigs.k8s.io/controller-runtime/pkg/client"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
@@ -68,10 +71,14 @@ func IsInstalled(ctx context.Context, c kubernetes.Interface) (bool, error) {
 }
 
 // CreateSubscription ---
-func CreateSubscription(channelReference corev1.ObjectReference, serviceName string) messaging.Subscription {
-	return messaging.Subscription{
+func CreateSubscription(channelReference corev1.ObjectReference, serviceName string, compat08 bool) runtime.Object {
+	apiVersion := messaging.SchemeGroupVersion.String()
+	if compat08 {
+		apiVersion = knative08compat.CompatSchemeGroupVersion.String()
+	}
+	subs := messaging.Subscription{
 		TypeMeta: metav1.TypeMeta{
-			APIVersion: messaging.SchemeGroupVersion.String(),
+			APIVersion: apiVersion,
 			Kind:       "Subscription",
 		},
 		ObjectMeta: metav1.ObjectMeta{
@@ -93,21 +100,30 @@ func CreateSubscription(channelReference corev1.ObjectReference, serviceName str
 			},
 		},
 	}
+
+	if compat08 {
+		return &knative08compat.Subscription{
+			Subscription: subs,
+		}
+	}
+	return &subs
 }
 
 // GetAnySinkURL looks up the resource among all given types and returns the resource sink URL if present
 func GetAnySinkURL(ctx context.Context, c client.Client, types []schema.GroupVersionKind, namespace string, name string) (*url.URL, error) {
 	for _, gvk := range types {
 		sink := corev1.ObjectReference{
-			Kind: gvk.Kind,
+			Kind:       gvk.Kind,
 			APIVersion: gvk.GroupVersion().String(),
-			Namespace: namespace,
-			Name: name,
+			Namespace:  namespace,
+			Name:       name,
 		}
 
 		res, err := GetSinkURI(ctx, c, &sink, namespace)
 		if err != nil && k8serrors.IsNotFound(err) {
 			continue
+		} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
+			continue
 		} else if err != nil {
 			return nil, err
 		}
@@ -120,15 +136,17 @@ func GetAnySinkURL(ctx context.Context, c client.Client, types []schema.GroupVer
 func GetAddressableReference(ctx context.Context, c client.Client, types []schema.GroupVersionKind, namespace string, name string) (*corev1.ObjectReference, error) {
 	for _, gvk := range types {
 		sink := corev1.ObjectReference{
-			Kind: gvk.Kind,
+			Kind:       gvk.Kind,
 			APIVersion: gvk.GroupVersion().String(),
-			Namespace: namespace,
-			Name: name,
+			Namespace:  namespace,
+			Name:       name,
 		}
 
 		_, err := GetSinkURI(ctx, c, &sink, namespace)
 		if err != nil && k8serrors.IsNotFound(err) {
 			continue
+		} else if err != nil && kubernetesutils.IsUnknownAPIError(err) {
+			continue
 		} else if err != nil {
 			return nil, err
 		}
diff --git a/pkg/util/kubernetes/errors.go b/pkg/util/kubernetes/errors.go
new file mode 100644
index 0000000..4d8f194
--- /dev/null
+++ b/pkg/util/kubernetes/errors.go
@@ -0,0 +1,9 @@
+package kubernetes
+
+import "strings"
+
+// IsUnknownAPIError checks if the given error is due to some missing APIs in the cluster.
+// Apparently there's no such method in Kubernetes Go API.
+func IsUnknownAPIError(err error) bool {
+	return err != nil && strings.HasPrefix(err.Error(), "no matches for kind")
+}


[camel-k] 01/08: Fix #952, #888: upgrade to Knative 0.9.0

Posted by nf...@apache.org.
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

commit c77912dbdbe30a4157ac6c4d19028d2c99313929
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 11:41:52 2019 +0200

    Fix #952, #888: upgrade to Knative 0.9.0
---
 deploy/operator-role-knative.yaml                 |   1 +
 deploy/resources.go                               |   1 +
 e2e/test_support.go                               |  13 +-
 examples/knative/messages-channel.yaml            |   9 +-
 examples/knative/words-channel.yaml               |   9 +-
 go.mod                                            |  11 +-
 go.sum                                            |  64 +++++++--
 pkg/apis/addtoscheme_knative_eventing_v1alpha1.go |   4 +-
 pkg/apis/addtoscheme_knative_serving_v1alpha1.go  |   2 +-
 pkg/trait/classpath_test.go                       |   5 +-
 pkg/trait/container.go                            |   6 +-
 pkg/trait/istio.go                                |   6 +-
 pkg/trait/istio_test.go                           |  33 ++---
 pkg/trait/knative.go                              | 153 ++++++++++++++--------
 pkg/trait/knative_service.go                      |  18 ++-
 pkg/trait/knative_service_test.go                 |   6 +-
 pkg/trait/knative_test.go                         |  76 +++++++----
 pkg/trait/owner.go                                |   4 +-
 pkg/trait/probes_test.go                          |  26 ++--
 pkg/util/knative/knative.go                       | 144 +++++++++++++-------
 pkg/util/kubernetes/collection.go                 |  11 +-
 pkg/util/kubernetes/replace.go                    |   6 +-
 22 files changed, 378 insertions(+), 230 deletions(-)

diff --git a/deploy/operator-role-knative.yaml b/deploy/operator-role-knative.yaml
index 76b7fb5..a4edc11 100644
--- a/deploy/operator-role-knative.yaml
+++ b/deploy/operator-role-knative.yaml
@@ -37,6 +37,7 @@ rules:
   - watch
 - apiGroups:
   - eventing.knative.dev
+  - messaging.knative.dev
   resources:
   - "*"
   verbs:
diff --git a/deploy/resources.go b/deploy/resources.go
index 1346f1d..defd3a4 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -2894,6 +2894,7 @@ rules:
   - watch
 - apiGroups:
   - eventing.knative.dev
+  - messaging.knative.dev
   resources:
   - "*"
   verbs:
diff --git a/e2e/test_support.go b/e2e/test_support.go
index 38e92bf..fd0b1b0 100644
--- a/e2e/test_support.go
+++ b/e2e/test_support.go
@@ -39,7 +39,7 @@ import (
 	"github.com/apache/camel-k/pkg/util/log"
 	"github.com/apache/camel-k/pkg/util/openshift"
 	"github.com/google/uuid"
-	eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	"github.com/onsi/gomega"
 	projectv1 "github.com/openshift/api/project/v1"
 	"github.com/spf13/cobra"
@@ -496,22 +496,15 @@ func createKamelPod(ns string, name string, command ...string) error {
 
 func createKnativeChannel(ns string, name string) func() error {
 	return func() error {
-		channel := eventing.Channel{
+		channel := messaging.InMemoryChannel{
 			TypeMeta: metav1.TypeMeta{
 				Kind:       "Channel",
-				APIVersion: eventing.SchemeGroupVersion.String(),
+				APIVersion: messaging.SchemeGroupVersion.String(),
 			},
 			ObjectMeta: metav1.ObjectMeta{
 				Namespace: ns,
 				Name:      name,
 			},
-			Spec: eventing.ChannelSpec{
-				Provisioner: &v1.ObjectReference{
-					APIVersion: "eventing.knative.dev/v1alpha1",
-					Kind:       "ClusterChannelProvisioner",
-					Name:       "in-memory",
-				},
-			},
 		}
 		return testClient.Create(testContext, &channel)
 	}
diff --git a/examples/knative/messages-channel.yaml b/examples/knative/messages-channel.yaml
index 177faf9..fe44738 100644
--- a/examples/knative/messages-channel.yaml
+++ b/examples/knative/messages-channel.yaml
@@ -15,12 +15,7 @@
 # limitations under the License.
 # ---------------------------------------------------------------------------
 
-apiVersion: eventing.knative.dev/v1alpha1
-kind: Channel
+apiVersion: messaging.knative.dev/v1alpha1
+kind: InMemoryChannel
 metadata:
   name: messages
-spec:
-  provisioner:
-    apiVersion: eventing.knative.dev/v1alpha1
-    kind: ClusterChannelProvisioner
-    name: in-memory
\ No newline at end of file
diff --git a/examples/knative/words-channel.yaml b/examples/knative/words-channel.yaml
index 1688cea..94e0ec1 100644
--- a/examples/knative/words-channel.yaml
+++ b/examples/knative/words-channel.yaml
@@ -15,12 +15,7 @@
 # limitations under the License.
 # ---------------------------------------------------------------------------
 
-apiVersion: eventing.knative.dev/v1alpha1
-kind: Channel
+apiVersion: messaging.knative.dev/v1alpha1
+kind: InMemoryChannel
 metadata:
   name: words
-spec:
-  provisioner:
-    apiVersion: eventing.knative.dev/v1alpha1
-    kind: ClusterChannelProvisioner
-    name: in-memory
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 2c0114f..bedbd73 100644
--- a/go.mod
+++ b/go.mod
@@ -1,7 +1,8 @@
 module github.com/apache/camel-k
 
 require (
-	cloud.google.com/go v0.43.0 // indirect
+	contrib.go.opencensus.io/exporter/prometheus v0.1.0 // indirect
+	contrib.go.opencensus.io/exporter/stackdriver v0.12.2
 	github.com/Masterminds/semver v1.4.2
 	github.com/alecthomas/jsonschema v0.0.0-20190122210438-a6952de1bbe6
 	github.com/coreos/prometheus-operator v0.29.0
@@ -10,9 +11,6 @@ require (
 	github.com/google/go-containerregistry v0.0.0-20190206233756-dbc4da98389f // indirect
 	github.com/google/uuid v1.1.1
 	github.com/jpillora/backoff v0.0.0-20170918002102-8eab2debe79d
-	github.com/knative/eventing v0.7.1
-	github.com/knative/pkg v0.0.0-20190624141606-d82505e6c5b4
-	github.com/knative/serving v0.7.1
 	github.com/mitchellh/mapstructure v1.1.2
 	github.com/onsi/ginkgo v1.8.0 // indirect
 	github.com/onsi/gomega v1.5.0
@@ -27,13 +25,14 @@ require (
 	github.com/stoewer/go-strcase v1.0.2
 	github.com/stretchr/testify v1.3.0
 	go.uber.org/multierr v1.1.0
-	golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
-	golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect
 	gopkg.in/yaml.v2 v2.2.2
 	k8s.io/api v0.0.0-20190612125737-db0771252981
 	k8s.io/apimachinery v0.0.0-20190612125636-6a5db36e93ad
 	k8s.io/client-go v11.0.0+incompatible
 	k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 // indirect
+	knative.dev/eventing v0.9.0
+	knative.dev/pkg v0.0.0-20190913154335-74659889c421
+	knative.dev/serving v0.9.0
 	sigs.k8s.io/controller-runtime v0.1.10
 )
 
diff --git a/go.sum b/go.sum
index ec092e6..f547e81 100644
--- a/go.sum
+++ b/go.sum
@@ -5,10 +5,18 @@ cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.37.2 h1:4y4L7BdHenTfZL0HervofNTHh9Ad6mNX72cQvl+5eH0=
 cloud.google.com/go v0.37.2/go.mod h1:H8IAquKe2L30IxoupDgqTaQvKSwF/c8prYHynGIWQbA=
+cloud.google.com/go v0.38.0 h1:ROfEUZz+Gh5pa62DJWXSaonyu3StP6EA6lPEXPI6mCo=
 cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
 cloud.google.com/go v0.43.0 h1:banaiRPAM8kUVYneOSkhgcDsLzEvL25FinuiSZaH/2w=
 cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg=
 contrib.go.opencensus.io/exporter/ocagent v0.4.11/go.mod h1:7ihiYRbdcVfW4m4wlXi9WRPdv79C0fStcjNlyE6ek9s=
+contrib.go.opencensus.io/exporter/prometheus v0.1.0 h1:SByaIoWwNgMdPSgl5sMqM2KDE5H/ukPWBRo314xiDvg=
+contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
+contrib.go.opencensus.io/exporter/stackdriver v0.12.2 h1:jU1p9F07ASK11wYgSTPKtFlTvTtCDj6R1d3nRt0ZHDE=
+contrib.go.opencensus.io/exporter/stackdriver v0.12.2/go.mod h1:iwB6wGarfphGGe/e5CWqyUk/cLzKnWsOKPVW3no6OTw=
+contrib.go.opencensus.io/exporter/stackdriver v0.12.7 h1:XWDDoMSlZchLyQZw8HKE+7vn3FpfaVR5Yz9E4ifxiU0=
+contrib.go.opencensus.io/exporter/stackdriver v0.12.7/go.mod h1:ZOhmSfHIoyVaQ+bKN+lR4h7K2olTIJsrdOwWHsNGw4w=
+contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA=
 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
 github.com/Azure/go-autorest v11.1.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
 github.com/Azure/go-autorest v11.7.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
@@ -38,11 +46,18 @@ github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30 h1:Kn3rqvbUFqSe
 github.com/appscode/jsonpatch v0.0.0-20190108182946-7c0e3b262f30/go.mod h1:4AJxUpXUhv4N+ziTvIcWWXgeorXpxPZOfk9HdEVr96M=
 github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
 github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
+github.com/aws/aws-sdk-go v1.19.18 h1:Hb3+b9HCqrOrbAtFstUWg7H5TQ+/EcklJtE8VShVs8o=
+github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
+github.com/aws/aws-sdk-go v1.22.1 h1://WJvJi9iq/i5TWHuK3hIC23xCZYH7Qv7SIN2vZVqxY=
+github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
 github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
 github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
+github.com/census-instrumentation/opencensus-proto v0.2.0 h1:LzQXZOgg4CQfE6bFvXGM30YZL1WW/M337pXml+GrcZ4=
 github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
 github.com/chai2010/gettext-go v0.0.0-20170215093142-bf70f2a70fb1/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
 github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
@@ -136,6 +151,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
 github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
 github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
+github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 github.com/golang/glog v0.0.0-20141105023935-44145f04b68c/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@@ -154,6 +171,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
 github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/addlicense v0.0.0-20190510175307-22550fa7c1b0/go.mod h1:QtPG26W17m+OIQgE6gQ24gC1M6pUaMBAbFrTIDtwG/E=
 github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
 github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
@@ -162,6 +180,8 @@ github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
 github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-containerregistry v0.0.0-20190206233756-dbc4da98389f h1:qfn7ap/7lpxI+y6FEnnoAYxJs2d07OxdC5PFuDEJo0g=
 github.com/google/go-containerregistry v0.0.0-20190206233756-dbc4da98389f/go.mod h1:yZAFP63pRshzrEYLXLGPmUt0Ay+2zdjmMN1loCnRLUk=
 github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
@@ -178,7 +198,9 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU=
 github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
+github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc=
 github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
+github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
 github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
 github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
 github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
@@ -205,6 +227,8 @@ github.com/hashicorp/golang-lru v0.0.0-20160207214719-a0d98a5f2880/go.mod h1:/m3
 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
 github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
+github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
@@ -217,6 +241,8 @@ github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ
 github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
 github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=
+github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
 github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
 github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
 github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
@@ -230,13 +256,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
 github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
 github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
 github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
-github.com/knative/eventing v0.7.1 h1:41Jr2mGB+m27G9keCOuUS/DFfyJLbmglRzTAt/kKcg0=
-github.com/knative/eventing v0.7.1/go.mod h1:SkBc5JFsl70Fq/Bjc97+uix8759e4ho0imxq8DQm4DA=
-github.com/knative/pkg v0.0.0-20190624141606-d82505e6c5b4 h1:EttEM3qdT41tGjgsYk3RqIBS9vKlgIe2C+F2pZl3kgY=
-github.com/knative/pkg v0.0.0-20190624141606-d82505e6c5b4/go.mod h1:7Ijfhw7rfB+H9VtosIsDYvZQ+qYTz7auK3fHW/5z4ww=
-github.com/knative/serving v0.7.1 h1:PLlqzHN4MJYHeugK3yxZrwifC+nmNtJGkKEH+j4ZV0Q=
-github.com/knative/serving v0.7.1/go.mod h1:ljvMfwQy2qanaM/8xnBSK4Mz3Vv2NawC2fo5kFRJS1A=
 github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
@@ -393,6 +414,7 @@ go.opencensus.io v0.19.2/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M=
 go.opencensus.io v0.20.0 h1:L/ARO58pdktB6dLmYI0zAyW1XnavEmGziFd0MKfxnck=
 go.opencensus.io v0.20.0/go.mod h1:NO/8qkisMZLZ1FCsKNqtJPwc8/TaclWyY0B6wcYNg9M=
 go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
 go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
 go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
 go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
@@ -446,12 +468,13 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV
 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo=
 golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
-golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk=
+golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/oauth2 v0.0.0-20170412232759-a6bd8cefa181/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -489,12 +512,13 @@ golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 h1:1Fzlr8kkDLQwqMP8GxrhptBLqZG/EDpiATneiZHY998=
 golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd h1:r7DufRZuZbWB7j439YfAzP8RPDa9unLkpwQKUYbIMPI=
 golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI=
-golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M=
+golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -510,6 +534,7 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm
 golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20181011152555-a398e557df60/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20181207222222-4c874b978acb/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20181219222714-6e267b5cc78e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -521,6 +546,7 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
 golang.org/x/tools v0.0.0-20190408170212-12dd9f86f350/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
 golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
 golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
 golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
 google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0=
@@ -529,6 +555,9 @@ google.golang.org/api v0.0.0-20181220000619-583d854617af/go.mod h1:4mhQ8q/RsB7i+
 google.golang.org/api v0.2.0/go.mod h1:IfRCZScioGtypHNTlz3gFk67J8uePVW7uDTBzXuIkhU=
 google.golang.org/api v0.3.0/go.mod h1:IuvZyQh8jgscv8qWfQ4ABd8m7hEudgBFM/EdhA3BnXw=
 google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.5.0 h1:lj9SyhMzyoa38fgFF0oO2T6pjs5IzkLPKfVtxpyCRMM=
+google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.7.0 h1:9sdfJOzWlkqPltHAuzT2Cp+yrBeY1KRVYgms8soxMwM=
 google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
 google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
 google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -546,16 +575,22 @@ google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk
 google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
 google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
 google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb h1:i1Ppqkc3WQXikh8bXiwHqAN5Rv3/qDCcRk0/Otx73BY=
 google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
 google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
 google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 h1:iKtrH9Y8mcbADOP0YFaEMth7OfuHY9xHOwNj4znpM1A=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
 google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
 google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
 google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
 google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU=
 google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
 google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+google.golang.org/grpc v1.22.1 h1:/7cs52RnTJmD43s3uxzlq2U7nqVTd/37viQwMrMNlOM=
+google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
@@ -583,6 +618,7 @@ honnef.co/go/tools v0.0.0-20180920025451-e3ad64cb4ed3/go.mod h1:rf3lG4BRIbNafJWh
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 k8s.io/api v0.0.0-20190222213804-5cb15d344471 h1:MzQGt8qWQCR+39kbYRd0uQqsvSidpYqJLFeWiJ9l4OE=
 k8s.io/api v0.0.0-20190222213804-5cb15d344471/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
 k8s.io/apiextensions-apiserver v0.0.0-20190228180357-d002e88f6236 h1:JfFtjaElBIgYKCWEtYQkcNrTpW+lMO4GJy8NP6SVQmM=
@@ -612,6 +648,14 @@ k8s.io/kube-state-metrics v1.6.0/go.mod h1:84+q9aGVQPzXYGgtvyhZr/fSI6BdLsbPWXn37
 k8s.io/kubernetes v1.13.4/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
 k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7 h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=
 k8s.io/utils v0.0.0-20190308190857-21c4ce38f2a7/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0=
+knative.dev/eventing v0.9.0 h1:0eqp7rES1E5DE5Hj3MOHHyM2BzCe/7Mtp5tPjYoeCxs=
+knative.dev/eventing v0.9.0/go.mod h1:UxweNv8yXhsdHJitcb9R6rmfNaUD2DFi9GWwNRyIs58=
+knative.dev/pkg v0.0.0-20190913154335-74659889c421 h1:gdJs7TkosL+7S2mnZpLRS4v2GJVTnY7gQ8PPjktERx8=
+knative.dev/pkg v0.0.0-20190913154335-74659889c421/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
+knative.dev/pkg v0.0.0-20190924000116-25b6d3af4d22 h1:tJIYe/gaJn4ZNkZYe7W4ZqCunt29XymVbpEP5rMPSOE=
+knative.dev/pkg v0.0.0-20190924000116-25b6d3af4d22/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
+knative.dev/serving v0.9.0 h1:GVnsksAEX6vMXGygvzsGPIrFTypiesaseK7emm0LKWQ=
+knative.dev/serving v0.9.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0=
 rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
 sigs.k8s.io/controller-runtime v0.1.10 h1:amLOmcekVdnsD1uIpmgRqfTbQWJ2qxvQkcdeFhcotn4=
 sigs.k8s.io/controller-runtime v0.1.10/go.mod h1:HFAYoOh6XMV+jKF1UjFwrknPbowfyHEHHRdJMf2jMX8=
diff --git a/pkg/apis/addtoscheme_knative_eventing_v1alpha1.go b/pkg/apis/addtoscheme_knative_eventing_v1alpha1.go
index 8cf75a2..222e639 100644
--- a/pkg/apis/addtoscheme_knative_eventing_v1alpha1.go
+++ b/pkg/apis/addtoscheme_knative_eventing_v1alpha1.go
@@ -18,10 +18,12 @@ limitations under the License.
 package apis
 
 import (
-	eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
+	eventing "knative.dev/eventing/pkg/apis/eventing/v1alpha1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 )
 
 func init() {
 	// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
 	AddToSchemes = append(AddToSchemes, eventing.AddToScheme)
+	AddToSchemes = append(AddToSchemes, messaging.AddToScheme)
 }
diff --git a/pkg/apis/addtoscheme_knative_serving_v1alpha1.go b/pkg/apis/addtoscheme_knative_serving_v1alpha1.go
index c037a3a..b96c913 100644
--- a/pkg/apis/addtoscheme_knative_serving_v1alpha1.go
+++ b/pkg/apis/addtoscheme_knative_serving_v1alpha1.go
@@ -18,7 +18,7 @@ limitations under the License.
 package apis
 
 import (
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 func init() {
diff --git a/pkg/trait/classpath_test.go b/pkg/trait/classpath_test.go
index 6ea833c..125d75e 100644
--- a/pkg/trait/classpath_test.go
+++ b/pkg/trait/classpath_test.go
@@ -23,10 +23,11 @@ import (
 	"strings"
 	"testing"
 
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/util/kubernetes"
@@ -147,7 +148,7 @@ func TestApplyClasspathTraitWithKNativeResource(t *testing.T) {
 	trait, environment := createNominalClasspathTest()
 
 	s := serving.Service{}
-	s.Spec.ConfigurationSpec.Template = &serving.RevisionTemplateSpec{}
+	s.Spec.ConfigurationSpec.Template = servingv1.RevisionTemplateSpec{}
 	s.Spec.ConfigurationSpec.Template.Spec.Containers = []corev1.Container{
 		{
 			Name: defaultContainerName,
diff --git a/pkg/trait/container.go b/pkg/trait/container.go
index 4b12089..df7de6e 100644
--- a/pkg/trait/container.go
+++ b/pkg/trait/container.go
@@ -23,7 +23,7 @@ import (
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/util/envvar"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/api/resource"
@@ -130,11 +130,11 @@ func (t *containerTrait) Apply(e *Environment) error {
 		}
 
 		e.ConfigureVolumesAndMounts(
-			&service.Spec.ConfigurationSpec.GetTemplate().Spec.Volumes,
+			&service.Spec.ConfigurationSpec.Template.Spec.Volumes,
 			&container.VolumeMounts,
 		)
 
-		service.Spec.ConfigurationSpec.GetTemplate().Spec.Containers = append(service.Spec.ConfigurationSpec.GetTemplate().Spec.Containers, container)
+		service.Spec.ConfigurationSpec.Template.Spec.Containers = append(service.Spec.ConfigurationSpec.Template.Spec.Containers, container)
 	})
 
 	if t.Expose != nil && *t.Expose {
diff --git a/pkg/trait/istio.go b/pkg/trait/istio.go
index 4f3b353..fb88316 100644
--- a/pkg/trait/istio.go
+++ b/pkg/trait/istio.go
@@ -21,8 +21,8 @@ import (
 	"strconv"
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 	appsv1 "k8s.io/api/apps/v1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
 )
 
 type istioTrait struct {
@@ -56,8 +56,8 @@ func (t *istioTrait) Apply(e *Environment) error {
 		e.Resources.VisitDeployment(func(d *appsv1.Deployment) {
 			d.Spec.Template.Annotations = t.injectIstioAnnotation(d.Spec.Template.Annotations, true)
 		})
-		e.Resources.VisitKnativeConfigurationSpec(func(cs *serving.ConfigurationSpec) {
-			cs.GetTemplate().Annotations = t.injectIstioAnnotation(cs.GetTemplate().Annotations, false)
+		e.Resources.VisitKnativeConfigurationSpec(func(cs *servingv1.ConfigurationSpec) {
+			cs.Template.Annotations = t.injectIstioAnnotation(cs.Template.Annotations, false)
 		})
 	}
 	return nil
diff --git a/pkg/trait/istio_test.go b/pkg/trait/istio_test.go
index 0aaae7c..7f804e4 100644
--- a/pkg/trait/istio_test.go
+++ b/pkg/trait/istio_test.go
@@ -26,10 +26,11 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 func NewIstioTestEnv(t *testing.T, d *appsv1.Deployment, s *serving.Service, enabled bool) Environment {
@@ -73,9 +74,9 @@ func NewIstioTestEnv(t *testing.T, d *appsv1.Deployment, s *serving.Service, ena
 
 func TestIstioInject(t *testing.T) {
 	s := serving.Service{
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{},
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{},
 			},
 		},
 	}
@@ -89,15 +90,15 @@ func TestIstioInject(t *testing.T) {
 	err := env.Catalog.apply(&env)
 	assert.Nil(t, err)
 
-	assert.Empty(t, s.Spec.ConfigurationSpec.GetTemplate().Annotations[istioSidecarInjectAnnotation])
+	assert.Empty(t, s.Spec.ConfigurationSpec.Template.Annotations[istioSidecarInjectAnnotation])
 	assert.NotEmpty(t, d.Spec.Template.Annotations[istioSidecarInjectAnnotation])
 }
 
 func TestIstioForcedInjectTrue(t *testing.T) {
 	s := serving.Service{
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{},
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{},
 			},
 		},
 	}
@@ -113,15 +114,15 @@ func TestIstioForcedInjectTrue(t *testing.T) {
 	err := env.Catalog.apply(&env)
 	assert.Nil(t, err)
 
-	assert.Equal(t, "true", s.Spec.ConfigurationSpec.GetTemplate().Annotations[istioSidecarInjectAnnotation])
+	assert.Equal(t, "true", s.Spec.ConfigurationSpec.Template.Annotations[istioSidecarInjectAnnotation])
 	assert.Equal(t, "true", d.Spec.Template.Annotations[istioSidecarInjectAnnotation])
 }
 
 func TestIstioForcedInjectFalse(t *testing.T) {
 	s := serving.Service{
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{},
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{},
 			},
 		},
 	}
@@ -137,15 +138,15 @@ func TestIstioForcedInjectFalse(t *testing.T) {
 	err := env.Catalog.apply(&env)
 	assert.Nil(t, err)
 
-	assert.Equal(t, "false", s.Spec.ConfigurationSpec.GetTemplate().Annotations[istioSidecarInjectAnnotation])
+	assert.Equal(t, "false", s.Spec.ConfigurationSpec.Template.Annotations[istioSidecarInjectAnnotation])
 	assert.Equal(t, "false", d.Spec.Template.Annotations[istioSidecarInjectAnnotation])
 }
 
 func TestIstioDisabled(t *testing.T) {
 	s := serving.Service{
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{},
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{},
 			},
 		},
 	}
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index 3246138..14705ad 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -19,7 +19,7 @@ package trait
 
 import (
 	"fmt"
-	"net/url"
+	"regexp"
 	"strings"
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
@@ -27,28 +27,53 @@ import (
 	"github.com/apache/camel-k/pkg/util/envvar"
 	"github.com/pkg/errors"
 	"github.com/scylladb/go-set/strset"
+	k8serrors "k8s.io/apimachinery/pkg/api/errors"
+	"k8s.io/apimachinery/pkg/runtime/schema"
 
 	knativeapi "github.com/apache/camel-k/pkg/apis/camel/v1alpha1/knative"
 	knativeutil "github.com/apache/camel-k/pkg/util/knative"
-	duck "github.com/knative/pkg/apis/duck/v1alpha1"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 )
 
 type knativeTrait struct {
 	BaseTrait            `property:",squash"`
-	Configuration        string `property:"configuration"`
-	ChannelSources       string `property:"channel-sources"`
-	ChannelSinks         string `property:"channel-sinks"`
-	EndpointSources      string `property:"endpoint-sources"`
-	EndpointSinks        string `property:"endpoint-sinks"`
-	FilterSourceChannels *bool  `property:"filter-source-channels"`
-	Auto                 *bool  `property:"auto"`
+	Configuration        string   `property:"configuration"`
+	ChannelSources       string   `property:"channel-sources"`
+	ChannelSinks         string   `property:"channel-sinks"`
+	EndpointSources      string   `property:"endpoint-sources"`
+	EndpointSinks        string   `property:"endpoint-sinks"`
+	FilterSourceChannels *bool    `property:"filter-source-channels"`
+	ChannelAPIs          []string `property:"channel-apis"`
+	EndpointAPIs         []string `property:"endpoint-apis"`
+	Auto                 *bool    `property:"auto"`
 }
 
 const (
 	knativeHistoryHeader = "ce-knativehistory"
 )
 
+var (
+	kindAPIGroupVersionFormat = regexp.MustCompile(`^([^/]+)/([^/]+)/([^/]+)$`)
+
+	defaultChannelAPIs = []string{
+		"messaging.knative.dev/v1alpha1/Channel",
+		"eventing.knative.dev/v1alpha1/Channel",
+		"messaging.knative.dev/v1alpha1/InMemoryChannel",
+		"messaging.knative.dev/v1alpha1/KafkaChannel",
+		"messaging.knative.dev/v1alpha1/NatssChannel",
+	}
+
+	defaultEndpointAPIs = []string{
+		"serving.knative.dev/v1beta1/Service",
+		"serving.knative.dev/v1alpha1/Service",
+		"serving.knative.dev/v1/Service",
+	}
+)
+
+func init() {
+	// Channels are also endpoints
+	defaultEndpointAPIs = append(defaultEndpointAPIs, defaultChannelAPIs...)
+}
+
 func newKnativeTrait() *knativeTrait {
 	t := &knativeTrait{
 		BaseTrait: newBaseTrait("knative"),
@@ -66,6 +91,14 @@ func (t *knativeTrait) Configure(e *Environment) (bool, error) {
 		return false, nil
 	}
 
+	// Always applying the defaults
+	if len(t.ChannelAPIs) == 0 {
+		t.ChannelAPIs = append(t.ChannelAPIs, defaultChannelAPIs...)
+	}
+	if len(t.EndpointAPIs) == 0 {
+		t.EndpointAPIs = append(t.EndpointAPIs, defaultEndpointAPIs...)
+	}
+
 	if t.Auto == nil || *t.Auto {
 		if t.ChannelSources == "" {
 			items := make([]string, 0)
@@ -157,8 +190,16 @@ func (t *knativeTrait) createConfiguration(e *Environment) error {
 
 func (t *knativeTrait) createSubscriptions(e *Environment) error {
 	channels := t.extractNames(t.ChannelSources)
+	types, err := decodeKindAPIGroupVersions(t.ChannelAPIs)
+	if err != nil {
+		return err
+	}
 	for _, ch := range channels {
-		sub := knativeutil.CreateSubscription(e.Integration.Namespace, ch, e.Integration.Name)
+		chRef, err := knativeutil.GetAddressableReference(t.ctx, t.client, types, e.Integration.Namespace, ch)
+		if err != nil {
+			return err
+		}
+		sub := knativeutil.CreateSubscription(*chRef, e.Integration.Name)
 		e.Resources.Add(&sub)
 	}
 
@@ -174,7 +215,12 @@ func (t *knativeTrait) configureChannels(e *Environment, env *knativeapi.CamelEn
 	is := strset.Intersection(sr, sk)
 
 	if is.Size() > 0 {
-		return fmt.Errorf("cannot use the same channels as source and synk (%s)", is.List())
+		return fmt.Errorf("cannot use the same channels as source and sink (%s)", is.List())
+	}
+
+	types, err := decodeKindAPIGroupVersions(t.ChannelAPIs)
+	if err != nil {
+		return err
 	}
 
 	// Sources
@@ -183,12 +229,11 @@ func (t *knativeTrait) configureChannels(e *Environment, env *knativeapi.CamelEn
 			continue
 		}
 
-		c, err := knativeutil.GetChannel(t.ctx, t.client, e.Integration.Namespace, ch)
-		if err != nil {
-			return err
-		}
-		if c == nil {
+		targetURL, err := knativeutil.GetAnySinkURL(t.ctx, t.client, types, e.Integration.Namespace, ch)
+		if err != nil && k8serrors.IsNotFound(err) {
 			return errors.Errorf("cannot find channel %s", ch)
+		} else if err != nil {
+			return err
 		}
 
 		meta := map[string]string{
@@ -196,7 +241,7 @@ func (t *knativeTrait) configureChannels(e *Environment, env *knativeapi.CamelEn
 		}
 		if t.FilterSourceChannels != nil && *t.FilterSourceChannels {
 			meta[knativeapi.CamelMetaFilterHeaderName] = knativeHistoryHeader
-			meta[knativeapi.CamelMetaFilterHeaderValue] = c.Status.Address.Hostname
+			meta[knativeapi.CamelMetaFilterHeaderValue] = targetURL.Host
 		}
 		svc := knativeapi.CamelServiceDefinition{
 			Name:        ch,
@@ -215,15 +260,14 @@ func (t *knativeTrait) configureChannels(e *Environment, env *knativeapi.CamelEn
 			continue
 		}
 
-		c, err := knativeutil.GetChannel(t.ctx, t.client, e.Integration.Namespace, ch)
-		if err != nil {
-			return err
-		}
-		if c == nil {
+		targetURL, err := knativeutil.GetAnySinkURL(t.ctx, t.client, types, e.Integration.Namespace, ch)
+		if err != nil && k8serrors.IsNotFound(err) {
 			return errors.Errorf("cannot find channel %s", ch)
+		} else if err != nil {
+			return err
 		}
-
-		svc, err := buildServiceDefinition(ch, knativeapi.CamelServiceTypeChannel, c.Status.Address)
+		t.L.Infof("Found URL for channel %s: %s", ch, targetURL.String())
+		svc, err := knativeapi.BuildCamelServiceDefinition(ch, knativeapi.CamelServiceTypeChannel, *targetURL)
 		if err != nil {
 			return errors.Wrapf(err, "cannot determine address of channel %s", ch)
 		}
@@ -245,6 +289,11 @@ func (t *knativeTrait) configureEndpoints(e *Environment, env *knativeapi.CamelE
 		return fmt.Errorf("cannot use the same enadpoints as source and synk (%s)", is.List())
 	}
 
+	types, err := decodeKindAPIGroupVersions(t.EndpointAPIs)
+	if err != nil {
+		return err
+	}
+
 	// Sources
 	for _, endpoint := range sources {
 		if env.ContainsService(endpoint, knativeapi.CamelServiceTypeEndpoint) {
@@ -269,14 +318,14 @@ func (t *knativeTrait) configureEndpoints(e *Environment, env *knativeapi.CamelE
 			continue
 		}
 
-		s, err := knativeutil.GetService(t.ctx, t.client, e.Integration.Namespace, endpoint)
-		if err != nil {
-			return err
-		}
-		if s == nil {
+		targetURL, err := knativeutil.GetAnySinkURL(t.ctx, t.client, types, e.Integration.Namespace, endpoint)
+		if err != nil && k8serrors.IsNotFound(err) {
 			return errors.Errorf("cannot find endpoint %s", endpoint)
+		} else if err != nil {
+			return err
 		}
-		svc, err := buildServiceDefinitionFromStatus(endpoint, knativeapi.CamelServiceTypeEndpoint, s.Status)
+		t.L.Infof("Found URL for endpoint %s: %s", endpoint, targetURL.String())
+		svc, err := knativeapi.BuildCamelServiceDefinition(endpoint, knativeapi.CamelServiceTypeEndpoint, *targetURL)
 		if err != nil {
 			return errors.Wrapf(err, "cannot determine address of endpoint %s", endpoint)
 		}
@@ -298,32 +347,26 @@ func (t *knativeTrait) extractNames(names string) []string {
 	return answer
 }
 
-// buildServiceDefinitionFromStatus creates a CamelServiceDefinition from a Knative ServiceStatus
-func buildServiceDefinitionFromStatus(name string, serviceType knativeapi.CamelServiceType, status serving.ServiceStatus) (knativeapi.CamelServiceDefinition, error) {
-	// use cluster-local URL from the addressable
-	if status.Address != nil {
-		return buildServiceDefinition(name, serviceType, *status.Address)
-	}
-	// fallback to using the public URL information if available
-	if status.URL != nil && status.URL.Host != "" {
-		return knativeapi.BuildCamelServiceDefinition(name, serviceType, url.URL(*status.URL))
+func decodeKindAPIGroupVersions(specs []string) ([]schema.GroupVersionKind, error) {
+	lst := make([]schema.GroupVersionKind, 0, len(specs))
+	for _, spec := range specs {
+		res, err := decodeKindAPIGroupVersion(spec)
+		if err != nil {
+			return lst, err
+		}
+		lst = append(lst, res)
 	}
-	return knativeapi.CamelServiceDefinition{}, errors.New("cannot determine service hostname")
+	return lst, nil
 }
 
-// buildServiceDefinition creates a CamelServiceDefinition from a Knative Addressable
-func buildServiceDefinition(name string, serviceType knativeapi.CamelServiceType, addressable duck.Addressable) (knativeapi.CamelServiceDefinition, error) {
-	// build it using the URL information if available
-	if addressable.URL != nil && addressable.URL.Host != "" {
-		return knativeapi.BuildCamelServiceDefinition(name, serviceType, url.URL(*addressable.URL))
-	}
-	// fallback to using hostname
-	if addressable.Hostname == "" {
-		return knativeapi.CamelServiceDefinition{}, errors.New("cannot determine addressable hostname")
-	}
-	serviceURL, err := url.Parse(fmt.Sprintf("http://%s", addressable.Hostname))
-	if err != nil {
-		return knativeapi.CamelServiceDefinition{}, err
+func decodeKindAPIGroupVersion(spec string) (schema.GroupVersionKind, error) {
+	if !kindAPIGroupVersionFormat.MatchString(spec) {
+		return schema.GroupVersionKind{}, errors.Errorf("spec does not match the Group/Version/Kind format: %s", spec)
 	}
-	return knativeapi.BuildCamelServiceDefinition(name, serviceType, *serviceURL)
+	matches := kindAPIGroupVersionFormat.FindStringSubmatch(spec)
+	return schema.GroupVersionKind{
+		Group:   matches[1],
+		Version: matches[2],
+		Kind:    matches[3],
+	}, nil
 }
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index 63b56b7..ad622b9 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -24,10 +24,10 @@ import (
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/metadata"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
-	servingbeta "github.com/knative/serving/pkg/apis/serving/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 const (
@@ -198,18 +198,16 @@ func (t *knativeServiceTrait) getServiceFor(e *Environment) *serving.Service {
 			Labels:      labels,
 			Annotations: e.Integration.Annotations,
 		},
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{
 					ObjectMeta: metav1.ObjectMeta{
 						Labels:      labels,
 						Annotations: annotations,
 					},
-					Spec: serving.RevisionSpec{
-						RevisionSpec: servingbeta.RevisionSpec{
-							PodSpec: corev1.PodSpec{
-								ServiceAccountName: e.Integration.Spec.ServiceAccountName,
-							},
+					Spec: servingv1.RevisionSpec{
+						PodSpec: corev1.PodSpec{
+							ServiceAccountName: e.Integration.Spec.ServiceAccountName,
 						},
 					},
 				},
diff --git a/pkg/trait/knative_service_test.go b/pkg/trait/knative_service_test.go
index 91efd14..7b39ed0 100644
--- a/pkg/trait/knative_service_test.go
+++ b/pkg/trait/knative_service_test.go
@@ -28,7 +28,7 @@ import (
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/test"
 
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
@@ -127,7 +127,7 @@ func TestKnativeService(t *testing.T) {
 
 	assert.NotNil(t, s)
 
-	spec := s.Spec.ConfigurationSpec.GetTemplate().Spec
+	spec := s.Spec.ConfigurationSpec.Template.Spec
 
 	assert.Len(t, spec.Containers[0].VolumeMounts, 5)
 	assert.Len(t, spec.Volumes, 5)
@@ -254,6 +254,6 @@ func TestKnativeServiceWithCustomContainerName(t *testing.T) {
 	assert.Equal(
 		t,
 		environment.Integration.Spec.Traits["container"].Configuration["name"],
-		s.Spec.ConfigurationSpec.GetTemplate().Spec.Containers[0].Name,
+		s.Spec.ConfigurationSpec.Template.Spec.Containers[0].Name,
 	)
 }
diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go
index 3611298..a3cbfac 100644
--- a/pkg/trait/knative_test.go
+++ b/pkg/trait/knative_test.go
@@ -19,6 +19,8 @@ package trait
 
 import (
 	"context"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"knative.dev/pkg/apis"
 	"testing"
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
@@ -32,11 +34,13 @@ import (
 
 	knativeapi "github.com/apache/camel-k/pkg/apis/camel/v1alpha1/knative"
 	k8sutils "github.com/apache/camel-k/pkg/util/kubernetes"
-	eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
-	duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
+	duckv1 "knative.dev/pkg/apis/duck/v1"
+	duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 func TestKnativeEnvConfigurationFromTrait(t *testing.T) {
@@ -104,7 +108,6 @@ func TestKnativeEnvConfigurationFromTrait(t *testing.T) {
 	assert.Nil(t, err)
 
 	tr := tc.GetTrait("knative").(*knativeTrait)
-
 	ok, err := tr.Configure(&environment)
 	assert.Nil(t, err)
 	assert.True(t, ok)
@@ -236,35 +239,63 @@ func TestKnativeEnvConfigurationFromSource(t *testing.T) {
 	assert.Equal(t, 8080, source.Port)
 }
 
+func TestDecodeKindAPIGroupVersion(t *testing.T) {
+	kgv, err := decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1/Channel")
+	assert.Nil(t, err)
+	assert.Equal(t, schema.GroupVersionKind{
+		Group:   "messaging.knative.dev",
+		Version: "v1alpha1",
+		Kind:    "Channel",
+	}, kgv)
+
+	kgv, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1/Chann/el/")
+	assert.NotNil(t, err)
+
+	kgv, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1")
+	assert.NotNil(t, err)
+}
+
 func NewFakeClient(namespace string) (client.Client, error) {
+	sink1URL, err := apis.ParseURL("http://endpoint-sink-1.host/")
+	if err != nil {
+		return nil, err
+	}
+	sink2URL, err := apis.ParseURL("http://endpoint-sink-2.host/")
+	if err != nil {
+		return nil, err
+	}
 	return test.NewFakeClient(
-		&eventing.Channel{
+		&messaging.Channel{
 			TypeMeta: metav1.TypeMeta{
 				Kind:       "Channel",
-				APIVersion: eventing.SchemeGroupVersion.String(),
+				APIVersion: messaging.SchemeGroupVersion.String(),
 			},
 			ObjectMeta: metav1.ObjectMeta{
 				Namespace: namespace,
 				Name:      "channel-source-1",
 			},
-			Status: eventing.ChannelStatus{
-				Address: duckv1alpha1.Addressable{
-					Hostname: "channel-source-1.host",
+			Status: messaging.ChannelStatus{
+				AddressStatus: duckv1alpha1.AddressStatus{
+					Address: &duckv1alpha1.Addressable{
+						Hostname: "channel-source-1.host",
+					},
 				},
 			},
 		},
-		&eventing.Channel{
+		&messaging.Channel{
 			TypeMeta: metav1.TypeMeta{
 				Kind:       "Channel",
-				APIVersion: eventing.SchemeGroupVersion.String(),
+				APIVersion: messaging.SchemeGroupVersion.String(),
 			},
 			ObjectMeta: metav1.ObjectMeta{
 				Namespace: namespace,
 				Name:      "channel-sink-1",
 			},
-			Status: eventing.ChannelStatus{
-				Address: duckv1alpha1.Addressable{
-					Hostname: "channel-sink-1.host",
+			Status: messaging.ChannelStatus{
+				AddressStatus: duckv1alpha1.AddressStatus{
+					Address: &duckv1alpha1.Addressable{
+						Hostname: "channel-sink-1.host",
+					},
 				},
 			},
 		},
@@ -277,10 +308,11 @@ func NewFakeClient(namespace string) (client.Client, error) {
 				Namespace: namespace,
 				Name:      "endpoint-sink-1",
 			},
-			Status: serving.ServiceStatus{
-				RouteStatusFields: serving.RouteStatusFields{
-					Address: &duckv1alpha1.Addressable{
-						Hostname: "endpoint-sink-1.host",
+			Status: servingv1.ServiceStatus{
+				RouteStatusFields: servingv1.RouteStatusFields{
+
+					Address: &duckv1.Addressable{
+						URL: sink1URL,
 					},
 				},
 			},
@@ -294,10 +326,10 @@ func NewFakeClient(namespace string) (client.Client, error) {
 				Namespace: namespace,
 				Name:      "endpoint-sink-2",
 			},
-			Status: serving.ServiceStatus{
-				RouteStatusFields: serving.RouteStatusFields{
-					Address: &duckv1alpha1.Addressable{
-						Hostname: "endpoint-sink-2.host",
+			Status: servingv1.ServiceStatus{
+				RouteStatusFields: servingv1.RouteStatusFields{
+					Address: &duckv1.Addressable{
+						URL: sink2URL,
 					},
 				},
 			},
diff --git a/pkg/trait/owner.go b/pkg/trait/owner.go
index e2ab4b3..286b085 100644
--- a/pkg/trait/owner.go
+++ b/pkg/trait/owner.go
@@ -25,7 +25,7 @@ import (
 
 	"github.com/pkg/errors"
 
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	appsv1 "k8s.io/api/apps/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
@@ -113,7 +113,7 @@ func (t *ownerTrait) Apply(e *Environment) error {
 	})
 
 	e.Resources.VisitKnativeService(func(service *serving.Service) {
-		t.propagateLabelAndAnnotations(service.Spec.ConfigurationSpec.GetTemplate(), targetLabels, targetAnnotations)
+		t.propagateLabelAndAnnotations(&service.Spec.ConfigurationSpec.Template, targetLabels, targetAnnotations)
 	})
 
 	return nil
diff --git a/pkg/trait/probes_test.go b/pkg/trait/probes_test.go
index 1248224..e2d1b09 100644
--- a/pkg/trait/probes_test.go
+++ b/pkg/trait/probes_test.go
@@ -25,10 +25,10 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
-	servingbeta "github.com/knative/serving/pkg/apis/serving/v1beta1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 func TestProbesDeps(t *testing.T) {
@@ -101,16 +101,14 @@ func TestProbesOnDeployment(t *testing.T) {
 
 func TestProbesOnKnativeService(t *testing.T) {
 	target := serving.Service{
-		Spec: serving.ServiceSpec{
-			ConfigurationSpec: serving.ConfigurationSpec{
-				Template: &serving.RevisionTemplateSpec{
-					Spec: serving.RevisionSpec{
-						RevisionSpec: servingbeta.RevisionSpec{
-							PodSpec: corev1.PodSpec{
-								Containers: []corev1.Container{
-									{
-										Image: "dummy",
-									},
+		Spec: servingv1.ServiceSpec{
+			ConfigurationSpec: servingv1.ConfigurationSpec{
+				Template: servingv1.RevisionTemplateSpec{
+					Spec: servingv1.RevisionSpec{
+						PodSpec: corev1.PodSpec{
+							Containers: []corev1.Container{
+								{
+									Image: "dummy",
 								},
 							},
 						},
@@ -142,6 +140,6 @@ func TestProbesOnKnativeService(t *testing.T) {
 
 	err = tr.Apply(&e)
 	assert.Nil(t, err)
-	assert.Nil(t, target.Spec.ConfigurationSpec.GetTemplate().Spec.Containers[0].LivenessProbe)
-	assert.Nil(t, target.Spec.ConfigurationSpec.GetTemplate().Spec.Containers[0].ReadinessProbe)
+	assert.Nil(t, target.Spec.ConfigurationSpec.Template.Spec.Containers[0].LivenessProbe)
+	assert.Nil(t, target.Spec.ConfigurationSpec.Template.Spec.Containers[0].ReadinessProbe)
 }
diff --git a/pkg/util/knative/knative.go b/pkg/util/knative/knative.go
index 54bfc6f..2653701 100644
--- a/pkg/util/knative/knative.go
+++ b/pkg/util/knative/knative.go
@@ -19,24 +19,30 @@ package knative
 
 import (
 	"context"
+	"fmt"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"net/url"
 
 	"github.com/apache/camel-k/pkg/client"
 	"github.com/apache/camel-k/pkg/util/log"
-	"github.com/pkg/errors"
-
 	k8serrors "k8s.io/apimachinery/pkg/api/errors"
+	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	"k8s.io/client-go/kubernetes"
+	controller "sigs.k8s.io/controller-runtime/pkg/client"
 	k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
 
-	eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	eventing "knative.dev/eventing/pkg/apis/eventing/v1alpha1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
+	"knative.dev/pkg/apis/duck"
+	duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 // IsEnabledInNamespace returns true if we can list some basic knative objects in the given namespace
 func IsEnabledInNamespace(ctx context.Context, c k8sclient.Reader, namespace string) bool {
-	channels := eventing.ChannelList{
+	channels := messaging.ChannelList{
 		TypeMeta: metav1.TypeMeta{
 			Kind:       "Channel",
 			APIVersion: eventing.SchemeGroupVersion.String(),
@@ -62,73 +68,111 @@ func IsInstalled(ctx context.Context, c kubernetes.Interface) (bool, error) {
 }
 
 // CreateSubscription ---
-func CreateSubscription(namespace string, channel string, name string) eventing.Subscription {
-	return eventing.Subscription{
+func CreateSubscription(channelReference corev1.ObjectReference, serviceName string) messaging.Subscription {
+	return messaging.Subscription{
 		TypeMeta: metav1.TypeMeta{
-			APIVersion: eventing.SchemeGroupVersion.String(),
+			APIVersion: messaging.SchemeGroupVersion.String(),
 			Kind:       "Subscription",
 		},
 		ObjectMeta: metav1.ObjectMeta{
-			Namespace: namespace,
-			Name:      channel + "-" + name,
+			Namespace: channelReference.Namespace,
+			Name:      channelReference.Name + "-" + serviceName,
 		},
-		Spec: eventing.SubscriptionSpec{
+		Spec: messaging.SubscriptionSpec{
 			Channel: corev1.ObjectReference{
-				APIVersion: eventing.SchemeGroupVersion.String(),
-				Kind:       "Channel",
-				Name:       channel,
+				APIVersion: channelReference.GroupVersionKind().GroupVersion().String(),
+				Kind:       channelReference.Kind,
+				Name:       channelReference.Name,
 			},
-			Subscriber: &eventing.SubscriberSpec{
+			Subscriber: &messaging.SubscriberSpec{
 				Ref: &corev1.ObjectReference{
 					APIVersion: serving.SchemeGroupVersion.String(),
 					Kind:       "Service",
-					Name:       name,
+					Name:       serviceName,
 				},
 			},
 		},
 	}
 }
 
-// GetService --
-func GetService(ctx context.Context, client client.Client, namespace string, name string) (*serving.Service, error) {
-	service := serving.Service{
-		TypeMeta: metav1.TypeMeta{
-			Kind:       "Service",
-			APIVersion: serving.SchemeGroupVersion.String(),
-		},
-		ObjectMeta: metav1.ObjectMeta{
+// GetAnySinkURL looks up the resource among all given types and returns the resource sink URL if present
+func GetAnySinkURL(ctx context.Context, c client.Client, types []schema.GroupVersionKind, namespace string, name string) (*url.URL, error) {
+	for _, gvk := range types {
+		sink := corev1.ObjectReference{
+			Kind: gvk.Kind,
+			APIVersion: gvk.GroupVersion().String(),
 			Namespace: namespace,
-			Name:      name,
-		},
-	}
-	key := k8sclient.ObjectKey{
-		Namespace: namespace,
-		Name:      name,
-	}
-	if err := client.Get(ctx, key, &service); err != nil {
-		return nil, errors.Wrap(err, "could not retrieve service "+name+" in namespace "+namespace)
+			Name: name,
+		}
+
+		res, err := GetSinkURI(ctx, c, &sink, namespace)
+		if err != nil && k8serrors.IsNotFound(err) {
+			continue
+		} else if err != nil {
+			return nil, err
+		}
+		return url.Parse(res)
 	}
-	return &service, nil
+	return nil, k8serrors.NewNotFound(schema.GroupResource{}, name)
 }
 
-// GetChannel --
-func GetChannel(ctx context.Context, client client.Client, namespace string, name string) (*eventing.Channel, error) {
-	channel := eventing.Channel{
-		TypeMeta: metav1.TypeMeta{
-			Kind:       "Channel",
-			APIVersion: eventing.SchemeGroupVersion.String(),
-		},
-		ObjectMeta: metav1.ObjectMeta{
+// GetAddressableReference looks up the resource among all given types and returns an object reference to it
+func GetAddressableReference(ctx context.Context, c client.Client, types []schema.GroupVersionKind, namespace string, name string) (*corev1.ObjectReference, error) {
+	for _, gvk := range types {
+		sink := corev1.ObjectReference{
+			Kind: gvk.Kind,
+			APIVersion: gvk.GroupVersion().String(),
 			Namespace: namespace,
-			Name:      name,
-		},
+			Name: name,
+		}
+
+		_, err := GetSinkURI(ctx, c, &sink, namespace)
+		if err != nil && k8serrors.IsNotFound(err) {
+			continue
+		} else if err != nil {
+			return nil, err
+		}
+
+		return &sink, nil
+	}
+	return nil, k8serrors.NewNotFound(schema.GroupResource{}, name)
+}
+
+// GetSinkURI retrieves the sink URI from the object referenced by the given
+// ObjectReference.
+//
+// Method taken from https://github.com/knative/eventing-contrib/blob/master/pkg/controller/sinks/sinks.go
+func GetSinkURI(ctx context.Context, c client.Client, sink *corev1.ObjectReference, namespace string) (string, error) {
+	if sink == nil {
+		return "", fmt.Errorf("sink ref is nil")
+	}
+
+	u := &unstructured.Unstructured{}
+	u.SetGroupVersionKind(sink.GroupVersionKind())
+	err := c.Get(ctx, controller.ObjectKey{Namespace: namespace, Name: sink.Name}, u)
+	if err != nil {
+		return "", err
+	}
+
+	objIdentifier := fmt.Sprintf("\"%s/%s\" (%s)", u.GetNamespace(), u.GetName(), u.GroupVersionKind())
+	// Special case v1/Service to allow it be addressable
+	if u.GroupVersionKind().Kind == "Service" && u.GroupVersionKind().Version == "v1" {
+		return fmt.Sprintf("http://%s.%s.svc/", u.GetName(), u.GetNamespace()), nil
 	}
-	key := k8sclient.ObjectKey{
-		Namespace: namespace,
-		Name:      name,
+
+	t := duckv1alpha1.AddressableType{}
+	err = duck.FromUnstructured(u, &t)
+	if err != nil {
+		return "", fmt.Errorf("failed to deserialize sink %s: %v", objIdentifier, err)
 	}
-	if err := client.Get(ctx, key, &channel); err != nil {
-		return nil, errors.Wrap(err, "could not retrieve channel "+name+" in namespace "+namespace)
+
+	if t.Status.Address == nil {
+		return "", fmt.Errorf("sink %s does not contain address", objIdentifier)
+	}
+
+	url := t.Status.Address.GetURL()
+	if url.Host == "" {
+		return "", fmt.Errorf("sink %s contains an empty hostname", objIdentifier)
 	}
-	return &channel, nil
+	return url.String(), nil
 }
diff --git a/pkg/util/kubernetes/collection.go b/pkg/util/kubernetes/collection.go
index ca00640..0f52d4a 100644
--- a/pkg/util/kubernetes/collection.go
+++ b/pkg/util/kubernetes/collection.go
@@ -19,7 +19,8 @@ package kubernetes
 
 import (
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
-	serving "github.com/knative/serving/pkg/apis/serving/v1alpha1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
+	servingv1 "knative.dev/serving/pkg/apis/serving/v1"
 	routev1 "github.com/openshift/api/route/v1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
@@ -276,16 +277,16 @@ func (c *Collection) VisitContainer(visitor func(container *corev1.Container)) {
 			visitor(cntref)
 		}
 	})
-	c.VisitKnativeConfigurationSpec(func(cs *serving.ConfigurationSpec) {
-		for id := range cs.GetTemplate().Spec.Containers {
-			cntref := &cs.GetTemplate().Spec.Containers[id]
+	c.VisitKnativeConfigurationSpec(func(cs *servingv1.ConfigurationSpec) {
+		for id := range cs.Template.Spec.Containers {
+			cntref := &cs.Template.Spec.Containers[id]
 			visitor(cntref)
 		}
 	})
 }
 
 // VisitKnativeConfigurationSpec executes the visitor function on all knative ConfigurationSpec inside serving Services
-func (c *Collection) VisitKnativeConfigurationSpec(visitor func(container *serving.ConfigurationSpec)) {
+func (c *Collection) VisitKnativeConfigurationSpec(visitor func(container *servingv1.ConfigurationSpec)) {
 	c.VisitKnativeService(func(s *serving.Service) {
 		visitor(&s.Spec.ConfigurationSpec)
 	})
diff --git a/pkg/util/kubernetes/replace.go b/pkg/util/kubernetes/replace.go
index 0e6625f..927a625 100644
--- a/pkg/util/kubernetes/replace.go
+++ b/pkg/util/kubernetes/replace.go
@@ -21,7 +21,7 @@ import (
 	"context"
 
 	"github.com/apache/camel-k/pkg/client"
-	eventing "github.com/knative/eventing/pkg/apis/eventing/v1alpha1"
+	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 	routev1 "github.com/openshift/api/route/v1"
 	"github.com/pkg/errors"
 	corev1 "k8s.io/api/core/v1"
@@ -93,8 +93,8 @@ func mapRequiredRouteData(from runtime.Object, to runtime.Object) {
 }
 
 func mapRequiredKnativeData(from runtime.Object, to runtime.Object) {
-	if fromC, ok := from.(*eventing.Subscription); ok {
-		if toC, ok := to.(*eventing.Subscription); ok {
+	if fromC, ok := from.(*messaging.Subscription); ok {
+		if toC, ok := to.(*messaging.Subscription); ok {
 			toC.Spec.DeprecatedGeneration = fromC.Spec.DeprecatedGeneration
 		}
 	}


[camel-k] 05/08: Fix #952: add Knative 0.8.0 compatibility hack (refactor)

Posted by nf...@apache.org.
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

commit ed724b80eb04ee1fb0abfc185a316f853c3360b3
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 18:23:28 2019 +0200

    Fix #952: add Knative 0.8.0 compatibility hack (refactor)
---
 pkg/apis/knative08compat/knative08compat.go | 86 ++++++++++++++++++++++++++++-
 pkg/util/knative/knative.go                 | 10 +---
 2 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/pkg/apis/knative08compat/knative08compat.go b/pkg/apis/knative08compat/knative08compat.go
index 7939754..a43a73f 100644
--- a/pkg/apis/knative08compat/knative08compat.go
+++ b/pkg/apis/knative08compat/knative08compat.go
@@ -1,6 +1,8 @@
 package knative08compat
 
 import (
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/runtime/schema"
 	messaging "knative.dev/eventing/pkg/apis/messaging/v1alpha1"
 )
@@ -13,10 +15,90 @@ var CompatSchemeGroupVersion = schema.GroupVersion{
 
 // Subscription is a Knative 0.8 compatibility version for messaging.Subscription
 type Subscription struct {
-	messaging.Subscription
+	metav1.TypeMeta   `json:",inline"`
+	metav1.ObjectMeta `json:"metadata"`
+	Spec              messaging.SubscriptionSpec   `json:"spec"`
+	Status            messaging.SubscriptionStatus `json:"status,omitempty"`
 }
 
 // SubscriptionList is a Knative 0.8 compatibility version for messaging.SubscriptionList
 type SubscriptionList struct {
-	messaging.SubscriptionList
+	metav1.TypeMeta `json:",inline"`
+	metav1.ListMeta `json:"metadata"`
+	Items           []Subscription `json:"items"`
+}
+
+// FromMessagingSubscription creates a compat08 subscription from a messaging.Subscription
+func FromMessagingSubscription(s messaging.Subscription) *Subscription {
+	in := s.DeepCopy()
+	out := Subscription{
+		TypeMeta:   in.TypeMeta,
+		ObjectMeta: in.ObjectMeta,
+		Spec:       in.Spec,
+		Status:     in.Status,
+	}
+	// fix API group
+	out.TypeMeta.APIVersion = CompatSchemeGroupVersion.String()
+	return &out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Subscription) DeepCopyInto(out *Subscription) {
+	*out = *in
+	out.TypeMeta = in.TypeMeta
+	in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+	in.Spec.DeepCopyInto(&out.Spec)
+	in.Status.DeepCopyInto(&out.Status)
+	return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subscription.
+func (in *Subscription) DeepCopy() *Subscription {
+	if in == nil {
+		return nil
+	}
+	out := new(Subscription)
+	in.DeepCopyInto(out)
+	return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *Subscription) DeepCopyObject() runtime.Object {
+	if c := in.DeepCopy(); c != nil {
+		return c
+	}
+	return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *SubscriptionList) DeepCopyInto(out *SubscriptionList) {
+	*out = *in
+	out.TypeMeta = in.TypeMeta
+	out.ListMeta = in.ListMeta
+	if in.Items != nil {
+		in, out := &in.Items, &out.Items
+		*out = make([]Subscription, len(*in))
+		for i := range *in {
+			(*in)[i].DeepCopyInto(&(*out)[i])
+		}
+	}
+	return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionList.
+func (in *SubscriptionList) DeepCopy() *SubscriptionList {
+	if in == nil {
+		return nil
+	}
+	out := new(SubscriptionList)
+	in.DeepCopyInto(out)
+	return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *SubscriptionList) DeepCopyObject() runtime.Object {
+	if c := in.DeepCopy(); c != nil {
+		return c
+	}
+	return nil
 }
diff --git a/pkg/util/knative/knative.go b/pkg/util/knative/knative.go
index 874c108..bfa7343 100644
--- a/pkg/util/knative/knative.go
+++ b/pkg/util/knative/knative.go
@@ -72,13 +72,9 @@ func IsInstalled(ctx context.Context, c kubernetes.Interface) (bool, error) {
 
 // CreateSubscription ---
 func CreateSubscription(channelReference corev1.ObjectReference, serviceName string, compat08 bool) runtime.Object {
-	apiVersion := messaging.SchemeGroupVersion.String()
-	if compat08 {
-		apiVersion = knative08compat.CompatSchemeGroupVersion.String()
-	}
 	subs := messaging.Subscription{
 		TypeMeta: metav1.TypeMeta{
-			APIVersion: apiVersion,
+			APIVersion: messaging.SchemeGroupVersion.String(),
 			Kind:       "Subscription",
 		},
 		ObjectMeta: metav1.ObjectMeta{
@@ -102,9 +98,7 @@ func CreateSubscription(channelReference corev1.ObjectReference, serviceName str
 	}
 
 	if compat08 {
-		return &knative08compat.Subscription{
-			Subscription: subs,
-		}
+		return knative08compat.FromMessagingSubscription(subs)
 	}
 	return &subs
 }


[camel-k] 07/08: Fix #952: updated OLM manifest

Posted by nf...@apache.org.
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

commit 0917c9a7862370764b287e791c8952c7d8f11959
Author: nferraro <ni...@gmail.com>
AuthorDate: Fri Sep 27 10:45:55 2019 +0200

    Fix #952: updated OLM manifest
---
 .../camel-k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml                | 1 +
 1 file changed, 1 insertion(+)

diff --git a/deploy/olm-catalog/camel-k/1.0.0-M2-SNAPSHOT/camel-k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml b/deploy/olm-catalog/camel-k/1.0.0-M2-SNAPSHOT/camel-k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml
index d0ea287..1c9cfa5 100644
--- a/deploy/olm-catalog/camel-k/1.0.0-M2-SNAPSHOT/camel-k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml
+++ b/deploy/olm-catalog/camel-k/1.0.0-M2-SNAPSHOT/camel-k.v1.0.0-m2-SNAPSHOT.clusterserviceversion.yaml
@@ -336,6 +336,7 @@ spec:
           - watch
         - apiGroups:
           - eventing.knative.dev
+          - messaging.knative.dev
           resources:
           - '*'
           verbs:


[camel-k] 03/08: Fix #952, #888: fix findings

Posted by nf...@apache.org.
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

commit b5e6e37e3ddcb94f0932aa0349edafe7e777e954
Author: nferraro <ni...@gmail.com>
AuthorDate: Thu Sep 26 12:41:25 2019 +0200

    Fix #952, #888: fix findings
---
 pkg/trait/container.go            | 2 +-
 pkg/trait/knative_service_test.go | 2 +-
 pkg/trait/knative_test.go         | 4 ++--
 pkg/trait/owner.go                | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/container.go b/pkg/trait/container.go
index df7de6e..7ac4435 100644
--- a/pkg/trait/container.go
+++ b/pkg/trait/container.go
@@ -23,11 +23,11 @@ import (
 
 	"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
 	"github.com/apache/camel-k/pkg/util/envvar"
-	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	appsv1 "k8s.io/api/apps/v1"
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/api/resource"
 	"k8s.io/apimachinery/pkg/util/intstr"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 const (
diff --git a/pkg/trait/knative_service_test.go b/pkg/trait/knative_service_test.go
index 7b39ed0..04a21c4 100644
--- a/pkg/trait/knative_service_test.go
+++ b/pkg/trait/knative_service_test.go
@@ -28,9 +28,9 @@ import (
 	"github.com/apache/camel-k/pkg/util/kubernetes"
 	"github.com/apache/camel-k/pkg/util/test"
 
-	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	corev1 "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 
 	"github.com/stretchr/testify/assert"
 )
diff --git a/pkg/trait/knative_test.go b/pkg/trait/knative_test.go
index a3cbfac..35b0a66 100644
--- a/pkg/trait/knative_test.go
+++ b/pkg/trait/knative_test.go
@@ -248,10 +248,10 @@ func TestDecodeKindAPIGroupVersion(t *testing.T) {
 		Kind:    "Channel",
 	}, kgv)
 
-	kgv, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1/Chann/el/")
+	_, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1/Chann/el/")
 	assert.NotNil(t, err)
 
-	kgv, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1")
+	_, err = decodeKindAPIGroupVersion("messaging.knative.dev/v1alpha1")
 	assert.NotNil(t, err)
 }
 
diff --git a/pkg/trait/owner.go b/pkg/trait/owner.go
index 286b085..a056fcb 100644
--- a/pkg/trait/owner.go
+++ b/pkg/trait/owner.go
@@ -25,9 +25,9 @@ import (
 
 	"github.com/pkg/errors"
 
-	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 	appsv1 "k8s.io/api/apps/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	serving "knative.dev/serving/pkg/apis/serving/v1beta1"
 )
 
 // ownerTrait ensures that all created resources belong to the integration being created