diff --git a/Gopkg.lock b/Gopkg.lock index e1321144633..9e1fa621bdc 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -343,19 +343,6 @@ revision = "94859753e2c6724df2be86f6a254f810895fa3eb" version = "v0.2.0" -[[projects]] - branch = "master" - digest = "1:e1ae53a5b5dc5fa6f8cb5fa4596a4436d2754921510766569386efc9c07d839c" - name = "github.com/knative/eventing-sources" - packages = [ - "pkg/apis/sources/v1alpha1", - "pkg/client/clientset/versioned", - "pkg/client/clientset/versioned/scheme", - "pkg/client/clientset/versioned/typed/sources/v1alpha1", - ] - pruneopts = "NUT" - revision = "aa113a015beb91c94a8e173c8f0ac18512a83954" - [[projects]] digest = "1:9870368d47209c3a52b9000fd00420c51832604c00a65aa0a56b6e60a2ff3664" name = "github.com/knative/pkg" @@ -1190,7 +1177,7 @@ revision = "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2" [[projects]] - digest = "1:63139e4089c9b034ec98d8ae54e87c91cd3f5ce5bf9d50dba412c08a363659c4" + digest = "1:b18104b0089c9483846dfcd124fd25a65361697004684b03d4de86546e9808d6" name = "sigs.k8s.io/controller-runtime" packages = [ "pkg/cache", @@ -1212,7 +1199,6 @@ "pkg/recorder", "pkg/runtime/inject", "pkg/runtime/log", - "pkg/runtime/scheme", "pkg/runtime/signals", "pkg/source", "pkg/source/internal", @@ -1235,8 +1221,6 @@ "github.com/google/go-cmp/cmp", "github.com/google/go-cmp/cmp/cmpopts", "github.com/google/uuid", - "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1", - "github.com/knative/eventing-sources/pkg/client/clientset/versioned", "github.com/knative/pkg/apis", "github.com/knative/pkg/apis/duck", "github.com/knative/pkg/apis/duck/v1alpha1", @@ -1282,6 +1266,7 @@ "k8s.io/apimachinery/pkg/util/intstr", "k8s.io/apimachinery/pkg/util/sets", "k8s.io/apimachinery/pkg/util/sets/types", + "k8s.io/apimachinery/pkg/util/uuid", "k8s.io/apimachinery/pkg/util/wait", "k8s.io/apimachinery/pkg/util/yaml", "k8s.io/apimachinery/pkg/watch", diff --git a/test/clients.go b/test/clients.go index 34ab9e01a81..cf2e447da02 100644 --- a/test/clients.go +++ b/test/clients.go @@ -18,7 +18,6 @@ limitations under the License. package test import ( - sources "github.com/knative/eventing-sources/pkg/client/clientset/versioned" eventing "github.com/knative/eventing/pkg/client/clientset/versioned" "github.com/knative/pkg/test" serving "github.com/knative/serving/pkg/client/clientset/versioned" @@ -33,7 +32,6 @@ type Clients struct { Serving *serving.Clientset Eventing *eventing.Clientset Dynamic dynamic.Interface - Sources *sources.Clientset } // NewClients instantiates and returns several clientsets required for making request to the @@ -65,11 +63,6 @@ func NewClients(configPath string, clusterName string, namespace string) (*Clien return nil, err } - clients.Sources, err = sources.NewForConfig(cfg) - if err != nil { - return nil, err - } - return clients, nil } diff --git a/test/crd.go b/test/crd.go index af9cd1950be..bfb556d6260 100644 --- a/test/crd.go +++ b/test/crd.go @@ -18,12 +18,12 @@ package test // crd contains functions that construct boilerplate CRD definitions. import ( - sourcesv1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) // Route returns a Route object in namespace @@ -129,21 +129,6 @@ func Channel(name string, namespace string, provisioner *corev1.ObjectReference) } } -// KubernetesEventSource returns a KubernetesEventSource sinking to specified channel -func KubernetesEventSource(name string, namespace string, targetNamespace string, serviceAccount string, channel *corev1.ObjectReference) *sourcesv1alpha1.KubernetesEventSource { - return &sourcesv1alpha1.KubernetesEventSource{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Namespace: namespace, - }, - Spec: sourcesv1alpha1.KubernetesEventSourceSpec{ - Namespace: targetNamespace, - ServiceAccountName: serviceAccount, - Sink: channel, - }, - } -} - // SubscriberSpecForRoute returns a SubscriberSpec for a given Knative Service. func SubscriberSpecForRoute(name string) *v1alpha1.SubscriberSpec { return &v1alpha1.SubscriberSpec{ @@ -155,6 +140,17 @@ func SubscriberSpecForRoute(name string) *v1alpha1.SubscriberSpec { } } +// SubscriberSpecForService returns a SubscriberSpec for a given Knative Service. +func SubscriberSpecForService(name string) *v1alpha1.SubscriberSpec { + return &v1alpha1.SubscriberSpec{ + Ref: &corev1.ObjectReference{ + Kind: "Service", + APIVersion: "v1", + Name: name, + }, + } +} + // Subscription returns a Subscription func Subscription(name string, namespace string, channel *corev1.ObjectReference, subscriber *v1alpha1.SubscriberSpec, reply *v1alpha1.ReplyStrategy) *v1alpha1.Subscription { return &v1alpha1.Subscription{ @@ -170,26 +166,95 @@ func Subscription(name string, namespace string, channel *corev1.ObjectReference } } -// NGinxPod returns nginx pod defined in given namespace -func NGinxPod(namespace string) *corev1.Pod { +// CloudEvent specifices the arguments for a CloudEvent sent by the sendevent +// binary. +type CloudEvent struct { + ID string + Type string + Source string + Data string + Encoding string // binary or structured +} + +const ( + CloudEventEncodingBinary = "binary" + CloudEventEncodingStructured = "structured" +) + +// EventSenderPod creates a Pod that sends a single event to the given address. +func EventSenderPod(name string, namespace string, sink string, event CloudEvent) *corev1.Pod { + if event.Encoding == "" { + event.Encoding = CloudEventEncodingBinary + } + return &corev1.Pod{ ObjectMeta: metav1.ObjectMeta{ - Name: "nginx", + Name: name, Namespace: namespace, Annotations: map[string]string{"sidecar.istio.io/inject": "true"}, }, Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Name: "nginx", - Image: "nginx:1.7.9", - Ports: []corev1.ContainerPort{ - { - ContainerPort: 80, - }, - }, + Containers: []corev1.Container{{ + Name: "sendevent", + Image: ImagePath("sendevent"), + ImagePullPolicy: corev1.PullAlways, // TODO: this might not be wanted for local. + Args: []string{ + "-event-id", + event.ID, + "-event-type", + event.Type, + "-source", + event.Source, + "-data", + event.Data, + "-encoding", + event.Encoding, + "-sink", + sink, }, - }, + }}, + //TODO restart on failure? + RestartPolicy: corev1.RestartPolicyNever, + }, + } +} + +// EventLoggerPod creates a Pod that logs events received. +func EventLoggerPod(name string, namespace string, selector map[string]string) *corev1.Pod { + return &corev1.Pod{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + Labels: selector, + Annotations: map[string]string{"sidecar.istio.io/inject": "true"}, + }, + Spec: corev1.PodSpec{ + Containers: []corev1.Container{{ + Name: "logevents", + Image: ImagePath("logevents"), + ImagePullPolicy: corev1.PullAlways, // TODO: this might not be wanted for local. + }}, + RestartPolicy: corev1.RestartPolicyAlways, + }, + } +} + +// Service creates a Kubernetes Service with the given name, namespace, and +// selector. Port 8080 is assumed the target port. +func Service(name string, namespace string, selector map[string]string) *corev1.Service { + return &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: namespace, + }, + Spec: corev1.ServiceSpec{ + Selector: selector, + Ports: []corev1.ServicePort{{ + Name: "http", + Port: 80, + Protocol: corev1.ProtocolTCP, + TargetPort: intstr.FromInt(8080), + }}, }, } } diff --git a/test/crd_checks.go b/test/crd_checks.go index 62d93f72732..68e0f1642c0 100644 --- a/test/crd_checks.go +++ b/test/crd_checks.go @@ -23,8 +23,10 @@ import ( "fmt" "time" - servingV1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" - servingtyped "github.com/knative/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1" + eventingv1alpha1 "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" + eventingclient "github.com/knative/eventing/pkg/client/clientset/versioned/typed/eventing/v1alpha1" + servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" + servingclient "github.com/knative/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1" "go.opencensus.io/trace" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -32,14 +34,14 @@ import ( const ( interval = 1 * time.Second - timeout = 5 * time.Minute + timeout = 1 * time.Minute ) // WaitForRouteState polls the status of the Route called name from client every // interval until inState returns `true` indicating it is done, returns an // error or timeout. desc will be used to name the metric that is emitted to // track how long it took for name to get into the state checked by inState. -func WaitForRouteState(client servingtyped.RouteInterface, name string, inState func(r *servingV1alpha1.Route) (bool, error), desc string) error { +func WaitForRouteState(client servingclient.RouteInterface, name string, inState func(r *servingv1alpha1.Route) (bool, error), desc string) error { metricName := fmt.Sprintf("WaitForRouteState/%s/%s", name, desc) _, span := trace.StartSpan(context.Background(), metricName) defer span.End() @@ -52,3 +54,40 @@ func WaitForRouteState(client servingtyped.RouteInterface, name string, inState return inState(r) }) } + +// WaitForChannelState polls the status of the Channel called name from client +// every interval until inState returns `true` indicating it is done, returns an +// error or timeout. desc will be used to name the metric that is emitted to +// track how long it took for name to get into the state checked by inState. +func WaitForChannelState(client eventingclient.ChannelInterface, name string, inState func(r *eventingv1alpha1.Channel) (bool, error), desc string) error { + metricName := fmt.Sprintf("WaitForChannelState/%s/%s", name, desc) + _, span := trace.StartSpan(context.Background(), metricName) + defer span.End() + + return wait.PollImmediate(interval, timeout, func() (bool, error) { + r, err := client.Get(name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(r) + }) +} + +// WaitForSubscriptionState polls the status of the Subscription called name +// from client every interval until inState returns `true` indicating it is +// done, returns an error or timeout. desc will be used to name the metric that +// is emitted to track how long it took for name to get into the state checked +// by inState. +func WaitForSubscriptionState(client eventingclient.SubscriptionInterface, name string, inState func(r *eventingv1alpha1.Subscription) (bool, error), desc string) error { + metricName := fmt.Sprintf("WaitForSubscriptionState/%s/%s", name, desc) + _, span := trace.StartSpan(context.Background(), metricName) + defer span.End() + + return wait.PollImmediate(interval, timeout, func() (bool, error) { + r, err := client.Get(name, metav1.GetOptions{}) + if err != nil { + return true, err + } + return inState(r) + }) +} diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index add28dc6aac..b8381d5a0c1 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -14,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script runs the end-to-end tests against the eventing -# built from source. +# This script runs the end-to-end tests against eventing built from source. # If you already have the *_OVERRIDE environment variables set, call # this script with the --run-tests arguments and it will use the cluster @@ -27,49 +26,28 @@ source $(dirname $0)/../vendor/github.com/knative/test-infra/scripts/e2e-tests.sh -# Using the most recent good release of eventing-sources to unblock tests. This -# should be replaced with the commented line below when eventing-sources nightly -# is known good again. -readonly KNATIVE_EVENTING_SOURCES_RELEASE=https://knative-nightly.storage.googleapis.com/eventing-sources/previous/v20181205-fbac942/release.yaml -#readonly KNATIVE_EVENTING_SOURCES_RELEASE=https://knative-nightly.storage.googleapis.com/eventing-sources/latest/release.yaml - # Names of the Resources used in the tests. -readonly E2E_TEST_NAMESPACE=e2etest -readonly E2E_TEST_FUNCTION_NAMESPACE=e2etestfn3 +# Currently this namespace must be the same as the namespace specified in +# test/e2e/e2e.go. +readonly E2E_TEST_NAMESPACE=e2etest-knative-eventing # Helper functions. -# Install the latest stable Knative/serving in the current cluster. -function start_latest_eventing_sources() { - subheader "Installing Knative Eventing Sources" - kubectl apply -f ${KNATIVE_EVENTING_SOURCES_RELEASE} || return 1 - wait_until_pods_running knative-sources || return 1 -} - - function teardown() { teardown_events_test_resources ko delete --ignore-not-found=true -f config/ - ko delete --ignore-not-found=true -f ${KNATIVE_EVENTING_SOURCES_RELEASE} wait_until_object_does_not_exist namespaces knative-eventing - wait_until_object_does_not_exist namespaces knative-sources wait_until_object_does_not_exist customresourcedefinitions subscriptions.eventing.knative.dev wait_until_object_does_not_exist customresourcedefinitions channels.eventing.knative.dev } function setup_events_test_resources() { - kubectl create namespace ${E2E_TEST_NAMESPACE} || return 1 - kubectl create namespace ${E2E_TEST_FUNCTION_NAMESPACE} + kubectl create namespace ${E2E_TEST_NAMESPACE} } function teardown_events_test_resources() { - # Delete the function namespace - echo "Deleting namespace ${E2E_TEST_FUNCTION_NAMESPACE}" - kubectl --ignore-not-found=true delete namespace ${E2E_TEST_FUNCTION_NAMESPACE} - wait_until_object_does_not_exist namespaces ${E2E_TEST_FUNCTION_NAMESPACE} || return 1 - # Delete the test namespace echo "Deleting namespace $E2E_TEST_NAMESPACE" kubectl --ignore-not-found=true delete namespace ${E2E_TEST_NAMESPACE} @@ -91,9 +69,6 @@ if (( ! USING_EXISTING_CLUSTER )); then start_latest_knative_serving || fail_test "Serving did not come up" fi -# Install Knative Eventing Sources -start_latest_eventing_sources || fail_test "Eventing Sources did not come up" - # Clean up anything that might still be around teardown_events_test_resources || fail_test "Error cleaning up test resources" diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index 62ba6f81ef3..a183ec5cb9c 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -1,3 +1,18 @@ +/* +Copyright 2019 The Knative Authors +Licensed 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 e2e import ( @@ -6,7 +21,6 @@ import ( "testing" "time" - sourcesv1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" "github.com/knative/eventing/test" pkgTest "github.com/knative/pkg/test" @@ -24,16 +38,16 @@ import ( ) const ( - defaultNamespaceName = "e2etestfn3" - testNamespace = "e2etest" - interval = 1 * time.Second - timeout = 1 * time.Minute + DefaultTestNamespace = "e2etest-knative-eventing" + + interval = 1 * time.Second + timeout = 1 * time.Minute ) // Setup creates the client objects needed in the e2e tests. func Setup(t *testing.T, logger *logging.BaseLogger) (*test.Clients, *test.Cleaner) { if pkgTest.Flags.Namespace == "" { - pkgTest.Flags.Namespace = defaultNamespaceName + pkgTest.Flags.Namespace = DefaultTestNamespace } clients, err := test.NewClients( @@ -51,21 +65,13 @@ func Setup(t *testing.T, logger *logging.BaseLogger) (*test.Clients, *test.Clean // TearDown will delete created names using clients. func TearDown(clients *test.Clients, cleaner *test.Cleaner, logger *logging.BaseLogger) { cleaner.Clean(true) - - // There seems to be an Istio bug where if we delete / create - // VirtualServices too quickly we will hit pro-longed "No health - // upstream" causing timeouts. Adding this small sleep to - // sidestep the issue. - // - // TODO(#1376): Fix this when upstream fix is released. - logger.Info("Sleeping for 20 seconds after clean to avoid hitting issue in #1376") - time.Sleep(20 * time.Second) } // CreateRouteAndConfig will create Route and Config objects using clients. // The Config object will serve requests to a container started from the image at imagePath. func CreateRouteAndConfig(clients *test.Clients, logger *logging.BaseLogger, cleaner *test.Cleaner, name string, imagePath string) error { configurations := clients.Serving.ServingV1alpha1().Configurations(pkgTest.Flags.Namespace) + logger.Infof("configuration: %#v", test.Configuration(name, pkgTest.Flags.Namespace, imagePath)) config, err := configurations.Create( test.Configuration(name, pkgTest.Flags.Namespace, imagePath)) if err != nil { @@ -74,6 +80,7 @@ func CreateRouteAndConfig(clients *test.Clients, logger *logging.BaseLogger, cle cleaner.Add(servingV1alpha1.SchemeGroupVersion.Group, servingV1alpha1.SchemeGroupVersion.Version, "configurations", pkgTest.Flags.Namespace, config.ObjectMeta.Name) routes := clients.Serving.ServingV1alpha1().Routes(pkgTest.Flags.Namespace) + logger.Infof("route: %#v", test.Route(name, pkgTest.Flags.Namespace, name)) route, err := routes.Create( test.Route(name, pkgTest.Flags.Namespace, name)) if err != nil { @@ -96,17 +103,6 @@ func WithRouteReady(clients *test.Clients, logger *logging.BaseLogger, cleaner * return nil } -// CreateKubernetesEventSource creates a KubernetesEventSource -func CreateKubernetesEventSource(clients *test.Clients, source *sourcesv1alpha1.KubernetesEventSource, logger *logging.BaseLogger, cleaner *test.Cleaner) error { - k8sSources := clients.Sources.SourcesV1alpha1().KubernetesEventSources(pkgTest.Flags.Namespace) - res, err := k8sSources.Create(source) - if err != nil { - return err - } - cleaner.Add(sourcesv1alpha1.SchemeGroupVersion.Group, sourcesv1alpha1.SchemeGroupVersion.Version, "kuberneteseventsources", pkgTest.Flags.Namespace, res.ObjectMeta.Name) - return nil -} - // CreateChannel will create a Channel func CreateChannel(clients *test.Clients, channel *v1alpha1.Channel, logger *logging.BaseLogger, cleaner *test.Cleaner) error { channels := clients.Eventing.EventingV1alpha1().Channels(pkgTest.Flags.Namespace) @@ -119,9 +115,9 @@ func CreateChannel(clients *test.Clients, channel *v1alpha1.Channel, logger *log } // CreateSubscription will create a Subscription -func CreateSubscription(clients *test.Clients, subs *v1alpha1.Subscription, logger *logging.BaseLogger, cleaner *test.Cleaner) error { +func CreateSubscription(clients *test.Clients, sub *v1alpha1.Subscription, logger *logging.BaseLogger, cleaner *test.Cleaner) error { subscriptions := clients.Eventing.EventingV1alpha1().Subscriptions(pkgTest.Flags.Namespace) - res, err := subscriptions.Create(subs) + res, err := subscriptions.Create(sub) if err != nil { return err } @@ -129,6 +125,40 @@ func CreateSubscription(clients *test.Clients, subs *v1alpha1.Subscription, logg return nil } +// WithChannelAndSubscriptionReady creates a Channel and Subscription and waits until both are Ready. +func WithChannelAndSubscriptionReady(clients *test.Clients, channel *v1alpha1.Channel, sub *v1alpha1.Subscription, logger *logging.BaseLogger, cleaner *test.Cleaner) error { + if err := CreateChannel(clients, channel, logger, cleaner); err != nil { + return err + } + if err := CreateSubscription(clients, sub, logger, cleaner); err != nil { + return err + } + + channels := clients.Eventing.EventingV1alpha1().Channels(pkgTest.Flags.Namespace) + if err := test.WaitForChannelState(channels, channel.Name, test.IsChannelReady, "ChannelIsReady"); err != nil { + return err + } + // Update the given object so they'll reflect the ready state + updatedchannel, err := channels.Get(channel.Name, metav1.GetOptions{}) + if err != nil { + return err + } + updatedchannel.DeepCopyInto(channel) + + subscriptions := clients.Eventing.EventingV1alpha1().Subscriptions(pkgTest.Flags.Namespace) + if err = test.WaitForSubscriptionState(subscriptions, sub.Name, test.IsSubscriptionReady, "SubscriptionIsReady"); err != nil { + return err + } + // Update the given object so they'll reflect the ready state + updatedsub, err := subscriptions.Get(sub.Name, metav1.GetOptions{}) + if err != nil { + return err + } + updatedsub.DeepCopyInto(sub) + + return nil +} + // CreateServiceAccount will create a service account func CreateServiceAccount(clients *test.Clients, sa *corev1.ServiceAccount, logger *logging.BaseLogger, cleaner *test.Cleaner) error { sas := clients.Kube.Kube.CoreV1().ServiceAccounts(pkgTest.Flags.Namespace) @@ -157,7 +187,7 @@ func CreateServiceAccountAndBinding(clients *test.Clients, name string, logger * sa := &corev1.ServiceAccount{ ObjectMeta: metav1.ObjectMeta{ Name: name, - Namespace: defaultNamespaceName, + Namespace: pkgTest.Flags.Namespace, }, } err := CreateServiceAccount(clients, sa, logger, cleaner) @@ -166,13 +196,13 @@ func CreateServiceAccountAndBinding(clients *test.Clients, name string, logger * } crb := &rbacv1.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ - Name: "e2e-tests-admin", + Name: fmt.Sprintf("%s-%s-admin", sa.Name, sa.Namespace), }, Subjects: []rbacv1.Subject{ { Kind: "ServiceAccount", - Name: name, - Namespace: defaultNamespaceName, + Name: sa.Name, + Namespace: sa.Namespace, }, }, RoleRef: rbacv1.RoleRef{ @@ -188,6 +218,17 @@ func CreateServiceAccountAndBinding(clients *test.Clients, name string, logger * return nil } +// CreateService will create a Service +func CreateService(clients *test.Clients, svc *corev1.Service, logger *logging.BaseLogger, cleaner *test.Cleaner) error { + svcs := clients.Kube.Kube.CoreV1().Services(svc.GetNamespace()) + res, err := svcs.Create(svc) + if err != nil { + return err + } + cleaner.Add(corev1.SchemeGroupVersion.Group, corev1.SchemeGroupVersion.Version, "services", res.ObjectMeta.Namespace, res.ObjectMeta.Name) + return nil +} + // CreatePod will create a Pod func CreatePod(clients *test.Clients, pod *corev1.Pod, logger *logging.BaseLogger, cleaner *test.Cleaner) error { pods := clients.Kube.Kube.CoreV1().Pods(pod.GetNamespace()) @@ -200,8 +241,8 @@ func CreatePod(clients *test.Clients, pod *corev1.Pod, logger *logging.BaseLogge } // PodLogs returns Pod logs for given Pod and Container -func PodLogs(clients *test.Clients, podName string, containerName string, logger *logging.BaseLogger) ([]byte, error) { - pods := clients.Kube.Kube.CoreV1().Pods(pkgTest.Flags.Namespace) +func PodLogs(clients *test.Clients, podName string, containerName string, namespace string, logger *logging.BaseLogger) ([]byte, error) { + pods := clients.Kube.Kube.CoreV1().Pods(namespace) podList, err := pods.List(metav1.ListOptions{}) if err != nil { return nil, err @@ -211,6 +252,12 @@ func PodLogs(clients *test.Clients, podName string, containerName string, logger result := pods.GetLogs(pod.Name, &corev1.PodLogOptions{ Container: containerName, }).Do() + raw, err := result.Raw() + if err == nil { + logger.Infof("%s logs request result: %#v", podName, string(raw)) + } else { + logger.Infof("%s logs request result: %#v", podName, err) + } return result.Raw() } } @@ -219,9 +266,9 @@ func PodLogs(clients *test.Clients, podName string, containerName string, logger // WaitForLogContent waits until logs for given Pod/Container include the given content. // If the content is not present within timeout it returns error. -func WaitForLogContent(clients *test.Clients, logger *logging.BaseLogger, podName string, containerName string, content string) error { +func WaitForLogContent(clients *test.Clients, logger *logging.BaseLogger, podName string, containerName string, namespace string, content string) error { return wait.PollImmediate(interval, timeout, func() (bool, error) { - logs, err := PodLogs(clients, podName, containerName, logger) + logs, err := PodLogs(clients, podName, containerName, namespace, logger) if err != nil { return true, err } @@ -236,8 +283,3 @@ func WaitForAllPodsRunning(clients *test.Clients, logger *logging.BaseLogger, na } return nil } - -// ImagePath is a helper function to prefix image name with repo and suffix with tag -func ImagePath(name string) string { - return fmt.Sprintf("%s/%s:%s", test.EventingFlags.DockerRepo, name, test.EventingFlags.Tag) -} diff --git a/test/e2e/k8s_events_test.go b/test/e2e/k8s_events_test.go deleted file mode 100644 index f321f3071f4..00000000000 --- a/test/e2e/k8s_events_test.go +++ /dev/null @@ -1,106 +0,0 @@ -// +build e2e - -/* -Copyright 2018 The Knative Authors -Licensed 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 e2e - -import ( - "testing" - "time" - - "github.com/knative/eventing/test" - pkgTest "github.com/knative/pkg/test" - "github.com/knative/pkg/test/logging" -) - -const ( - serviceAccount = "e2e-receive-adapter" - eventSource = "k8sevents" - routeName = "e2e-k8s-events-function" - channelName = "e2e-k8s-events-channel" - provisionerName = "in-memory-channel" - subscriptionName = "e2e-k8s-events-subscription" -) - -func TestKubernetesEvents(t *testing.T) { - - logger := logging.GetContextLogger("TestKubernetesEvents") - - clients, cleaner := Setup(t, logger) - - test.CleanupOnInterrupt(func() { TearDown(clients, cleaner, logger) }, logger) - defer TearDown(clients, cleaner, logger) - - logger.Infof("Creating ServiceAccount and Binding") - - err := CreateServiceAccountAndBinding(clients, serviceAccount, logger, cleaner) - if err != nil { - t.Fatalf("Failed to create ServiceAccount or Binding: %v", err) - } - - logger.Infof("Creating Channel") - channel := test.Channel(channelName, defaultNamespaceName, test.ClusterChannelProvisioner(provisionerName)) - err = CreateChannel(clients, channel, logger, cleaner) - if err != nil { - t.Fatalf("Failed to create Channel: %v", err) - } - - logger.Infof("Creating EventSource") - k8sSource := test.KubernetesEventSource(eventSource, defaultNamespaceName, testNamespace, serviceAccount, test.ChannelRef(channelName)) - err = CreateKubernetesEventSource(clients, k8sSource, logger, cleaner) - if err != nil { - t.Fatalf("Failed to create KubernetesEventSource: %v", err) - } - - logger.Infof("Creating Route and Config") - // The receiver of events which is accessible through Route - configImagePath := ImagePath("k8sevents") - err = WithRouteReady(clients, logger, cleaner, routeName, configImagePath) - if err != nil { - t.Fatalf("The Route was not marked as Ready to serve traffic: %v", err) - } - - logger.Infof("Creating Subscription") - subscription := test.Subscription(subscriptionName, defaultNamespaceName, test.ChannelRef(channelName), test.SubscriberSpecForRoute(routeName), nil) - err = CreateSubscription(clients, subscription, logger, cleaner) - if err != nil { - t.Fatalf("Failed to create Subscription: %v", err) - } - - //Work around for: https://github.com/knative/eventing/issues/125 - //and the fact that even after pods are up, due to Istio slowdown, there's - //about 5-6 seconds that traffic won't be passed through. - WaitForAllPodsRunning(clients, logger, pkgTest.Flags.Namespace) - time.Sleep(10 * time.Second) - - logger.Infof("Creating Pod") - - err = CreatePod(clients, test.NGinxPod(testNamespace), logger, cleaner) - if err != nil { - t.Fatalf("Failed to create Pod: %v", err) - } - - WaitForAllPodsRunning(clients, logger, testNamespace) - - err = WaitForLogContent(clients, logger, routeName, "user-container", "Created container") - if err != nil { - t.Fatalf("Events for container created not received: %v", err) - } - err = WaitForLogContent(clients, logger, routeName, "user-container", "Started container") - if err != nil { - t.Fatalf("Events for container started not received: %v", err) - } -} diff --git a/test/e2e/single_event_test.go b/test/e2e/single_event_test.go new file mode 100644 index 00000000000..d5b8cb5c075 --- /dev/null +++ b/test/e2e/single_event_test.go @@ -0,0 +1,156 @@ +// +build e2e + +/* +Copyright 2019 The Knative Authors +Licensed 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 e2e + +import ( + "fmt" + "github.com/knative/eventing/test" + pkgTest "github.com/knative/pkg/test" + "github.com/knative/pkg/test/logging" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/uuid" + "testing" + "time" +) + +const ( + channelName = "e2e-singleevent" + provisionerName = "in-memory-channel" + subscriberName = "e2e-singleevent-subscriber" + senderName = "e2e-singleevent-sender" + subscriptionName = "e2e-singleevent-subscription" + routeName = "e2e-singleevent-route" +) + +func namespaceExists(t *testing.T, clients *test.Clients) (string, func()) { + logger := logging.GetContextLogger("TestSingleEvent") + shutdown := func() {} + ns := pkgTest.Flags.Namespace + logger.Infof("Namespace: %s", ns) + + nsSpec, err := clients.Kube.Kube.CoreV1().Namespaces().Get(ns, metav1.GetOptions{}) + + if err != nil && errors.IsNotFound(err) { + nsSpec = &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns}} + logger.Infof("Creating Namespace: %s", ns) + nsSpec, err = clients.Kube.Kube.CoreV1().Namespaces().Create(nsSpec) + if err != nil { + t.Fatalf("Failed to create Namespace: %s; %v", ns, err) + } else { + shutdown = func() { + clients.Kube.Kube.CoreV1().Namespaces().Delete(nsSpec.Name, nil) + // TODO: this is a bit hacky but in order for the tests to work + // correctly for a clean namespace to be created we need to also + // wait for it to be removed. + // To fix this we could generate namespace names. + // This only happens when the namespace provided does not exist. + // + // wait up to 120 seconds for the namespace to be removed. + logger.Infof("Deleting Namespace: %s", ns) + for i := 0; i < 120; i++ { + time.Sleep(1 * time.Second) + if _, err := clients.Kube.Kube.CoreV1().Namespaces().Get(ns, metav1.GetOptions{}); err != nil && errors.IsNotFound(err) { + logger.Info("Namespace has been deleted") + // the namespace is gone. + break + } + } + } + } + } + return ns, shutdown +} + +func TestSingleBinaryEvent(t *testing.T) { + SingleEvent(t, test.CloudEventEncodingBinary) +} + +func TestSingleStructuredEvent(t *testing.T) { + SingleEvent(t, test.CloudEventEncodingStructured) +} + +func SingleEvent(t *testing.T, encoding string) { + logger := logging.GetContextLogger("TestSingleEvent") + + clients, cleaner := Setup(t, logger) + defer TearDown(clients, cleaner, logger) + + // verify namespace + + ns, cleanupNS := namespaceExists(t, clients) + defer cleanupNS() + + // create logger pod + + logger.Infof("creating subscriber pod") + selector := map[string]string{"e2etest": string(uuid.NewUUID())} + subscriberPod := test.EventLoggerPod(routeName, ns, selector) + if err := CreatePod(clients, subscriberPod, logger, cleaner); err != nil { + t.Fatalf("Failed to create event logger pod: %v", err) + } + if err := WaitForAllPodsRunning(clients, logger, ns); err != nil { + t.Fatalf("Error waiting for logger pod to become running: %v", err) + } + logger.Infof("subscriber pod running") + + subscriberSvc := test.Service(routeName, ns, selector) + if err := CreateService(clients, subscriberSvc, logger, cleaner); err != nil { + t.Fatalf("Failed to create event logger service: %v", err) + } + + // Reload subscriberPod to get IP + subscriberPod, err := clients.Kube.Kube.CoreV1().Pods(subscriberPod.Namespace).Get(subscriberPod.Name, metav1.GetOptions{}) + if err != nil { + t.Fatalf("Failed to get subscriber pod: %v", err) + } + + // create channel + + logger.Infof("Creating Channel and Subscription") + channel := test.Channel(channelName, ns, test.ClusterChannelProvisioner(provisionerName)) + logger.Infof("channel: %#v", channel) + sub := test.Subscription(subscriptionName, ns, test.ChannelRef(channelName), test.SubscriberSpecForService(routeName), nil) + logger.Infof("sub: %#v", sub) + + if err := WithChannelAndSubscriptionReady(clients, channel, sub, logger, cleaner); err != nil { + t.Fatalf("The Channel or Subscription were not marked as Ready: %v", err) + } + + // create sender pod + + logger.Infof("Creating event sender") + body := fmt.Sprintf("TestSingleEvent %s", uuid.NewUUID()) + event := test.CloudEvent{ + Source: senderName, + Type: "test.eventing.knative.dev", + Data: fmt.Sprintf(`{"msg":%q}`, body), + Encoding: encoding, + } + url := fmt.Sprintf("http://%s", channel.Status.Address.Hostname) + pod := test.EventSenderPod(senderName, ns, url, event) + logger.Infof("sender pod: %#v", pod) + if err := CreatePod(clients, pod, logger, cleaner); err != nil { + t.Fatalf("Failed to create event sender pod: %v", err) + } + + if err := WaitForLogContent(clients, logger, routeName, subscriberPod.Spec.Containers[0].Name, ns, body); err != nil { + t.Fatalf("String %q not found in logs of subscriber pod %q: %v", body, routeName, err) + } +} diff --git a/test/e2e_flags.go b/test/e2e_flags.go index 8f90995023d..c039e78ad6e 100644 --- a/test/e2e_flags.go +++ b/test/e2e_flags.go @@ -20,6 +20,7 @@ package test import ( "flag" + "fmt" "os" "path" @@ -39,7 +40,13 @@ type EventingEnvironmentFlags struct { func initializeEventingFlags() *EventingEnvironmentFlags { var f EventingEnvironmentFlags - defaultRepo := path.Join(os.Getenv("DOCKER_REPO_OVERRIDE"), "github.com/knative/eventing/test/test_images") + repo := os.Getenv("DOCKER_REPO_OVERRIDE") + + if repo == "" { + repo = os.Getenv("KO_DOCKER_REPO") + } + + defaultRepo := path.Join(repo, "github.com/knative/eventing/test/test_images") flag.StringVar(&f.DockerRepo, "dockerrepo", defaultRepo, "Provide the uri of the docker repo you have uploaded the test image to using `uploadtestimage.sh`. Defaults to $DOCKER_REPO_OVERRIDE") @@ -55,3 +62,8 @@ func initializeEventingFlags() *EventingEnvironmentFlags { return &f } + +// ImagePath returns an image path using the configured image repo and tag. +func ImagePath(name string) string { + return fmt.Sprintf("%s/%s:%s", EventingFlags.DockerRepo, name, EventingFlags.Tag) +} diff --git a/test/states.go b/test/states.go index 849f5e360d8..49f4256435e 100644 --- a/test/states.go +++ b/test/states.go @@ -16,35 +16,52 @@ limitations under the License. package test import ( - "github.com/knative/serving/pkg/apis/serving/v1alpha1" + "log" + + eventingv1alpha1 "github.com/knative/eventing/pkg/apis/eventing/v1alpha1" + servingv1alpha1 "github.com/knative/serving/pkg/apis/serving/v1alpha1" corev1 "k8s.io/api/core/v1" ) -// states contains functions for asserting against the state of Knative Serving -// crds to see if they have achieved the states specified in the spec -// (https://github.com/knative/serving/blob/master/docs/spec/spec.md). - // IsRevisionReady will check the status conditions of the revision and return true if the revision is // ready to serve traffic. It will return false if the status indicates a state other than deploying // or being ready. It will also return false if the type of the condition is unexpected. -func IsRevisionReady(r *v1alpha1.Revision) (bool, error) { +func IsRevisionReady(r *servingv1alpha1.Revision) (bool, error) { return r.Status.IsReady(), nil } // IsServiceReady will check the status conditions of the service and return true if the service is // ready. This means that its configurations and routes have all reported ready. -func IsServiceReady(s *v1alpha1.Service) (bool, error) { +func IsServiceReady(s *servingv1alpha1.Service) (bool, error) { return s.Status.IsReady(), nil } // IsRouteReady will check the status conditions of the route and return true if the route is // ready. -func IsRouteReady(r *v1alpha1.Route) (bool, error) { +func IsRouteReady(r *servingv1alpha1.Route) (bool, error) { return r.Status.IsReady(), nil } -// PodsRunning will check the status conditions of the pod list and return true all pods are Running +// IsChannelReady will check the status conditions of the Channel and return true +// if the Channel is ready. +func IsChannelReady(c *eventingv1alpha1.Channel) (bool, error) { + return c.Status.IsReady(), nil +} + +// IsSubscriptionReady will check the status conditions of the Subscription and +// return true if the Subscription is ready. +func IsSubscriptionReady(s *eventingv1alpha1.Subscription) (bool, error) { + return s.Status.IsReady(), nil +} + +// PodsRunning will check the status conditions of the pod list and return true +// if all pods are Running. func PodsRunning(podList *corev1.PodList) (bool, error) { + var names []string + for _, p := range podList.Items { + names = append(names, p.Name) + } + log.Printf("Checking pods: %v", names) for _, pod := range podList.Items { if pod.Status.Phase != corev1.PodRunning && pod.Status.Phase != corev1.PodSucceeded { return false, nil diff --git a/test/test_images/k8sevents/kodata/LICENSE b/test/test_images/logevents/kodata/LICENSE similarity index 100% rename from test/test_images/k8sevents/kodata/LICENSE rename to test/test_images/logevents/kodata/LICENSE diff --git a/test/test_images/k8sevents/kodata/VENDOR-LICENSE b/test/test_images/logevents/kodata/VENDOR-LICENSE similarity index 100% rename from test/test_images/k8sevents/kodata/VENDOR-LICENSE rename to test/test_images/logevents/kodata/VENDOR-LICENSE diff --git a/test/test_images/k8sevents/function.go b/test/test_images/logevents/main.go similarity index 72% rename from test/test_images/k8sevents/function.go rename to test/test_images/logevents/main.go index 4c1d7779b29..f40dc2c3fb9 100644 --- a/test/test_images/k8sevents/function.go +++ b/test/test_images/logevents/main.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The Knative Authors +Copyright 2019 The Knative Authors Licensed 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 @@ -20,13 +20,16 @@ import ( "time" "github.com/knative/pkg/cloudevents" - - corev1 "k8s.io/api/core/v1" ) -func handler(ctx context.Context, e *corev1.Event) { +type Heartbeat struct { + Sequence int `json:"id"` + Data string `json:"data"` +} + +func handler(ctx context.Context, data map[string]interface{}) { metadata := cloudevents.FromContext(ctx) - log.Printf("[%s] %s : %q", metadata.EventTime.Format(time.RFC3339), metadata.Source, e.Message) + log.Printf("[%s] %s %s: %+v", metadata.EventTime.Format(time.RFC3339), metadata.ContentType, metadata.Source, data) } func main() { diff --git a/test/test_images/sendevent/main.go b/test/test_images/sendevent/main.go new file mode 100644 index 00000000000..766fcb28e6c --- /dev/null +++ b/test/test_images/sendevent/main.go @@ -0,0 +1,166 @@ +/* +Copyright 2019 The Knative Authors + +Licensed 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 + + https://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 main + +import ( + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "log" + "net/http" + "os" + "strconv" + "time" + + "github.com/google/uuid" + "github.com/knative/pkg/cloudevents" +) + +type Heartbeat struct { + Sequence int `json:"id"` + Data string `json:"data"` +} + +var ( + sink string + data string + eventID string + eventType string + source string + periodStr string + delayStr string + maxMsgStr string + encoding string +) + +func init() { + flag.StringVar(&sink, "sink", "", "The sink url for the message destination.") + flag.StringVar(&data, "data", `{"hello": "world!"}`, "Cloudevent data body.") + flag.StringVar(&eventID, "event-id", "", "Event ID to use. Defaults to a generated UUID") + flag.StringVar(&eventType, "event-type", "knative.eventing.test.e2e", "The Event Type to use.") + flag.StringVar(&source, "source", "", "Source URI to use. Defaults to the current machine's hostname") + flag.StringVar(&periodStr, "period", "5", "The number of seconds between messages.") + flag.StringVar(&delayStr, "delay", "5", "The number of seconds to wait before sending messages.") + flag.StringVar(&maxMsgStr, "max-messages", "1", "The number of messages to attempt to send. 0 for unlimited.") + flag.StringVar(&encoding, "encoding", "binary", "The encoding of the cloud event, one of(binary, structured).") +} + +func parseDurationStr(durationStr string, defaultDuration int) time.Duration { + var duration time.Duration + if d, err := strconv.Atoi(durationStr); err != nil { + duration = time.Duration(defaultDuration) * time.Second + } else { + duration = time.Duration(d) * time.Second + } + return duration +} + +func main() { + flag.Parse() + period := parseDurationStr(periodStr, 5) + delay := parseDurationStr(delayStr, 5) + + maxMsg := 1 + if m, err := strconv.Atoi(maxMsgStr); err == nil { + maxMsg = m + } + + if delay > 0 { + log.Printf("will sleep for %s", delay) + time.Sleep(delay) + log.Printf("awake, contining") + } + + if eventID == "" { + eventID = uuid.New().String() + } + + if source == "" { + source = "localhost" + } + + var untyped map[string]interface{} + if err := json.Unmarshal([]byte(data), &untyped); err != nil { + fmt.Println("Currently sendevent only supports JSON event data") + os.Exit(1) + } + + sequence := 0 + + ticker := time.NewTicker(period) + for { + sequence++ + untyped["sequence"] = fmt.Sprintf("%d", sequence) + if err := postMessage(sink, untyped); err != nil { + fmt.Printf("postMessage returned an error: %v\n", err) + } + // Wait for next tick + <-ticker.C + // Only send a limited number of messages. + if maxMsg != 0 && maxMsg == sequence { + return + } + } +} + +// Creates a CloudEvent Context for a given heartbeat. +func cloudEventsContext() *cloudevents.EventContext { + return &cloudevents.EventContext{ + CloudEventsVersion: cloudevents.CloudEventsVersion, + EventType: eventType, + EventID: eventID, + Source: source, + EventTime: time.Now(), + } +} + +func postMessage(target string, data map[string]interface{}) error { + ctx := cloudEventsContext() + + log.Printf("posting to %q, sequence %q", target, data["sequence"]) + + var req *http.Request + var err error + switch encoding { + case "binary": + req, err = cloudevents.Binary.NewRequest(target, data, *ctx) + + case "structured": + req, err = cloudevents.Structured.NewRequest(target, data, *ctx) + default: + fmt.Printf("unsupported encoding option: %q\n", encoding) + os.Exit(1) + } + if err != nil { + log.Printf("failed to create http request: %s", err) + return err + } + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + log.Printf("failed to do POST: %v", err) + return err + } + defer resp.Body.Close() + log.Printf("response Status: %s", resp.Status) + body, _ := ioutil.ReadAll(resp.Body) + log.Printf("response Body: %s", string(body)) + return nil + +} diff --git a/test/upload-test-images.sh b/test/upload-test-images.sh index f9c2edb45bb..14e1f37724a 100755 --- a/test/upload-test-images.sh +++ b/test/upload-test-images.sh @@ -33,8 +33,10 @@ function upload_test_images() { done } -: ${DOCKER_REPO_OVERRIDE:?"You must set 'DOCKER_REPO_OVERRIDE', see DEVELOPMENT.md"} +if [ -z "$KO_DOCKER_REPO" ]; then + : ${DOCKER_REPO_OVERRIDE:?"You must set 'DOCKER_REPO_OVERRIDE', see DEVELOPMENT.md"} + export KO_DOCKER_REPO=${DOCKER_REPO_OVERRIDE} +fi -export KO_DOCKER_REPO=${DOCKER_REPO_OVERRIDE} -upload_test_images $@ \ No newline at end of file +upload_test_images $@ diff --git a/vendor/github.com/knative/eventing-sources/AUTHORS b/vendor/github.com/knative/eventing-sources/AUTHORS deleted file mode 100644 index 9a8f2f769f4..00000000000 --- a/vendor/github.com/knative/eventing-sources/AUTHORS +++ /dev/null @@ -1,6 +0,0 @@ -# This is the list of Knative authors for copyright purposes. -# -# This does not necessarily list everyone who has contributed code, since in -# some cases, their employer may be the copyright holder. To see the full list -# of contributors, see the revision history in source control. -Google LLC diff --git a/vendor/github.com/knative/eventing-sources/LICENSE b/vendor/github.com/knative/eventing-sources/LICENSE deleted file mode 100644 index 261eeb9e9f8..00000000000 --- a/vendor/github.com/knative/eventing-sources/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/containersource_types.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/containersource_types.go deleted file mode 100644 index a04e21e73fc..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/containersource_types.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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 v1alpha1 - -import ( - "github.com/knative/pkg/apis/duck" - duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// Important: Run "make" to regenerate code after modifying this file -// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. - -// Check that ContainerSource can be validated and can be defaulted. -var _ runtime.Object = (*ContainerSource)(nil) - -// Check that ContainerSource implements the Conditions duck type. -var _ = duck.VerifyType(&ContainerSource{}, &duckv1alpha1.Conditions{}) - -// ContainerSourceSpec defines the desired state of ContainerSource -type ContainerSourceSpec struct { - // Image is the image to run inside of the container. - // +kubebuilder:validation:MinLength=1 - Image string `json:"image,omitempty"` - - // Args are passed to the ContainerSpec as they are. - Args []string `json:"args,omitempty"` - - // Env is the list of environment variables to set in the container. - // Cannot be updated. - // +optional - // +patchMergeKey=name - // +patchStrategy=merge - Env []corev1.EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name"` - - // ServiceAccountName is the name of the ServiceAccount to use to run this - // source. - // +optional - ServiceAccountName string `json:"serviceAccountName,omitempty"` - - // Sink is a reference to an object that will resolve to a domain name to use as the sink. - // +optional - Sink *corev1.ObjectReference `json:"sink,omitempty"` -} - -const ( - // ContainerSourceConditionReady has status True when the ContainerSource is ready to send events. - ContainerConditionReady = duckv1alpha1.ConditionReady - - // ContainerConditionSinkProvided has status True when the ContainerSource has been configured with a sink target. - ContainerConditionSinkProvided duckv1alpha1.ConditionType = "SinkProvided" - - // ContainerConditionDeployed has status True when the ContainerSource has had it's deployment created. - ContainerConditionDeployed duckv1alpha1.ConditionType = "Deployed" -) - -var containerCondSet = duckv1alpha1.NewLivingConditionSet( - ContainerConditionSinkProvided, - ContainerConditionDeployed) - -// ContainerSourceStatus defines the observed state of ContainerSource -type ContainerSourceStatus struct { - // Conditions holds the state of a source at a point in time. - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - Conditions duckv1alpha1.Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` - - // SinkURI is the current active sink URI that has been configured for the ContainerSource. - // +optional - SinkURI string `json:"sinkUri,omitempty"` -} - -// GetCondition returns the condition currently associated with the given type, or nil. -func (s *ContainerSourceStatus) GetCondition(t duckv1alpha1.ConditionType) *duckv1alpha1.Condition { - return containerCondSet.Manage(s).GetCondition(t) -} - -// IsReady returns true if the resource is ready overall. -func (s *ContainerSourceStatus) IsReady() bool { - return containerCondSet.Manage(s).IsHappy() -} - -// InitializeConditions sets relevant unset conditions to Unknown state. -func (s *ContainerSourceStatus) InitializeConditions() { - containerCondSet.Manage(s).InitializeConditions() -} - -// MarSink sets the condition that the source has a sink configured. -func (s *ContainerSourceStatus) MarkSink(uri string) { - s.SinkURI = uri - if len(uri) > 0 { - containerCondSet.Manage(s).MarkTrue(ContainerConditionSinkProvided) - } else { - containerCondSet.Manage(s).MarkUnknown(ContainerConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.%s", "") - } -} - -// MarkNoSink sets the condition that the source does not have a sink configured. -func (s *ContainerSourceStatus) MarkNoSink(reason, messageFormat string, messageA ...interface{}) { - containerCondSet.Manage(s).MarkFalse(ContainerConditionSinkProvided, reason, messageFormat, messageA...) -} - -// MarkDeployed sets the condition that the source has been deployed. -func (s *ContainerSourceStatus) MarkDeployed() { - containerCondSet.Manage(s).MarkTrue(ContainerConditionDeployed) -} - -// MarkDeploying sets the condition that the source is deploying. -func (s *ContainerSourceStatus) MarkDeploying(reason, messageFormat string, messageA ...interface{}) { - containerCondSet.Manage(s).MarkUnknown(ContainerConditionDeployed, reason, messageFormat, messageA...) -} - -// MarkNotDeployed sets the condition that the source has not been deployed. -func (s *ContainerSourceStatus) MarkNotDeployed(reason, messageFormat string, messageA ...interface{}) { - containerCondSet.Manage(s).MarkFalse(ContainerConditionDeployed, reason, messageFormat, messageA...) -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ContainerSource is the Schema for the containersources API -// +k8s:openapi-gen=true -// +kubebuilder:categories=all,knative,eventing,sources -type ContainerSource struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ContainerSourceSpec `json:"spec,omitempty"` - Status ContainerSourceStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ContainerSourceList contains a list of ContainerSource -type ContainerSourceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ContainerSource `json:"items"` -} - -func init() { - SchemeBuilder.Register(&ContainerSource{}, &ContainerSourceList{}) -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/doc.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/doc.go deleted file mode 100644 index 258a98c9176..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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 v1alpha1 contains API Schema definitions for the sources v1alpha1 API group -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/knative/eventing-sources/pkg/apis/sources -// +k8s:defaulter-gen=TypeMeta -// +groupName=sources.eventing.knative.dev -package v1alpha1 diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_types.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_types.go deleted file mode 100644 index 1a641bd961b..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_types.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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 v1alpha1 - -import ( - "github.com/knative/pkg/apis" - "github.com/knative/pkg/apis/duck" - duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GcpPubSubSource is the Schema for the gcppubsubsources API. -// +k8s:openapi-gen=true -// +kubebuilder:categories=all,knative,eventing,sources -type GcpPubSubSource struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec GcpPubSubSourceSpec `json:"spec,omitempty"` - Status GcpPubSubSourceStatus `json:"status,omitempty"` -} - -// Check that GcpPubSubSource can be validated and can be defaulted. -var _ runtime.Object = (*GcpPubSubSource)(nil) - -// Check that GcpPubSubSource will be checked for immutable fields. -var _ apis.Immutable = (*GcpPubSubSource)(nil) - -// Check that GcpPubSubSource implements the Conditions duck type. -var _ = duck.VerifyType(&GcpPubSubSource{}, &duckv1alpha1.Conditions{}) - -// GcpPubSubSourceSpec defines the desired state of the GcpPubSubSource. -type GcpPubSubSourceSpec struct { - // GcpCredsSecret is the credential to use to poll the GCP PubSub Subscription. It is not used - // to create or delete the Subscription, only to poll it. The value of the secret entry must be - // a service account key in the JSON format (see - // https://cloud.google.com/iam/docs/creating-managing-service-account-keys). - GcpCredsSecret corev1.SecretKeySelector `json:"gcpCredsSecret,omitempty"` - - // GoogleCloudProject is the ID of the Google Cloud Project that the PubSub Topic exists in. - GoogleCloudProject string `json:"googleCloudProject,omitempty"` - - // Topic is the ID of the GCP PubSub Topic to Subscribe to. It must be in the form of the - // unique identifier within the project, not the entire name. E.g. it must be 'laconia', not - // 'projects/my-gcp-project/topics/laconia'. - Topic string `json:"topic,omitempty"` - - // Sink is a reference to an object that will resolve to a domain name to use as the sink. - // +optional - Sink *corev1.ObjectReference `json:"sink,omitempty"` - - // ServiceAccoutName is the name of the ServiceAccount that will be used to run the Receive - // Adapter Deployment. - ServiceAccountName string `json:"serviceAccountName,omitempty"` -} - -const ( - // GcpPubSubConditionReady has status True when the GcpPubSubSource is ready to send events. - GcpPubSubConditionReady = duckv1alpha1.ConditionReady - - // GcpPubSubConditionSinkProvided has status True when the GcpPubSubSource has been configured with a sink target. - GcpPubSubConditionSinkProvided duckv1alpha1.ConditionType = "SinkProvided" - - // GcpPubSubConditionDeployed has status True when the GcpPubSubSource has had it's receive adapter deployment created. - GcpPubSubConditionDeployed duckv1alpha1.ConditionType = "Deployed" - - // GcpPubSubConditionSubscribed has status True when a GCP PubSub Subscription has been created pointing at the created receive adapter deployment. - GcpPubSubConditionSubscribed duckv1alpha1.ConditionType = "Subscribed" -) - -var gcpPubSubSourceCondSet = duckv1alpha1.NewLivingConditionSet( - GcpPubSubConditionSinkProvided, - GcpPubSubConditionDeployed, - GcpPubSubConditionSubscribed) - -// GcpPubSubSourceStatus defines the observed state of GcpPubSubSource. -type GcpPubSubSourceStatus struct { - // Conditions holds the state of a source at a point in time. - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - Conditions duckv1alpha1.Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` - - // SinkURI is the current active sink URI that has been configured for the GcpPubSubSource. - // +optional - SinkURI string `json:"sinkUri,omitempty"` -} - -// GetCondition returns the condition currently associated with the given type, or nil. -func (s *GcpPubSubSourceStatus) GetCondition(t duckv1alpha1.ConditionType) *duckv1alpha1.Condition { - return gcpPubSubSourceCondSet.Manage(s).GetCondition(t) -} - -// IsReady returns true if the resource is ready overall. -func (s *GcpPubSubSourceStatus) IsReady() bool { - return gcpPubSubSourceCondSet.Manage(s).IsHappy() -} - -// InitializeConditions sets relevant unset conditions to Unknown state. -func (s *GcpPubSubSourceStatus) InitializeConditions() { - gcpPubSubSourceCondSet.Manage(s).InitializeConditions() -} - -// MarkSink sets the condition that the source has a sink configured. -func (s *GcpPubSubSourceStatus) MarkSink(uri string) { - s.SinkURI = uri - if len(uri) > 0 { - gcpPubSubSourceCondSet.Manage(s).MarkTrue(GcpPubSubConditionSinkProvided) - } else { - gcpPubSubSourceCondSet.Manage(s).MarkUnknown(GcpPubSubConditionSinkProvided, "SinkEmpty", "Sink has resolved to empty.%s", "") - } -} - -// MarkNoSink sets the condition that the source does not have a sink configured. -func (s *GcpPubSubSourceStatus) MarkNoSink(reason, messageFormat string, messageA ...interface{}) { - gcpPubSubSourceCondSet.Manage(s).MarkFalse(GcpPubSubConditionSinkProvided, reason, messageFormat, messageA...) -} - -// MarkDeployed sets the condition that the source has been deployed. -func (s *GcpPubSubSourceStatus) MarkDeployed() { - gcpPubSubSourceCondSet.Manage(s).MarkTrue(GcpPubSubConditionDeployed) -} - -// MarkDeploying sets the condition that the source is deploying. -func (s *GcpPubSubSourceStatus) MarkDeploying(reason, messageFormat string, messageA ...interface{}) { - gcpPubSubSourceCondSet.Manage(s).MarkUnknown(GcpPubSubConditionDeployed, reason, messageFormat, messageA...) -} - -// MarkNotDeployed sets the condition that the source has not been deployed. -func (s *GcpPubSubSourceStatus) MarkNotDeployed(reason, messageFormat string, messageA ...interface{}) { - gcpPubSubSourceCondSet.Manage(s).MarkFalse(GcpPubSubConditionDeployed, reason, messageFormat, messageA...) -} - -func (s *GcpPubSubSourceStatus) MarkSubscribed() { - gcpPubSubSourceCondSet.Manage(s).MarkTrue(GcpPubSubConditionSubscribed) -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// GcpPubSubSourceList contains a list of GcpPubSubSources. -type GcpPubSubSourceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []GcpPubSubSource `json:"items"` -} - -func init() { - SchemeBuilder.Register(&GcpPubSubSource{}, &GcpPubSubSourceList{}) -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_validation.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_validation.go deleted file mode 100644 index fc563c8bc82..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/gcp_pubsub_validation.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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 v1alpha1 - -import ( - "github.com/google/go-cmp/cmp" - "github.com/knative/pkg/apis" -) - -func (current *GcpPubSubSource) CheckImmutableFields(og apis.Immutable) *apis.FieldError { - original, ok := og.(*GcpPubSubSource) - if !ok { - return &apis.FieldError{Message: "The provided original was not a GcpPubSubSource"} - } - if original == nil { - return nil - } - - // All of the fields are immutable because the controller doesn't understand when it would need - // to delete and create a new Receive Adapter with updated arguments. We could relax it slightly - // to allow a nil Sink -> non-nil Sink, but I don't think it is needed yet. - if diff := cmp.Diff(original.Spec, current.Spec); diff != "" { - return &apis.FieldError{ - Message: "Immutable fields changed (-old +new)", - Paths: []string{"spec"}, - Details: diff, - } - } - return nil -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/kuberneteseventsource_types.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/kuberneteseventsource_types.go deleted file mode 100644 index f4281723397..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/kuberneteseventsource_types.go +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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 v1alpha1 - -import ( - "github.com/knative/pkg/apis/duck" - duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" -) - -// Check that KubernetesEventSource can be validated and can be defaulted. -var _ runtime.Object = (*KubernetesEventSource)(nil) - -// Check that KubernetesEventSource implements the Conditions duck type. -var _ = duck.VerifyType(&KubernetesEventSource{}, &duckv1alpha1.Conditions{}) - -// KubernetesEventSourceSpec defines the desired state of the source. -type KubernetesEventSourceSpec struct { - // Namespace that we watch kubernetes events in. - Namespace string `json:"namespace"` - - // ServiceAccountName is the name of the ServiceAccount to use to run this - // source. - // +optional - ServiceAccountName string `json:"serviceAccountName,omitempty"` - - // Sink is a reference to an object that will resolve to a domain name to use - // as the sink. - // +optional - Sink *corev1.ObjectReference `json:"sink,omitempty"` -} - -const ( - // KubernetesEventSourceConditionReady has status True when the - // source is ready to send events. - KubernetesEventSourceConditionReady = duckv1alpha1.ConditionReady -) - -var kubernetesEventSourceCondSet = duckv1alpha1.NewLivingConditionSet() - -// KubernetesEventSourceStatus defines the observed state of the source. -type KubernetesEventSourceStatus struct { - // Conditions holds the state of a source at a point in time. - // +optional - // +patchMergeKey=type - // +patchStrategy=merge - Conditions duckv1alpha1.Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` - - // SinkURI is the current active sink URI that has been configured for the source. - // +optional - SinkURI string `json:"sinkUri,omitempty"` -} - -// GetCondition returns the condition currently associated with the given type, or nil. -func (s *KubernetesEventSourceStatus) GetCondition(t duckv1alpha1.ConditionType) *duckv1alpha1.Condition { - return kubernetesEventSourceCondSet.Manage(s).GetCondition(t) -} - -// IsReady returns true if the resource is ready overall. -func (s *KubernetesEventSourceStatus) IsReady() bool { - return kubernetesEventSourceCondSet.Manage(s).IsHappy() -} - -// InitializeConditions sets relevant unset conditions to Unknown state. -func (s *KubernetesEventSourceStatus) InitializeConditions() { - kubernetesEventSourceCondSet.Manage(s).InitializeConditions() -} - -// MarkReady sets the condition that the ContainerSource owned by -// the source has Ready status True. -func (s *KubernetesEventSourceStatus) MarkReady() { - kubernetesEventSourceCondSet.Manage(s).MarkTrue(KubernetesEventSourceConditionReady) -} - -// MarkUnready sets the condition that the ContainerSource owned by -// the source does not have Ready status True. -func (s *KubernetesEventSourceStatus) MarkUnready(reason, messageFormat string, messageA ...interface{}) { - kubernetesEventSourceCondSet.Manage(s).MarkFalse(KubernetesEventSourceConditionReady, reason, messageFormat, messageA...) -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// KubernetesEventSource is the Schema for the kuberneteseventsources API -// +k8s:openapi-gen=true -type KubernetesEventSource struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec KubernetesEventSourceSpec `json:"spec,omitempty"` - Status KubernetesEventSourceStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// KubernetesEventSourceList contains a list of KubernetesEventSource -type KubernetesEventSourceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []KubernetesEventSource `json:"items"` -} - -func init() { - SchemeBuilder.Register(&KubernetesEventSource{}, &KubernetesEventSourceList{}) -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/register.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/register.go deleted file mode 100644 index fa5f80118ce..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/register.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// NOTE: Boilerplate only. Ignore this file. - -// Package v1alpha1 contains API Schema definitions for the sources v1alpha1 API group -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/knative/eventing-sources/pkg/apis/sources -// +k8s:defaulter-gen=TypeMeta -// +groupName=sources.eventing.knative.dev -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" -) - -var ( - // SchemeGroupVersion is group version used to register these objects - SchemeGroupVersion = schema.GroupVersion{Group: "sources.eventing.knative.dev", Version: "v1alpha1"} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} - - AddToScheme = SchemeBuilder.AddToScheme -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index d6feb2f7022..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,355 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - duckv1alpha1 "github.com/knative/pkg/apis/duck/v1alpha1" - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerSource) DeepCopyInto(out *ContainerSource) { - *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 ContainerSource. -func (in *ContainerSource) DeepCopy() *ContainerSource { - if in == nil { - return nil - } - out := new(ContainerSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ContainerSource) 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 *ContainerSourceList) DeepCopyInto(out *ContainerSourceList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ContainerSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSourceList. -func (in *ContainerSourceList) DeepCopy() *ContainerSourceList { - if in == nil { - return nil - } - out := new(ContainerSourceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ContainerSourceList) 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 *ContainerSourceSpec) DeepCopyInto(out *ContainerSourceSpec) { - *out = *in - if in.Args != nil { - in, out := &in.Args, &out.Args - *out = make([]string, len(*in)) - copy(*out, *in) - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Sink != nil { - in, out := &in.Sink, &out.Sink - *out = new(v1.ObjectReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSourceSpec. -func (in *ContainerSourceSpec) DeepCopy() *ContainerSourceSpec { - if in == nil { - return nil - } - out := new(ContainerSourceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerSourceStatus) DeepCopyInto(out *ContainerSourceStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(duckv1alpha1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSourceStatus. -func (in *ContainerSourceStatus) DeepCopy() *ContainerSourceStatus { - if in == nil { - return nil - } - out := new(ContainerSourceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GcpPubSubSource) DeepCopyInto(out *GcpPubSubSource) { - *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 GcpPubSubSource. -func (in *GcpPubSubSource) DeepCopy() *GcpPubSubSource { - if in == nil { - return nil - } - out := new(GcpPubSubSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GcpPubSubSource) 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 *GcpPubSubSourceList) DeepCopyInto(out *GcpPubSubSourceList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]GcpPubSubSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GcpPubSubSourceList. -func (in *GcpPubSubSourceList) DeepCopy() *GcpPubSubSourceList { - if in == nil { - return nil - } - out := new(GcpPubSubSourceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *GcpPubSubSourceList) 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 *GcpPubSubSourceSpec) DeepCopyInto(out *GcpPubSubSourceSpec) { - *out = *in - in.GcpCredsSecret.DeepCopyInto(&out.GcpCredsSecret) - if in.Sink != nil { - in, out := &in.Sink, &out.Sink - *out = new(v1.ObjectReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GcpPubSubSourceSpec. -func (in *GcpPubSubSourceSpec) DeepCopy() *GcpPubSubSourceSpec { - if in == nil { - return nil - } - out := new(GcpPubSubSourceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GcpPubSubSourceStatus) DeepCopyInto(out *GcpPubSubSourceStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(duckv1alpha1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GcpPubSubSourceStatus. -func (in *GcpPubSubSourceStatus) DeepCopy() *GcpPubSubSourceStatus { - if in == nil { - return nil - } - out := new(GcpPubSubSourceStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubernetesEventSource) DeepCopyInto(out *KubernetesEventSource) { - *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 KubernetesEventSource. -func (in *KubernetesEventSource) DeepCopy() *KubernetesEventSource { - if in == nil { - return nil - } - out := new(KubernetesEventSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KubernetesEventSource) 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 *KubernetesEventSourceList) DeepCopyInto(out *KubernetesEventSourceList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]KubernetesEventSource, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesEventSourceList. -func (in *KubernetesEventSourceList) DeepCopy() *KubernetesEventSourceList { - if in == nil { - return nil - } - out := new(KubernetesEventSourceList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KubernetesEventSourceList) 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 *KubernetesEventSourceSpec) DeepCopyInto(out *KubernetesEventSourceSpec) { - *out = *in - if in.Sink != nil { - in, out := &in.Sink, &out.Sink - *out = new(v1.ObjectReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesEventSourceSpec. -func (in *KubernetesEventSourceSpec) DeepCopy() *KubernetesEventSourceSpec { - if in == nil { - return nil - } - out := new(KubernetesEventSourceSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KubernetesEventSourceStatus) DeepCopyInto(out *KubernetesEventSourceStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make(duckv1alpha1.Conditions, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesEventSourceStatus. -func (in *KubernetesEventSourceStatus) DeepCopy() *KubernetesEventSourceStatus { - if in == nil { - return nil - } - out := new(KubernetesEventSourceStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/clientset.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/clientset.go deleted file mode 100644 index b87bad6733d..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,98 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package versioned - -import ( - sourcesv1alpha1 "github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface - // Deprecated: please explicitly pick a version if possible. - Sources() sourcesv1alpha1.SourcesV1alpha1Interface -} - -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. -type Clientset struct { - *discovery.DiscoveryClient - sourcesV1alpha1 *sourcesv1alpha1.SourcesV1alpha1Client -} - -// SourcesV1alpha1 retrieves the SourcesV1alpha1Client -func (c *Clientset) SourcesV1alpha1() sourcesv1alpha1.SourcesV1alpha1Interface { - return c.sourcesV1alpha1 -} - -// Deprecated: Sources retrieves the default version of SourcesClient. -// Please explicitly pick a version. -func (c *Clientset) Sources() sourcesv1alpha1.SourcesV1alpha1Interface { - return c.sourcesV1alpha1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - var cs Clientset - var err error - cs.sourcesV1alpha1, err = sourcesv1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - var cs Clientset - cs.sourcesV1alpha1 = sourcesv1alpha1.NewForConfigOrDie(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) - return &cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.sourcesV1alpha1 = sourcesv1alpha1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/doc.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 3fe4685848a..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/doc.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index 60ea8ba90eb..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/register.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/register.go deleted file mode 100644 index 41e5040d2f7..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package scheme - -import ( - sourcesv1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - AddToScheme(Scheme) -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -func AddToScheme(scheme *runtime.Scheme) { - sourcesv1alpha1.AddToScheme(scheme) -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go deleted file mode 100644 index 7bb99182b62..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/containersource.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" - scheme "github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ContainerSourcesGetter has a method to return a ContainerSourceInterface. -// A group's client should implement this interface. -type ContainerSourcesGetter interface { - ContainerSources(namespace string) ContainerSourceInterface -} - -// ContainerSourceInterface has methods to work with ContainerSource resources. -type ContainerSourceInterface interface { - Create(*v1alpha1.ContainerSource) (*v1alpha1.ContainerSource, error) - Update(*v1alpha1.ContainerSource) (*v1alpha1.ContainerSource, error) - UpdateStatus(*v1alpha1.ContainerSource) (*v1alpha1.ContainerSource, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.ContainerSource, error) - List(opts v1.ListOptions) (*v1alpha1.ContainerSourceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ContainerSource, err error) - ContainerSourceExpansion -} - -// containerSources implements ContainerSourceInterface -type containerSources struct { - client rest.Interface - ns string -} - -// newContainerSources returns a ContainerSources -func newContainerSources(c *SourcesV1alpha1Client, namespace string) *containerSources { - return &containerSources{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the containerSource, and returns the corresponding containerSource object, and an error if there is any. -func (c *containerSources) Get(name string, options v1.GetOptions) (result *v1alpha1.ContainerSource, err error) { - result = &v1alpha1.ContainerSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("containersources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of ContainerSources that match those selectors. -func (c *containerSources) List(opts v1.ListOptions) (result *v1alpha1.ContainerSourceList, err error) { - result = &v1alpha1.ContainerSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("containersources"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested containerSources. -func (c *containerSources) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("containersources"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a containerSource and creates it. Returns the server's representation of the containerSource, and an error, if there is any. -func (c *containerSources) Create(containerSource *v1alpha1.ContainerSource) (result *v1alpha1.ContainerSource, err error) { - result = &v1alpha1.ContainerSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("containersources"). - Body(containerSource). - Do(). - Into(result) - return -} - -// Update takes the representation of a containerSource and updates it. Returns the server's representation of the containerSource, and an error, if there is any. -func (c *containerSources) Update(containerSource *v1alpha1.ContainerSource) (result *v1alpha1.ContainerSource, err error) { - result = &v1alpha1.ContainerSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("containersources"). - Name(containerSource.Name). - Body(containerSource). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *containerSources) UpdateStatus(containerSource *v1alpha1.ContainerSource) (result *v1alpha1.ContainerSource, err error) { - result = &v1alpha1.ContainerSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("containersources"). - Name(containerSource.Name). - SubResource("status"). - Body(containerSource). - Do(). - Into(result) - return -} - -// Delete takes name of the containerSource and deletes it. Returns an error if one occurs. -func (c *containerSources) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("containersources"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *containerSources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("containersources"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched containerSource. -func (c *containerSources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.ContainerSource, err error) { - result = &v1alpha1.ContainerSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("containersources"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go deleted file mode 100644 index 75445c17900..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1alpha1 diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/gcppubsubsource.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/gcppubsubsource.go deleted file mode 100644 index af8d095207e..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/gcppubsubsource.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" - scheme "github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// GcpPubSubSourcesGetter has a method to return a GcpPubSubSourceInterface. -// A group's client should implement this interface. -type GcpPubSubSourcesGetter interface { - GcpPubSubSources(namespace string) GcpPubSubSourceInterface -} - -// GcpPubSubSourceInterface has methods to work with GcpPubSubSource resources. -type GcpPubSubSourceInterface interface { - Create(*v1alpha1.GcpPubSubSource) (*v1alpha1.GcpPubSubSource, error) - Update(*v1alpha1.GcpPubSubSource) (*v1alpha1.GcpPubSubSource, error) - UpdateStatus(*v1alpha1.GcpPubSubSource) (*v1alpha1.GcpPubSubSource, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.GcpPubSubSource, error) - List(opts v1.ListOptions) (*v1alpha1.GcpPubSubSourceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GcpPubSubSource, err error) - GcpPubSubSourceExpansion -} - -// gcpPubSubSources implements GcpPubSubSourceInterface -type gcpPubSubSources struct { - client rest.Interface - ns string -} - -// newGcpPubSubSources returns a GcpPubSubSources -func newGcpPubSubSources(c *SourcesV1alpha1Client, namespace string) *gcpPubSubSources { - return &gcpPubSubSources{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the gcpPubSubSource, and returns the corresponding gcpPubSubSource object, and an error if there is any. -func (c *gcpPubSubSources) Get(name string, options v1.GetOptions) (result *v1alpha1.GcpPubSubSource, err error) { - result = &v1alpha1.GcpPubSubSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gcppubsubsources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of GcpPubSubSources that match those selectors. -func (c *gcpPubSubSources) List(opts v1.ListOptions) (result *v1alpha1.GcpPubSubSourceList, err error) { - result = &v1alpha1.GcpPubSubSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("gcppubsubsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested gcpPubSubSources. -func (c *gcpPubSubSources) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("gcppubsubsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a gcpPubSubSource and creates it. Returns the server's representation of the gcpPubSubSource, and an error, if there is any. -func (c *gcpPubSubSources) Create(gcpPubSubSource *v1alpha1.GcpPubSubSource) (result *v1alpha1.GcpPubSubSource, err error) { - result = &v1alpha1.GcpPubSubSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("gcppubsubsources"). - Body(gcpPubSubSource). - Do(). - Into(result) - return -} - -// Update takes the representation of a gcpPubSubSource and updates it. Returns the server's representation of the gcpPubSubSource, and an error, if there is any. -func (c *gcpPubSubSources) Update(gcpPubSubSource *v1alpha1.GcpPubSubSource) (result *v1alpha1.GcpPubSubSource, err error) { - result = &v1alpha1.GcpPubSubSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("gcppubsubsources"). - Name(gcpPubSubSource.Name). - Body(gcpPubSubSource). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *gcpPubSubSources) UpdateStatus(gcpPubSubSource *v1alpha1.GcpPubSubSource) (result *v1alpha1.GcpPubSubSource, err error) { - result = &v1alpha1.GcpPubSubSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("gcppubsubsources"). - Name(gcpPubSubSource.Name). - SubResource("status"). - Body(gcpPubSubSource). - Do(). - Into(result) - return -} - -// Delete takes name of the gcpPubSubSource and deletes it. Returns an error if one occurs. -func (c *gcpPubSubSources) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("gcppubsubsources"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *gcpPubSubSources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("gcppubsubsources"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched gcpPubSubSource. -func (c *gcpPubSubSources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.GcpPubSubSource, err error) { - result = &v1alpha1.GcpPubSubSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("gcppubsubsources"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go deleted file mode 100644 index eeb3f0886d9..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -type ContainerSourceExpansion interface{} - -type GcpPubSubSourceExpansion interface{} - -type KubernetesEventSourceExpansion interface{} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/kuberneteseventsource.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/kuberneteseventsource.go deleted file mode 100644 index 75743b2e0dd..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/kuberneteseventsource.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" - scheme "github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// KubernetesEventSourcesGetter has a method to return a KubernetesEventSourceInterface. -// A group's client should implement this interface. -type KubernetesEventSourcesGetter interface { - KubernetesEventSources(namespace string) KubernetesEventSourceInterface -} - -// KubernetesEventSourceInterface has methods to work with KubernetesEventSource resources. -type KubernetesEventSourceInterface interface { - Create(*v1alpha1.KubernetesEventSource) (*v1alpha1.KubernetesEventSource, error) - Update(*v1alpha1.KubernetesEventSource) (*v1alpha1.KubernetesEventSource, error) - UpdateStatus(*v1alpha1.KubernetesEventSource) (*v1alpha1.KubernetesEventSource, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha1.KubernetesEventSource, error) - List(opts v1.ListOptions) (*v1alpha1.KubernetesEventSourceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.KubernetesEventSource, err error) - KubernetesEventSourceExpansion -} - -// kubernetesEventSources implements KubernetesEventSourceInterface -type kubernetesEventSources struct { - client rest.Interface - ns string -} - -// newKubernetesEventSources returns a KubernetesEventSources -func newKubernetesEventSources(c *SourcesV1alpha1Client, namespace string) *kubernetesEventSources { - return &kubernetesEventSources{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the kubernetesEventSource, and returns the corresponding kubernetesEventSource object, and an error if there is any. -func (c *kubernetesEventSources) Get(name string, options v1.GetOptions) (result *v1alpha1.KubernetesEventSource, err error) { - result = &v1alpha1.KubernetesEventSource{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of KubernetesEventSources that match those selectors. -func (c *kubernetesEventSources) List(opts v1.ListOptions) (result *v1alpha1.KubernetesEventSourceList, err error) { - result = &v1alpha1.KubernetesEventSourceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested kubernetesEventSources. -func (c *kubernetesEventSources) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a kubernetesEventSource and creates it. Returns the server's representation of the kubernetesEventSource, and an error, if there is any. -func (c *kubernetesEventSources) Create(kubernetesEventSource *v1alpha1.KubernetesEventSource) (result *v1alpha1.KubernetesEventSource, err error) { - result = &v1alpha1.KubernetesEventSource{} - err = c.client.Post(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - Body(kubernetesEventSource). - Do(). - Into(result) - return -} - -// Update takes the representation of a kubernetesEventSource and updates it. Returns the server's representation of the kubernetesEventSource, and an error, if there is any. -func (c *kubernetesEventSources) Update(kubernetesEventSource *v1alpha1.KubernetesEventSource) (result *v1alpha1.KubernetesEventSource, err error) { - result = &v1alpha1.KubernetesEventSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - Name(kubernetesEventSource.Name). - Body(kubernetesEventSource). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *kubernetesEventSources) UpdateStatus(kubernetesEventSource *v1alpha1.KubernetesEventSource) (result *v1alpha1.KubernetesEventSource, err error) { - result = &v1alpha1.KubernetesEventSource{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - Name(kubernetesEventSource.Name). - SubResource("status"). - Body(kubernetesEventSource). - Do(). - Into(result) - return -} - -// Delete takes name of the kubernetesEventSource and deletes it. Returns an error if one occurs. -func (c *kubernetesEventSources) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *kubernetesEventSources) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kuberneteseventsources"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched kubernetesEventSource. -func (c *kubernetesEventSources) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.KubernetesEventSource, err error) { - result = &v1alpha1.KubernetesEventSource{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("kuberneteseventsources"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go b/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go deleted file mode 100644 index 94601cf0321..00000000000 --- a/vendor/github.com/knative/eventing-sources/pkg/client/clientset/versioned/typed/sources/v1alpha1/sources_client.go +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/knative/eventing-sources/pkg/apis/sources/v1alpha1" - "github.com/knative/eventing-sources/pkg/client/clientset/versioned/scheme" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - rest "k8s.io/client-go/rest" -) - -type SourcesV1alpha1Interface interface { - RESTClient() rest.Interface - ContainerSourcesGetter - GcpPubSubSourcesGetter - KubernetesEventSourcesGetter -} - -// SourcesV1alpha1Client is used to interact with features provided by the sources.eventing.knative.dev group. -type SourcesV1alpha1Client struct { - restClient rest.Interface -} - -func (c *SourcesV1alpha1Client) ContainerSources(namespace string) ContainerSourceInterface { - return newContainerSources(c, namespace) -} - -func (c *SourcesV1alpha1Client) GcpPubSubSources(namespace string) GcpPubSubSourceInterface { - return newGcpPubSubSources(c, namespace) -} - -func (c *SourcesV1alpha1Client) KubernetesEventSources(namespace string) KubernetesEventSourceInterface { - return newKubernetesEventSources(c, namespace) -} - -// NewForConfig creates a new SourcesV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*SourcesV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &SourcesV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new SourcesV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SourcesV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new SourcesV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *SourcesV1alpha1Client { - return &SourcesV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} - - if config.UserAgent == "" { - config.UserAgent = rest.DefaultKubernetesUserAgent() - } - - return nil -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *SourcesV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme/scheme.go b/vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme/scheme.go deleted file mode 100644 index 79868214e34..00000000000 --- a/vendor/sigs.k8s.io/controller-runtime/pkg/runtime/scheme/scheme.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed 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 scheme - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// Builder builds a new Scheme for mapping go types to Kubernetes GroupVersionKinds. -type Builder struct { - GroupVersion schema.GroupVersion - runtime.SchemeBuilder -} - -// Register adds one or objects to the SchemeBuilder so they can be added to a Scheme. Register mutates bld. -func (bld *Builder) Register(object ...runtime.Object) *Builder { - bld.SchemeBuilder.Register(func(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(bld.GroupVersion, object...) - metav1.AddToGroupVersion(scheme, bld.GroupVersion) - return nil - }) - return bld -} - -// RegisterAll registers all types from the Builder argument. RegisterAll mutates bld. -func (bld *Builder) RegisterAll(b *Builder) *Builder { - bld.SchemeBuilder = append(bld.SchemeBuilder, b.SchemeBuilder...) - return bld -} - -// AddToScheme adds all registered types to s. -func (bld *Builder) AddToScheme(s *runtime.Scheme) error { - return bld.SchemeBuilder.AddToScheme(s) -} - -// Build returns a new Scheme containing the registered types. -func (bld *Builder) Build() (*runtime.Scheme, error) { - s := runtime.NewScheme() - return s, bld.AddToScheme(s) -}