From 67b4c15e6cfd4d56964ca64ae5158d5ccd2d9a13 Mon Sep 17 00:00:00 2001 From: Lu Dang Date: Thu, 22 Oct 2020 14:45:35 -0400 Subject: [PATCH] Remove v1alpha1 Channel --- cmd/webhook/main.go | 16 +- .../core/configmaps/br-default-channel.yaml | 2 +- config/core/resources/channel.yaml | 3 +- hack/update-codegen.sh | 4 +- .../messaging/v1alpha1/channel_conversion.go | 87 ----- .../v1alpha1/channel_conversion_test.go | 160 --------- .../messaging/v1alpha1/channel_defaults.go | 67 ---- .../v1alpha1/channel_defaults_test.go | 55 ---- .../messaging/v1alpha1/channel_lifecycle.go | 103 ------ .../v1alpha1/channel_lifecycle_test.go | 303 ------------------ pkg/apis/messaging/v1alpha1/channel_types.go | 154 --------- .../messaging/v1alpha1/channel_types_test.go | 96 ------ .../messaging/v1alpha1/channel_validation.go | 84 ----- .../v1alpha1/channel_validation_test.go | 301 ----------------- pkg/apis/messaging/v1alpha1/doc.go | 23 -- pkg/apis/messaging/v1alpha1/register.go | 53 --- pkg/apis/messaging/v1alpha1/register_test.go | 69 ---- .../v1alpha1/zz_generated.deepcopy.go | 134 -------- pkg/client/clientset/versioned/clientset.go | 30 +- .../versioned/fake/clientset_generated.go | 7 - .../clientset/versioned/fake/register.go | 2 - .../clientset/versioned/scheme/register.go | 2 - .../typed/messaging/v1alpha1/channel.go | 195 ----------- .../versioned/typed/messaging/v1alpha1/doc.go | 20 -- .../typed/messaging/v1alpha1/fake/doc.go | 20 -- .../messaging/v1alpha1/fake/fake_channel.go | 142 -------- .../v1alpha1/fake/fake_messaging_client.go | 40 --- .../messaging/v1alpha1/generated_expansion.go | 21 -- .../messaging/v1alpha1/messaging_client.go | 89 ----- .../informers/externalversions/generic.go | 5 - .../externalversions/messaging/interface.go | 8 - .../messaging/v1alpha1/channel.go | 90 ------ .../messaging/v1alpha1/interface.go | 45 --- .../messaging/v1alpha1/channel/channel.go | 52 --- .../messaging/v1alpha1/channel/fake/fake.go | 40 --- .../listers/messaging/v1alpha1/channel.go | 94 ------ .../messaging/v1alpha1/expansion_generated.go | 27 -- test/conformance/main_test.go | 8 - test/e2e-conformance-tests.sh | 2 +- test/e2e-tests.sh | 2 +- test/e2e/main_test.go | 8 - test/lib/resources/constants.go | 1 - test/lib/typemetas.go | 2 +- 43 files changed, 16 insertions(+), 2650 deletions(-) delete mode 100644 pkg/apis/messaging/v1alpha1/channel_conversion.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_conversion_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_defaults.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_defaults_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_lifecycle.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_lifecycle_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_types.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_types_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_validation.go delete mode 100644 pkg/apis/messaging/v1alpha1/channel_validation_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/doc.go delete mode 100644 pkg/apis/messaging/v1alpha1/register.go delete mode 100644 pkg/apis/messaging/v1alpha1/register_test.go delete mode 100644 pkg/apis/messaging/v1alpha1/zz_generated.deepcopy.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/channel.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/doc.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_channel.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_messaging_client.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/generated_expansion.go delete mode 100644 pkg/client/clientset/versioned/typed/messaging/v1alpha1/messaging_client.go delete mode 100644 pkg/client/informers/externalversions/messaging/v1alpha1/channel.go delete mode 100644 pkg/client/informers/externalversions/messaging/v1alpha1/interface.go delete mode 100644 pkg/client/injection/informers/messaging/v1alpha1/channel/channel.go delete mode 100644 pkg/client/injection/informers/messaging/v1alpha1/channel/fake/fake.go delete mode 100644 pkg/client/listers/messaging/v1alpha1/channel.go delete mode 100644 pkg/client/listers/messaging/v1alpha1/expansion_generated.go diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 2c3587a8b7..adc3205402 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -32,8 +32,6 @@ import ( inteventsv1 "github.com/google/knative-gcp/pkg/apis/intevents/v1" inteventsv1alpha1 "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" inteventsv1beta1 "github.com/google/knative-gcp/pkg/apis/intevents/v1beta1" - "github.com/google/knative-gcp/pkg/apis/messaging" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" messagingv1beta1 "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" "k8s.io/apimachinery/pkg/runtime/schema" "knative.dev/eventing/pkg/logconfig" @@ -59,8 +57,7 @@ var types = map[schema.GroupVersionKind]resourcesemantics.GenericCRD{ brokerv1beta1.SchemeGroupVersion.WithKind("Broker"): &brokerv1beta1.Broker{}, // For group messaging.cloud.google.com. - messagingv1alpha1.SchemeGroupVersion.WithKind("Channel"): &messagingv1alpha1.Channel{}, - messagingv1beta1.SchemeGroupVersion.WithKind("Channel"): &messagingv1beta1.Channel{}, + messagingv1beta1.SchemeGroupVersion.WithKind("Channel"): &messagingv1beta1.Channel{}, // For group events.cloud.google.com. eventsv1alpha1.SchemeGroupVersion.WithKind("CloudStorageSource"): &eventsv1alpha1.CloudStorageSource{}, @@ -191,8 +188,6 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher, brokers eventsv1alpha1_ = eventsv1alpha1.SchemeGroupVersion.Version eventsv1beta1_ = eventsv1beta1.SchemeGroupVersion.Version eventsv1_ = eventsv1.SchemeGroupVersion.Version - messagingv1alpha1_ = messagingv1alpha1.SchemeGroupVersion.Version - messagingv1beta1_ = messagingv1beta1.SchemeGroupVersion.Version inteventsv1alpha1_ = inteventsv1alpha1.SchemeGroupVersion.Version inteventsv1beta1_ = inteventsv1beta1.SchemeGroupVersion.Version inteventsv1_ = inteventsv1.SchemeGroupVersion.Version @@ -274,15 +269,6 @@ func newConversionController(ctx context.Context, cmw configmap.Watcher, brokers inteventsv1_: &inteventsv1.Topic{}, }, }, - // messaging - messagingv1alpha1.Kind("Channel"): { - DefinitionName: messaging.ChannelsResource.String(), - HubVersion: messagingv1alpha1_, - Zygotes: map[string]conversion.ConvertibleObject{ - messagingv1alpha1_: &messagingv1alpha1.Channel{}, - messagingv1beta1_: &messagingv1beta1.Channel{}, - }, - }, }, ctxFunc, ) diff --git a/config/core/configmaps/br-default-channel.yaml b/config/core/configmaps/br-default-channel.yaml index ec085f82b7..709bb6ee92 100644 --- a/config/core/configmaps/br-default-channel.yaml +++ b/config/core/configmaps/br-default-channel.yaml @@ -19,5 +19,5 @@ metadata: namespace: cloud-run-events data: channelTemplateSpec: | - apiVersion: messaging.cloud.google.com/v1alpha1 + apiVersion: messaging.cloud.google.com/v1beta1 kind: Channel diff --git a/config/core/resources/channel.yaml b/config/core/resources/channel.yaml index 04f9cbeab3..c45ab384fe 100644 --- a/config/core/resources/channel.yaml +++ b/config/core/resources/channel.yaml @@ -51,8 +51,7 @@ spec: versions: - &version name: v1alpha1 - # TODO: Flip served bit of v1alpha1 in https://github.com/google/knative-gcp/issues/1544. - served: true + served: false storage: false subresources: status: {} diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 16d0c2e87a..5981bb8fe8 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -61,14 +61,14 @@ chmod +x "${CODEGEN_PKG}"/generate-groups.sh # instead of the $GOPATH directly. For normal projects this can be dropped. "${CODEGEN_PKG}"/generate-groups.sh "deepcopy,client,informer,lister" \ github.com/google/knative-gcp/pkg/client github.com/google/knative-gcp/pkg/apis \ - "messaging:v1alpha1 messaging:v1beta1 events:v1alpha1 events:v1beta1 events:v1 broker:v1beta1 intevents:v1alpha1 intevents:v1beta1 intevents:v1" \ + "messaging:v1beta1 events:v1alpha1 events:v1beta1 events:v1 broker:v1beta1 intevents:v1alpha1 intevents:v1beta1 intevents:v1" \ --go-header-file "${REPO_ROOT_DIR}"/hack/boilerplate/boilerplate.go.txt # Knative Injection chmod +x "${KNATIVE_CODEGEN_PKG}"/hack/generate-knative.sh "${KNATIVE_CODEGEN_PKG}"/hack/generate-knative.sh "injection" \ github.com/google/knative-gcp/pkg/client github.com/google/knative-gcp/pkg/apis \ - "messaging:v1alpha1 messaging:v1beta1 events:v1alpha1 events:v1beta1 events:v1 duck:v1alpha1 duck:v1beta1 duck:v1 broker:v1beta1 intevents:v1alpha1 intevents:v1beta1 intevents:v1" \ + "messaging:v1beta1 events:v1alpha1 events:v1beta1 events:v1 duck:v1alpha1 duck:v1beta1 duck:v1 broker:v1beta1 intevents:v1alpha1 intevents:v1beta1 intevents:v1" \ --go-header-file "${REPO_ROOT_DIR}"/hack/boilerplate/boilerplate.go.txt # Deep copy configs. diff --git a/pkg/apis/messaging/v1alpha1/channel_conversion.go b/pkg/apis/messaging/v1alpha1/channel_conversion.go deleted file mode 100644 index 58c4d03780..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_conversion.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 ( - "context" - "fmt" - - "github.com/google/knative-gcp/pkg/apis/convert" - "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" - "knative.dev/eventing/pkg/apis/messaging" - "knative.dev/pkg/apis" -) - -// ConvertTo implements apis.Convertible. -// Converts source (from v1beta1.Channel) into v1alpha1.Channel. -func (source *Channel) ConvertTo(ctx context.Context, to apis.Convertible) error { - switch sink := to.(type) { - case *v1beta1.Channel: - sink.ObjectMeta = source.ObjectMeta - if sink.Annotations == nil { - sink.Annotations = make(map[string]string, 1) - } - sink.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1beta1" - // v1beta1 Channel implements duck v1 identifiable - sink.Spec.IdentitySpec = convert.FromV1alpha1ToV1IdentitySpec(source.Spec.IdentitySpec) - sink.Spec.Secret = source.Spec.Secret - sink.Spec.Project = source.Spec.Project - sink.Spec.SubscribableSpec = convert.ToV1beta1SubscribableSpec(source.Spec.Subscribable) - // v1beta1 Channel implements duck v1 identifiable - sink.Status.IdentityStatus = convert.FromV1alpha1ToV1IdentityStatus(source.Status.IdentityStatus) - sink.Status.AddressStatus = source.Status.AddressStatus - source.Status.SubscribableTypeStatus.ConvertTo(ctx, &sink.Status.SubscribableStatus) - sink.Status.ProjectID = source.Status.ProjectID - sink.Status.TopicID = source.Status.TopicID - // Remove v1alpha1 as deprecated from the Status Condition when converting to a higher version. - convert.RemoveV1alpha1Deprecated(sink.ConditionSet(), &sink.Status.Status) - return nil - default: - return fmt.Errorf("unknown conversion, got: %T", sink) - } -} - -// ConvertFrom implements apis.Convertible. -// Converts obj from v1alpha1.Channel into v1beta1.Channel. -func (sink *Channel) ConvertFrom(ctx context.Context, from apis.Convertible) error { - switch source := from.(type) { - case *v1beta1.Channel: - sink.ObjectMeta = source.ObjectMeta - if sink.Annotations == nil { - sink.Annotations = make(map[string]string, 1) - } - sink.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1alpha1" - // v1beta1 Channel implements duck v1 identifiable - sink.Spec.IdentitySpec = convert.FromV1ToV1alpha1IdentitySpec(source.Spec.IdentitySpec) - sink.Spec.Secret = source.Spec.Secret - sink.Spec.Project = source.Spec.Project - sink.Spec.Subscribable = convert.FromV1beta1SubscribableSpec(source.Spec.SubscribableSpec) - // v1beta1 Channel implements duck v1 identifiable - sink.Status.IdentityStatus = convert.FromV1ToV1alpha1IdentityStatus(source.Status.IdentityStatus) - sink.Status.AddressStatus = source.Status.AddressStatus - if err := sink.Status.SubscribableTypeStatus.ConvertFrom(ctx, &source.Status.SubscribableStatus); err != nil { - return err - } - sink.Status.ProjectID = source.Status.ProjectID - sink.Status.TopicID = source.Status.TopicID - // Mark v1alpha1 as deprecated as a Status Condition when converting to v1alpha1. - convert.MarkV1alpha1Deprecated(sink.ConditionSet(), &sink.Status.Status) - return nil - default: - return fmt.Errorf("unknown conversion, got: %T", source) - } -} diff --git a/pkg/apis/messaging/v1alpha1/channel_conversion_test.go b/pkg/apis/messaging/v1alpha1/channel_conversion_test.go deleted file mode 100644 index 101a184d11..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_conversion_test.go +++ /dev/null @@ -1,160 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 ( - "context" - "net/url" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - "github.com/google/knative-gcp/pkg/apis/convert" - "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" - "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" - gcptesting "github.com/google/knative-gcp/pkg/testing" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "knative.dev/eventing/pkg/apis/messaging" - "knative.dev/pkg/apis" -) - -// These variables are used to create a 'complete' version of Channel where every field is filled -// in. -var ( - // completePullSubscription is a Channel with every field filled in, except TypeMeta. TypeMeta - // is excluded because conversions do not convert it and this variable was created to test - // conversions. - completeChannel = &Channel{ - ObjectMeta: gcptesting.CompleteObjectMeta, - Spec: ChannelSpec{ - IdentitySpec: gcptesting.CompleteV1alpha1IdentitySpec, - Secret: gcptesting.CompleteSecret, - Project: "project", - Subscribable: gcptesting.CompleteV1alpha1Subscribable, - }, - Status: ChannelStatus{ - IdentityStatus: gcptesting.CompleteV1alpha1IdentityStatus, - AddressStatus: gcptesting.CompleteV1AddressStatus, - SubscribableTypeStatus: gcptesting.CompleteV1alpha1SubscribableTypeStatus, - ProjectID: "projectId", - TopicID: "topicID", - }, - } -) - -func TestChannelConversionBadType(t *testing.T) { - good, bad := &Channel{}, &v1alpha1.Topic{} - - if err := good.ConvertTo(context.Background(), bad); err == nil { - t.Errorf("ConvertTo() = %#v, wanted error", bad) - } - - if err := good.ConvertFrom(context.Background(), bad); err == nil { - t.Errorf("ConvertFrom() = %#v, wanted error", good) - } -} - -func TestChannelConversion(t *testing.T) { - // Just one for now, just adding the for loop for ease of future changes. - versions := []struct { - version apis.Convertible - duckSubscribableVersion string - }{ - { - version: &v1beta1.Channel{}, - duckSubscribableVersion: "v1beta1", - }, - } - - tests := []struct { - name string - in *Channel - }{{ - name: "min configuration", - in: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Name: "c-name", - Namespace: "c-ns", - Generation: 17, - }, - Spec: ChannelSpec{}, - }, - }, { - name: "full configuration", - in: completeChannel, - }} - for _, test := range tests { - for _, version := range versions { - t.Run(test.name, func(t *testing.T) { - ver := version.version - // DeepCopy because we will edit it below. - in := test.in.DeepCopy() - if err := test.in.ConvertTo(context.Background(), ver); err != nil { - t.Errorf("ConvertTo() = %v", err) - } - - // Verify that after conversion the duck subscribable annotation matches the version - // converted to. - o := ver.(metav1.Object) - if sv := o.GetAnnotations()[messaging.SubscribableDuckVersionAnnotation]; sv != version.duckSubscribableVersion { - t.Errorf("Incorrect subscribable duck version annotation. Want %q. Got %q", version.duckSubscribableVersion, sv) - } - - got := &Channel{} - if err := got.ConvertFrom(context.Background(), ver); err != nil { - t.Errorf("ConvertFrom() = %v", err) - } - - // The duck subscribable version of a v1alpha1 Channel will always be set to - // v1alpha1, even if it was not set in the original. - if in.Annotations == nil { - in.Annotations = make(map[string]string, 1) - } - in.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1alpha1" - - // DeadLetterSinkURI exists exclusively in v1alpha1, it has not yet been promoted to - // v1beta1. So it won't round trip, it will be silently removed. - if in.Spec.Subscribable != nil { - for i := range in.Spec.Subscribable.Subscribers { - in.Spec.Subscribable.Subscribers[i].DeadLetterSinkURI = nil - } - } - - // V1beta1 Channel implements duck v1 identifiable, where ServiceAccountName is removed. - // So this is not a round trip, the field will be silently removed. - in.Status.ServiceAccountName = "" - // Make sure the Deprecated Condition is added to the Status after converted back to v1alpha1, - // We need to ignore the LastTransitionTime as it is set in real time when doing the comparison. - dc := got.Status.GetCondition(convert.DeprecatedType) - if dc == nil { - t.Errorf("ConvertFrom() should add a deprecated warning condition but it does not.") - } else if diff := cmp.Diff(*dc, convert.DeprecatedV1Alpha1Condition, - cmpopts.IgnoreFields(apis.Condition{}, "LastTransitionTime")); diff != "" { - t.Errorf("Failed to verify deprecated condition (-want, + got) = %v", diff) - } - // Remove the Deprecated Condition from Status to compare the remaining of fields. - cs := apis.NewLivingConditionSet() - cs.Manage(&got.Status).ClearCondition(convert.DeprecatedType) - - ignoreUsername := cmp.AllowUnexported(url.Userinfo{}) - if diff := cmp.Diff(in, got, ignoreUsername); diff != "" { - t.Errorf("roundtrip (-want, +got) = %v", diff) - } - }) - } - } -} diff --git a/pkg/apis/messaging/v1alpha1/channel_defaults.go b/pkg/apis/messaging/v1alpha1/channel_defaults.go deleted file mode 100644 index d97f9cd6ae..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_defaults.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -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 v1alpha1 - -import ( - "context" - - "github.com/google/knative-gcp/pkg/logging" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/equality" - "knative.dev/eventing/pkg/apis/messaging" - "knative.dev/pkg/apis" - - "github.com/google/knative-gcp/pkg/apis/configs/gcpauth" - "github.com/google/knative-gcp/pkg/apis/duck" - "github.com/google/knative-gcp/pkg/apis/messaging/internal" - metadataClient "github.com/google/knative-gcp/pkg/gclient/metadata" -) - -func (c *Channel) SetDefaults(ctx context.Context) { - ctx = apis.WithinParent(ctx, c.ObjectMeta) - // We need to set this to the _stored_ version of the Channel. If we set to anything other than - // the stored version, then when reading the stored version, conversion won't be called so - // nothing will set it to the stored version. - // Note that if a user sends a bad version of this annotation (e.g. sets it to v1beta1), then we - // won't overwrite their bad input. This is because the webhook: - // 1. Reads the stored version. - // 2. Converts to the desired version. - // 3. Defaults the desired version. - // So we don't know if the user or the converter put the value here, therefore we are forced to - // assume it was the converter and shouldn't change it. - if c.Annotations == nil { - c.Annotations = make(map[string]string, 1) - } - if _, present := c.Annotations[messaging.SubscribableDuckVersionAnnotation]; !present { - c.Annotations[messaging.SubscribableDuckVersionAnnotation] = internal.StoredChannelVersion - } - c.Spec.SetDefaults(ctx) - duck.SetClusterNameAnnotation(&c.ObjectMeta, metadataClient.NewDefaultMetadataClient()) -} - -func (cs *ChannelSpec) SetDefaults(ctx context.Context) { - ad := gcpauth.FromContextOrDefaults(ctx).GCPAuthDefaults - if ad == nil { - // TODO This should probably error out, rather than silently allow in non-defaulted COs. - logging.FromContext(ctx).Error("Failed to get the GCPAuthDefaults") - return - } - if cs.ServiceAccountName == "" && cs.Secret == nil || equality.Semantic.DeepEqual(cs.Secret, &corev1.SecretKeySelector{}) { - cs.ServiceAccountName = ad.KSA(apis.ParentMeta(ctx).Namespace) - cs.Secret = ad.Secret(apis.ParentMeta(ctx).Namespace) - } -} diff --git a/pkg/apis/messaging/v1alpha1/channel_defaults_test.go b/pkg/apis/messaging/v1alpha1/channel_defaults_test.go deleted file mode 100644 index b511b0f514..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_defaults_test.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -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 v1alpha1 - -import ( - "testing" - - "github.com/google/go-cmp/cmp" - gcpauthtesthelper "github.com/google/knative-gcp/pkg/apis/configs/gcpauth/testhelper" - "github.com/google/knative-gcp/pkg/apis/duck" - testingMetadataClient "github.com/google/knative-gcp/pkg/gclient/metadata/testing" - - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func TestChannelDefaults(t *testing.T) { - want := &Channel{ - ObjectMeta: v1.ObjectMeta{ - Annotations: map[string]string{ - "messaging.knative.dev/subscribable": "v1beta1", - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - Secret: &gcpauthtesthelper.Secret, - }} - - got := &Channel{ - ObjectMeta: v1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{}, - } - got.SetDefaults(gcpauthtesthelper.ContextWithDefaults()) - - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("failed to get expected (-want, +got) = %v", diff) - } -} diff --git a/pkg/apis/messaging/v1alpha1/channel_lifecycle.go b/pkg/apis/messaging/v1alpha1/channel_lifecycle.go deleted file mode 100644 index 07e4478087..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_lifecycle.go +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 v1alpha1 - -import ( - "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" - corev1 "k8s.io/api/core/v1" - "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" -) - -// GetCondition returns the condition currently associated with the given type, -// or nil. -func (cs *ChannelStatus) GetCondition(t apis.ConditionType) *apis.Condition { - return channelCondSet.Manage(cs).GetCondition(t) -} - -// GetTopLevelCondition returns the top level condition. -func (cs *ChannelStatus) GetTopLevelCondition() *apis.Condition { - return channelCondSet.Manage(cs).GetTopLevelCondition() -} - -// IsReady returns true if the resource is ready overall. -func (cs *ChannelStatus) IsReady() bool { - return channelCondSet.Manage(cs).IsHappy() -} - -// InitializeConditions sets relevant unset conditions to Unknown state. -func (cs *ChannelStatus) InitializeConditions() { - channelCondSet.Manage(cs).InitializeConditions() -} - -// SetAddress updates the Addressable status of the channel and propagates a -// url status to the Addressable status condition based on url. -func (cs *ChannelStatus) SetAddress(url *apis.URL) { - if cs.Address == nil { - cs.Address = &duckv1.Addressable{} - } - if url != nil { - cs.Address.URL = url - channelCondSet.Manage(cs).MarkTrue(ChannelConditionAddressable) - } else { - cs.Address.URL = nil - channelCondSet.Manage(cs).MarkFalse(ChannelConditionAddressable, "emptyUrl", "url is empty") - } -} - -// MarkTopicReady sets the condition that the topic has been created and ready. -func (cs *ChannelStatus) MarkTopicReady() { - channelCondSet.Manage(cs).MarkTrue(ChannelConditionTopicReady) -} - -func (cs *ChannelStatus) PropagateTopicStatus(ts *v1alpha1.TopicStatus) { - tc := ts.GetTopLevelCondition() - if tc == nil { - cs.MarkTopicNotConfigured() - return - } - - switch { - case tc.Status == corev1.ConditionUnknown: - cs.MarkTopicUnknown(tc.Reason, tc.Message) - case tc.Status == corev1.ConditionTrue: - cs.MarkTopicReady() - case tc.Status == corev1.ConditionFalse: - cs.MarkTopicFailed(tc.Reason, tc.Message) - default: - cs.MarkTopicUnknown("TopicUnknown", "The status of Topic is invalid: %v", tc.Status) - } -} - -// MarkTopicFailed sets the condition that signals there is not a topic for this -// Channel. This could be because of an error or the Channel is being deleted. -func (cs *ChannelStatus) MarkTopicFailed(reason, messageFormat string, messageA ...interface{}) { - channelCondSet.Manage(cs).MarkFalse(ChannelConditionTopicReady, reason, messageFormat, messageA...) -} - -func (cs *ChannelStatus) MarkTopicNotOwned(messageFormat string, messageA ...interface{}) { - channelCondSet.Manage(cs).MarkFalse(ChannelConditionTopicReady, "NotOwned", messageFormat, messageA...) -} - -func (cs *ChannelStatus) MarkTopicNotConfigured() { - channelCondSet.Manage(cs).MarkUnknown(ChannelConditionTopicReady, - "TopicNotConfigured", "Topic has not yet been reconciled") -} - -func (cs *ChannelStatus) MarkTopicUnknown(reason, messageFormat string, messageA ...interface{}) { - channelCondSet.Manage(cs).MarkUnknown(ChannelConditionTopicReady, reason, messageFormat, messageA...) -} diff --git a/pkg/apis/messaging/v1alpha1/channel_lifecycle_test.go b/pkg/apis/messaging/v1alpha1/channel_lifecycle_test.go deleted file mode 100644 index c627aff1dc..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_lifecycle_test.go +++ /dev/null @@ -1,303 +0,0 @@ -/* -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 v1alpha1 - -import ( - "sort" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" - duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1" - "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" - corev1 "k8s.io/api/core/v1" - "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" -) - -var condReady = apis.Condition{ - Type: ChannelConditionReady, - Status: corev1.ConditionTrue, -} - -var ignoreAllButTypeAndStatus = cmpopts.IgnoreFields( - apis.Condition{}, - "LastTransitionTime", "Message", "Reason", "Severity") - -func TestChannelGetCondition(t *testing.T) { - tests := []struct { - name string - cs *ChannelStatus - condQuery apis.ConditionType - want *apis.Condition - }{{ - name: "single condition", - cs: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{ - condReady, - }, - }, - }, - }, - condQuery: apis.ConditionReady, - want: &condReady, - }} - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - got := test.cs.GetCondition(test.condQuery) - if diff := cmp.Diff(test.want, got); diff != "" { - t.Errorf("unexpected condition (-want, +got) = %v", diff) - } - }) - } -} - -func TestChannelInitializeConditions(t *testing.T) { - tests := []struct { - name string - cs *ChannelStatus - want *ChannelStatus - }{{ - name: "empty", - cs: &ChannelStatus{}, - want: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: ChannelConditionAddressable, - Status: corev1.ConditionUnknown, - }, { - Type: ChannelConditionReady, - Status: corev1.ConditionUnknown, - }, { - Type: ChannelConditionTopicReady, - Status: corev1.ConditionUnknown, - }}, - }, - }, - }, - }, { - name: "one false", - cs: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: ChannelConditionAddressable, - Status: corev1.ConditionFalse, - }}, - }, - }, - }, - want: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: ChannelConditionAddressable, - Status: corev1.ConditionFalse, - }, { - Type: ChannelConditionReady, - Status: corev1.ConditionUnknown, - }, { - Type: ChannelConditionTopicReady, - Status: corev1.ConditionUnknown, - }}, - }, - }, - }, - }, { - name: "one true", - cs: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: ChannelConditionAddressable, - Status: corev1.ConditionTrue, - }}, - }, - }, - }, - want: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: ChannelConditionAddressable, - Status: corev1.ConditionTrue, - }, { - Type: ChannelConditionReady, - Status: corev1.ConditionUnknown, - }, { - Type: ChannelConditionTopicReady, - Status: corev1.ConditionUnknown, - }}, - }, - }, - }, - }} - - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - sort.Slice(test.want.Conditions, func(i, j int) bool { return test.want.Conditions[i].Type < test.want.Conditions[j].Type }) - test.cs.InitializeConditions() - if diff := cmp.Diff(test.want, test.cs, ignoreAllButTypeAndStatus); diff != "" { - t.Errorf("unexpected conditions (-want, +got) = %v", diff) - } - }) - } -} - -func TestChannelIsReady(t *testing.T) { - tests := []struct { - name string - setAddress bool - topicStatus *v1alpha1.TopicStatus - wantConditionStatus corev1.ConditionStatus - want bool - }{{ - name: "all happy", - setAddress: true, - topicStatus: ReadyTopicStatus(), - wantConditionStatus: corev1.ConditionTrue, - want: true, - }, { - name: "address not set", - setAddress: false, - topicStatus: ReadyTopicStatus(), - wantConditionStatus: corev1.ConditionUnknown, - want: false, - }, { - name: "the status of topic is false", - setAddress: true, - topicStatus: FalseTopicStatus(), - wantConditionStatus: corev1.ConditionFalse, - want: false, - }, { - name: "the status of topic is unknown", - setAddress: true, - topicStatus: UnknownTopicStatus(), - wantConditionStatus: corev1.ConditionUnknown, - want: false, - }} - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - cs := &ChannelStatus{} - cs.InitializeConditions() - if test.setAddress { - cs.SetAddress(&apis.URL{Scheme: "http", Host: "foo.bar"}) - } - cs.PropagateTopicStatus(test.topicStatus) - gotConditionStatus := cs.GetTopLevelCondition().Status - if test.wantConditionStatus != gotConditionStatus { - t.Errorf("unexpected condition status: want %v, got %v", test.wantConditionStatus, gotConditionStatus) - } - got := cs.IsReady() - if got != test.want { - t.Errorf("unexpected readiness: want %v, got %v", test.want, got) - } - }) - } -} - -func TestPubSubChannelStatus_SetAddressable(t *testing.T) { - testCases := map[string]struct { - url *apis.URL - want *ChannelStatus - }{ - "empty string": { - want: &ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{ - { - Type: ChannelConditionAddressable, - Status: corev1.ConditionFalse, - }, - // Note that Ready is here because when the condition is marked False, duck - // automatically sets Ready to false. - { - Type: ChannelConditionReady, - Status: corev1.ConditionFalse, - }, - }, - }, - }, - AddressStatus: duckv1.AddressStatus{Address: &duckv1.Addressable{}}, - }, - }, - "has domain": { - url: &apis.URL{Scheme: "http", Host: "test-domain"}, - want: &ChannelStatus{ - AddressStatus: duckv1.AddressStatus{ - Address: &duckv1.Addressable{ - URL: &apis.URL{ - Scheme: "http", - Host: "test-domain", - }, - }, - }, - IdentityStatus: duckv1alpha1.IdentityStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{ - { - Type: ChannelConditionAddressable, - Status: corev1.ConditionTrue, - }, - { - Type: ChannelConditionReady, - Status: corev1.ConditionUnknown, - }, - }, - }, - }, - }, - }, - } - for n, tc := range testCases { - t.Run(n, func(t *testing.T) { - cs := &ChannelStatus{} - cs.SetAddress(tc.url) - if diff := cmp.Diff(tc.want, cs, ignoreAllButTypeAndStatus); diff != "" { - t.Errorf("unexpected conditions (-want, +got) = %v", diff) - } - }) - } -} - -func ReadyTopicStatus() *v1alpha1.TopicStatus { - ts := &v1alpha1.TopicStatus{} - ts.InitializeConditions() - ts.MarkPublisherDeployed() - ts.MarkTopicReady() - url, _ := apis.ParseURL("http://testchannel.mynamespace.svc.cluster.local/") - ts.SetAddress(url) - ts.TopicID = "test" - return ts -} - -func FalseTopicStatus() *v1alpha1.TopicStatus { - ts := &v1alpha1.TopicStatus{} - ts.InitializeConditions() - ts.MarkNoTopic("TopicNotFound", "topic not found") - return ts -} - -func UnknownTopicStatus() *v1alpha1.TopicStatus { - ts := &v1alpha1.TopicStatus{} - ts.InitializeConditions() - return ts -} diff --git a/pkg/apis/messaging/v1alpha1/channel_types.go b/pkg/apis/messaging/v1alpha1/channel_types.go deleted file mode 100644 index 9a2ba945a5..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_types.go +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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 v1alpha1 - -import ( - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" - eventingduck "knative.dev/eventing/pkg/apis/duck/v1alpha1" - "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" - "knative.dev/pkg/webhook/resourcesemantics" - - duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1" - kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Channel is a resource representing an channel backed by Google Cloud Pub/Sub. -type Channel struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines the desired state of the Channel. - Spec ChannelSpec `json:"spec,omitempty"` - - // Status represents the current state of the Channel. This data may be out of - // date. - // +optional - Status ChannelStatus `json:"status,omitempty"` -} - -// Check that Channel can be validated, can be defaulted, and has immutable fields. -var ( - _ apis.Convertible = (*Channel)(nil) - _ apis.Defaultable = (*Channel)(nil) - _ apis.Validatable = (*Channel)(nil) - _ runtime.Object = (*Channel)(nil) - _ resourcesemantics.GenericCRD = (*Channel)(nil) - _ kngcpduck.Identifiable = (*Channel)(nil) -) - -// ChannelSpec defines which subscribers have expressed interest in -// receiving events from this Channel. -// arguments for a Channel. -type ChannelSpec struct { - duckv1alpha1.IdentitySpec `json:",inline"` - // Secret is the credential to use to create, publish, and poll the Pub/Sub - // Topic and Subscriptions. 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). - // +optional - Secret *corev1.SecretKeySelector `json:"secret,omitempty"` - - // Project is the ID of the Google Cloud Project that the Pub/Sub - // Topic and Subscriptions will be created in. - // +optional - Project string `json:"project,omitempty"` - - // Channel conforms to Duck type Subscribable. - // +optional - Subscribable *eventingduck.Subscribable `json:"subscribable,omitempty"` -} - -var channelCondSet = apis.NewLivingConditionSet( - ChannelConditionAddressable, - ChannelConditionTopicReady, -) - -const ( - // ChannelConditionReady has status True when all subconditions below have - // been set to True. - ChannelConditionReady = apis.ConditionReady - - // ChannelConditionAddressable has status true when this Channel meets the - // Addressable contract and has a non-empty url. - ChannelConditionAddressable apis.ConditionType = "Addressable" - - // ChannelConditionTopicReady has status True when the Channel has had a - // Pub/Sub topic created for it. - ChannelConditionTopicReady apis.ConditionType = "TopicReady" -) - -// ChannelStatus represents the current state of a Channel. -type ChannelStatus struct { - duckv1alpha1.IdentityStatus `json:",inline"` - - // Channel is Addressable. It currently exposes the endpoint as a - // fully-qualified DNS name which will distribute traffic over the - // provided targets from inside the cluster. - // - // It generally has the form {channel}.{namespace}.svc.{cluster domain name} - duckv1.AddressStatus `json:",inline"` - - // SubscribableTypeStatus is populated with the statuses of each of the Channelable's subscribers. - eventingduck.SubscribableTypeStatus `json:",inline"` - - // ProjectID is the resolved project ID in use by the Channel. - // +optional - ProjectID string `json:"projectId,omitempty"` - - // TopicID is the created topic ID used by the Channel. - // +optional - TopicID string `json:"topicId,omitempty"` -} - -// Methods for identifiable interface. -// IdentitySpec returns the IdentitySpec portion of the Spec. -func (c *Channel) IdentitySpec() *duckv1alpha1.IdentitySpec { - return &c.Spec.IdentitySpec -} - -// IdentityStatus returns the IdentityStatus portion of the Status. -func (c *Channel) IdentityStatus() *duckv1alpha1.IdentityStatus { - return &c.Status.IdentityStatus -} - -// ConditionSet returns the apis.ConditionSet of the embedding object -func (s *Channel) ConditionSet() *apis.ConditionSet { - return &channelCondSet -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ChannelList is a collection of Pub/Sub backed Channels. -type ChannelList struct { - metav1.TypeMeta `json:",inline"` - // +optional - metav1.ListMeta `json:"metadata,omitempty"` - Items []Channel `json:"items"` -} - -// GetGroupVersionKind returns GroupVersionKind for Pub/Sub backed Channel. -func (c *Channel) GetGroupVersionKind() schema.GroupVersionKind { - return SchemeGroupVersion.WithKind("Channel") -} diff --git a/pkg/apis/messaging/v1alpha1/channel_types_test.go b/pkg/apis/messaging/v1alpha1/channel_types_test.go deleted file mode 100644 index b9508d65e3..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_types_test.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -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 v1alpha1 - -import ( - "testing" - - "github.com/google/go-cmp/cmp/cmpopts" - "knative.dev/pkg/apis" - - "k8s.io/apimachinery/pkg/runtime/schema" - - "github.com/google/go-cmp/cmp" - duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1" -) - -func TestChannelGetGroupVersionKind(t *testing.T) { - want := schema.GroupVersionKind{ - Group: "messaging.cloud.google.com", - Version: "v1alpha1", - Kind: "Channel", - } - - c := &Channel{} - got := c.GetGroupVersionKind() - - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("failed to get expected (-want, +got) = %v", diff) - } -} - -func TestChannelIdentitySpec(t *testing.T) { - s := &Channel{ - Spec: ChannelSpec{ - IdentitySpec: duckv1alpha1.IdentitySpec{ - ServiceAccountName: "test", - }, - }, - } - want := "test" - got := s.IdentitySpec().ServiceAccountName - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("failed to get expected (-want, +got) = %v", diff) - } -} - -func TestChannelIdentityStatus(t *testing.T) { - s := &Channel{ - Status: ChannelStatus{ - IdentityStatus: duckv1alpha1.IdentityStatus{}, - }, - } - want := &duckv1alpha1.IdentityStatus{} - got := s.IdentityStatus() - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("failed to get expected (-want, +got) = %v", diff) - } -} - -func TestChannelConditionSet(t *testing.T) { - want := []apis.Condition{{ - Type: ChannelConditionAddressable, - }, { - Type: ChannelConditionTopicReady, - }, { - Type: apis.ConditionReady, - }} - c := &Channel{} - - c.ConditionSet().Manage(&c.Status).InitializeConditions() - var got []apis.Condition = c.Status.GetConditions() - - compareConditionTypes := cmp.Transformer("ConditionType", func(c apis.Condition) apis.ConditionType { - return c.Type - }) - sortConditionTypes := cmpopts.SortSlices(func(a, b apis.Condition) bool { - return a.Type < b.Type - }) - if diff := cmp.Diff(want, got, sortConditionTypes, compareConditionTypes); diff != "" { - t.Errorf("failed to get expected (-want, +got) = %v", diff) - } -} diff --git a/pkg/apis/messaging/v1alpha1/channel_validation.go b/pkg/apis/messaging/v1alpha1/channel_validation.go deleted file mode 100644 index f2f6273ce6..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_validation.go +++ /dev/null @@ -1,84 +0,0 @@ -/* -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 v1alpha1 - -import ( - "context" - "fmt" - - "github.com/google/go-cmp/cmp/cmpopts" - - "github.com/google/knative-gcp/pkg/apis/duck" - - "github.com/google/go-cmp/cmp" - - "knative.dev/pkg/apis" -) - -func (c *Channel) Validate(ctx context.Context) *apis.FieldError { - err := c.Spec.Validate(ctx).ViaField("spec") - - if apis.IsInUpdate(ctx) { - original := apis.GetBaseline(ctx).(*Channel) - err = err.Also(c.CheckImmutableFields(ctx, original)) - } - return err -} - -func (cs *ChannelSpec) Validate(ctx context.Context) *apis.FieldError { - var errs *apis.FieldError - - if cs.Subscribable != nil { - for i, subscriber := range cs.Subscribable.Subscribers { - if subscriber.ReplyURI == nil && subscriber.SubscriberURI == nil { - fe := apis.ErrMissingField("replyURI", "subscriberURI") - fe.Details = "expected at least one of, got none" - errs = errs.Also(fe.ViaField(fmt.Sprintf("subscriber[%d]", i)).ViaField("subscribable")) - } - } - } - - if err := duck.ValidateCredential(cs.Secret, cs.ServiceAccountName); err != nil { - errs = errs.Also(err) - } - - return errs -} - -func (current *Channel) CheckImmutableFields(ctx context.Context, original *Channel) *apis.FieldError { - if original == nil { - return nil - } - - var errs *apis.FieldError - - // Modification of Secret, ServiceAccountName and Project are not allowed. Everything else is mutable. - if diff := cmp.Diff(original.Spec, current.Spec, - cmpopts.IgnoreFields(ChannelSpec{}, "Subscribable")); diff != "" { - errs = errs.Also(&apis.FieldError{ - Message: "Immutable fields changed (-old +new)", - Paths: []string{"spec"}, - Details: diff, - }) - } - - // Modification of AutoscalingClassAnnotations is not allowed. - errs = duck.CheckImmutableAutoscalingClassAnnotations(¤t.ObjectMeta, &original.ObjectMeta, errs) - - // Modification of non-empty cluster name annotation is not allowed. - return duck.CheckImmutableClusterNameAnnotation(¤t.ObjectMeta, &original.ObjectMeta, errs) -} diff --git a/pkg/apis/messaging/v1alpha1/channel_validation_test.go b/pkg/apis/messaging/v1alpha1/channel_validation_test.go deleted file mode 100644 index cc597be312..0000000000 --- a/pkg/apis/messaging/v1alpha1/channel_validation_test.go +++ /dev/null @@ -1,301 +0,0 @@ -/* -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 v1alpha1 - -import ( - "context" - "testing" - - corev1 "k8s.io/api/core/v1" - - "github.com/google/go-cmp/cmp" - gcpauthtesthelper "github.com/google/knative-gcp/pkg/apis/configs/gcpauth/testhelper" - "github.com/google/knative-gcp/pkg/apis/duck" - duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1" - testingMetadataClient "github.com/google/knative-gcp/pkg/gclient/metadata/testing" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - eventingduck "knative.dev/eventing/pkg/apis/duck/v1alpha1" - "knative.dev/pkg/apis" - "knative.dev/pkg/webhook/resourcesemantics" -) - -var ( - validServiceAccountName = "test" - invalidServiceAccountName = "@test" - - channelSpec = ChannelSpec{ - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("resultendpoint"), - }}, - }, - } -) - -func TestChannelValidation(t *testing.T) { - tests := []struct { - name string - cr resourcesemantics.GenericCRD - want *apis.FieldError - }{{ - name: "empty", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{}, - }, - want: nil, - }, { - name: "valid subscribers array", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("resultendpoint"), - }}, - }}, - }, - want: nil, - }, { - name: "empty subscriber at index 1", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("replyendpoint"), - }, {}}, - }}, - }, - want: func() *apis.FieldError { - fe := apis.ErrMissingField("spec.subscribable.subscriber[1].replyURI", "spec.subscribable.subscriber[1].subscriberURI") - fe.Details = "expected at least one of, got none" - return fe - }(), - }, { - name: "2 empty subscribers", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{}, {}}, - }, - }, - }, - want: func() *apis.FieldError { - var errs *apis.FieldError - fe := apis.ErrMissingField("spec.subscribable.subscriber[0].replyURI", "spec.subscribable.subscriber[0].subscriberURI") - fe.Details = "expected at least one of, got none" - errs = errs.Also(fe) - fe = apis.ErrMissingField("spec.subscribable.subscriber[1].replyURI", "spec.subscribable.subscriber[1].subscriberURI") - fe.Details = "expected at least one of, got none" - errs = errs.Also(fe) - return errs - }(), - }, { - name: "nil secret", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("replyendpoint"), - }}, - }}, - }, - want: nil, - }, { - name: "invalid k8s service account", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - IdentitySpec: duckv1alpha1.IdentitySpec{ - ServiceAccountName: invalidServiceAccountName, - }, - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("replyendpoint"), - }}, - }}, - }, - want: func() *apis.FieldError { - fe := &apis.FieldError{ - Message: `invalid value: @test, serviceAccountName should have format: ^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$`, - Paths: []string{"spec.serviceAccountName"}, - } - return fe - }(), - }, { - name: "valid k8s service account", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - IdentitySpec: duckv1alpha1.IdentitySpec{ - ServiceAccountName: validServiceAccountName, - }, - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("replyendpoint"), - }}, - }}, - }, - want: nil, - }, { - name: "have k8s service account and secret at the same time", - cr: &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - duck.ClusterNameAnnotation: testingMetadataClient.FakeClusterName, - }, - }, - Spec: ChannelSpec{ - IdentitySpec: duckv1alpha1.IdentitySpec{ - ServiceAccountName: validServiceAccountName, - }, - Secret: &gcpauthtesthelper.Secret, - Subscribable: &eventingduck.Subscribable{ - Subscribers: []eventingduck.SubscriberSpec{{ - SubscriberURI: apis.HTTP("subscriberendpoint"), - ReplyURI: apis.HTTP("replyendpoint"), - }}, - }}, - }, - want: func() *apis.FieldError { - fe := &apis.FieldError{ - Message: "Can't have spec.serviceAccountName and spec.secret at the same time", - Paths: []string{"spec"}, - } - return fe - }(), - }} - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - got := test.cr.Validate(context.TODO()) - if diff := cmp.Diff(test.want.Error(), got.Error()); diff != "" { - t.Errorf("%s: validate (-want, +got) = %v", test.name, diff) - } - }) - } -} - -func TestCheckImmutableFields(t *testing.T) { - testCases := map[string]struct { - orig interface{} - updated ChannelSpec - origAnnotation map[string]string - updatedAnnotation map[string]string - allowed bool - }{ - "nil orig": { - updated: ChannelSpec{}, - allowed: true, - }, - "ServiceAccount changed": { - orig: &channelSpec, - updated: ChannelSpec{ - IdentitySpec: duckv1alpha1.IdentitySpec{ - ServiceAccountName: "new-service-account", - }, - }, - allowed: false, - }, - "Secret changed": { - orig: &channelSpec, - updated: ChannelSpec{ - Secret: &corev1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "some-other-name", - }, - Key: "some-other-secret-key", - }, - }, - allowed: false, - }, - "Project changed": { - orig: &channelSpec, - updated: ChannelSpec{ - Project: "some-other-project", - }, - allowed: false, - }, - } - - for n, tc := range testCases { - t.Run(n, func(t *testing.T) { - var orig *Channel - - if tc.origAnnotation != nil { - orig = &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: tc.origAnnotation, - }, - } - } else if tc.orig != nil { - if spec, ok := tc.orig.(*ChannelSpec); ok { - orig = &Channel{ - Spec: *spec, - } - } - } - updated := &Channel{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: tc.updatedAnnotation, - }, - Spec: tc.updated, - } - err := updated.CheckImmutableFields(context.TODO(), orig) - if tc.allowed != (err == nil) { - t.Fatalf("Unexpected immutable field check. Expected %v. Actual %v", tc.allowed, err) - } - }) - } -} diff --git a/pkg/apis/messaging/v1alpha1/doc.go b/pkg/apis/messaging/v1alpha1/doc.go deleted file mode 100644 index 0f27c1b885..0000000000 --- a/pkg/apis/messaging/v1alpha1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2019 Google LLC - -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 eventing v1alpha1 API group -// +k8s:openapi-gen=true -// +k8s:deepcopy-gen=package,register -// +k8s:conversion-gen=github.com/google/knative-gcp/pkg/apis/messaging -// +k8s:defaulter-gen=TypeMeta -// +groupName=messaging.cloud.google.com -package v1alpha1 diff --git a/pkg/apis/messaging/v1alpha1/register.go b/pkg/apis/messaging/v1alpha1/register.go deleted file mode 100644 index 46073aa303..0000000000 --- a/pkg/apis/messaging/v1alpha1/register.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2019 Google LLC. - -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/knative-gcp/pkg/apis/messaging" - - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: messaging.GroupName, Version: "v1alpha1"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Channel{}, - &ChannelList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/messaging/v1alpha1/register_test.go b/pkg/apis/messaging/v1alpha1/register_test.go deleted file mode 100644 index 3d339ba0e2..0000000000 --- a/pkg/apis/messaging/v1alpha1/register_test.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2019 Google LLC - -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 ( - "testing" - - "k8s.io/apimachinery/pkg/runtime" - - "github.com/google/go-cmp/cmp" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func TestResource(t *testing.T) { - want := schema.GroupResource{ - Group: "messaging.cloud.google.com", - Resource: "foo", - } - - got := Resource("foo") - - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("unexpected resource (-want, +got) = %v", diff) - } -} - -func TestKind(t *testing.T) { - want := schema.GroupKind{ - Group: "messaging.cloud.google.com", - Kind: "foo", - } - - got := Kind("foo") - - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("unexpected resource (-want, +got) = %v", diff) - } -} - -// TestKnownTypes makes sure that expected types get added. -func TestKnownTypes(t *testing.T) { - scheme := runtime.NewScheme() - addKnownTypes(scheme) - types := scheme.KnownTypes(SchemeGroupVersion) - - for _, name := range []string{ - "Channel", - "ChannelList", - } { - if _, ok := types[name]; !ok { - t.Errorf("Did not find %q as registered type", name) - } - } - -} diff --git a/pkg/apis/messaging/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/messaging/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index d4b21d59bf..0000000000 --- a/pkg/apis/messaging/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,134 +0,0 @@ -// +build !ignore_autogenerated - -/* -Copyright 2020 Google LLC - -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 ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - duckv1alpha1 "knative.dev/eventing/pkg/apis/duck/v1alpha1" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Channel) DeepCopyInto(out *Channel) { - *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 Channel. -func (in *Channel) DeepCopy() *Channel { - if in == nil { - return nil - } - out := new(Channel) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Channel) 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 *ChannelList) DeepCopyInto(out *ChannelList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Channel, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelList. -func (in *ChannelList) DeepCopy() *ChannelList { - if in == nil { - return nil - } - out := new(ChannelList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ChannelList) 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 *ChannelSpec) DeepCopyInto(out *ChannelSpec) { - *out = *in - out.IdentitySpec = in.IdentitySpec - if in.Secret != nil { - in, out := &in.Secret, &out.Secret - *out = new(v1.SecretKeySelector) - (*in).DeepCopyInto(*out) - } - if in.Subscribable != nil { - in, out := &in.Subscribable, &out.Subscribable - *out = new(duckv1alpha1.Subscribable) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelSpec. -func (in *ChannelSpec) DeepCopy() *ChannelSpec { - if in == nil { - return nil - } - out := new(ChannelSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ChannelStatus) DeepCopyInto(out *ChannelStatus) { - *out = *in - in.IdentityStatus.DeepCopyInto(&out.IdentityStatus) - in.AddressStatus.DeepCopyInto(&out.AddressStatus) - in.SubscribableTypeStatus.DeepCopyInto(&out.SubscribableTypeStatus) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelStatus. -func (in *ChannelStatus) DeepCopy() *ChannelStatus { - if in == nil { - return nil - } - out := new(ChannelStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 18dca75dbb..b2d738d53f 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -28,7 +28,6 @@ import ( internalv1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1" internalv1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1alpha1" internalv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1beta1" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1alpha1" messagingv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1beta1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -44,7 +43,6 @@ type Interface interface { InternalV1alpha1() internalv1alpha1.InternalV1alpha1Interface InternalV1beta1() internalv1beta1.InternalV1beta1Interface InternalV1() internalv1.InternalV1Interface - MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Interface MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface } @@ -52,15 +50,14 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - eventingV1beta1 *eventingv1beta1.EventingV1beta1Client - eventsV1alpha1 *eventsv1alpha1.EventsV1alpha1Client - eventsV1beta1 *eventsv1beta1.EventsV1beta1Client - eventsV1 *eventsv1.EventsV1Client - internalV1alpha1 *internalv1alpha1.InternalV1alpha1Client - internalV1beta1 *internalv1beta1.InternalV1beta1Client - internalV1 *internalv1.InternalV1Client - messagingV1alpha1 *messagingv1alpha1.MessagingV1alpha1Client - messagingV1beta1 *messagingv1beta1.MessagingV1beta1Client + eventingV1beta1 *eventingv1beta1.EventingV1beta1Client + eventsV1alpha1 *eventsv1alpha1.EventsV1alpha1Client + eventsV1beta1 *eventsv1beta1.EventsV1beta1Client + eventsV1 *eventsv1.EventsV1Client + internalV1alpha1 *internalv1alpha1.InternalV1alpha1Client + internalV1beta1 *internalv1beta1.InternalV1beta1Client + internalV1 *internalv1.InternalV1Client + messagingV1beta1 *messagingv1beta1.MessagingV1beta1Client } // EventingV1beta1 retrieves the EventingV1beta1Client @@ -98,11 +95,6 @@ func (c *Clientset) InternalV1() internalv1.InternalV1Interface { return c.internalV1 } -// MessagingV1alpha1 retrieves the MessagingV1alpha1Client -func (c *Clientset) MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Interface { - return c.messagingV1alpha1 -} - // MessagingV1beta1 retrieves the MessagingV1beta1Client func (c *Clientset) MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface { return c.messagingV1beta1 @@ -157,10 +149,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } - cs.messagingV1alpha1, err = messagingv1alpha1.NewForConfig(&configShallowCopy) - if err != nil { - return nil, err - } cs.messagingV1beta1, err = messagingv1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -184,7 +172,6 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.internalV1alpha1 = internalv1alpha1.NewForConfigOrDie(c) cs.internalV1beta1 = internalv1beta1.NewForConfigOrDie(c) cs.internalV1 = internalv1.NewForConfigOrDie(c) - cs.messagingV1alpha1 = messagingv1alpha1.NewForConfigOrDie(c) cs.messagingV1beta1 = messagingv1beta1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) @@ -201,7 +188,6 @@ func New(c rest.Interface) *Clientset { cs.internalV1alpha1 = internalv1alpha1.New(c) cs.internalV1beta1 = internalv1beta1.New(c) cs.internalV1 = internalv1.New(c) - cs.messagingV1alpha1 = messagingv1alpha1.New(c) cs.messagingV1beta1 = messagingv1beta1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index d0e615b1a3..a2a94753a1 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -34,8 +34,6 @@ import ( fakeinternalv1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1alpha1/fake" internalv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1beta1" fakeinternalv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/intevents/v1beta1/fake" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1alpha1" - fakemessagingv1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake" messagingv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1beta1" fakemessagingv1beta1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1beta1/fake" "k8s.io/apimachinery/pkg/runtime" @@ -127,11 +125,6 @@ func (c *Clientset) InternalV1() internalv1.InternalV1Interface { return &fakeinternalv1.FakeInternalV1{Fake: &c.Fake} } -// MessagingV1alpha1 retrieves the MessagingV1alpha1Client -func (c *Clientset) MessagingV1alpha1() messagingv1alpha1.MessagingV1alpha1Interface { - return &fakemessagingv1alpha1.FakeMessagingV1alpha1{Fake: &c.Fake} -} - // MessagingV1beta1 retrieves the MessagingV1beta1Client func (c *Clientset) MessagingV1beta1() messagingv1beta1.MessagingV1beta1Interface { return &fakemessagingv1beta1.FakeMessagingV1beta1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index b38c0d71a7..bb064b765e 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -26,7 +26,6 @@ import ( internalv1 "github.com/google/knative-gcp/pkg/apis/intevents/v1" internalv1alpha1 "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" internalv1beta1 "github.com/google/knative-gcp/pkg/apis/intevents/v1beta1" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" messagingv1beta1 "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -46,7 +45,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ internalv1alpha1.AddToScheme, internalv1beta1.AddToScheme, internalv1.AddToScheme, - messagingv1alpha1.AddToScheme, messagingv1beta1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index e86aff051b..83fc83bcab 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -26,7 +26,6 @@ import ( internalv1 "github.com/google/knative-gcp/pkg/apis/intevents/v1" internalv1alpha1 "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" internalv1beta1 "github.com/google/knative-gcp/pkg/apis/intevents/v1beta1" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" messagingv1beta1 "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -46,7 +45,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ internalv1alpha1.AddToScheme, internalv1beta1.AddToScheme, internalv1.AddToScheme, - messagingv1alpha1.AddToScheme, messagingv1beta1.AddToScheme, } diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/channel.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/channel.go deleted file mode 100644 index 9af4c62493..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/channel.go +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 ( - "context" - "time" - - v1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" - scheme "github.com/google/knative-gcp/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" -) - -// ChannelsGetter has a method to return a ChannelInterface. -// A group's client should implement this interface. -type ChannelsGetter interface { - Channels(namespace string) ChannelInterface -} - -// ChannelInterface has methods to work with Channel resources. -type ChannelInterface interface { - Create(ctx context.Context, channel *v1alpha1.Channel, opts v1.CreateOptions) (*v1alpha1.Channel, error) - Update(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (*v1alpha1.Channel, error) - UpdateStatus(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (*v1alpha1.Channel, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Channel, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ChannelList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Channel, err error) - ChannelExpansion -} - -// channels implements ChannelInterface -type channels struct { - client rest.Interface - ns string -} - -// newChannels returns a Channels -func newChannels(c *MessagingV1alpha1Client, namespace string) *channels { - return &channels{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the channel, and returns the corresponding channel object, and an error if there is any. -func (c *channels) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Channel, err error) { - result = &v1alpha1.Channel{} - err = c.client.Get(). - Namespace(c.ns). - Resource("channels"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(ctx). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Channels that match those selectors. -func (c *channels) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ChannelList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1alpha1.ChannelList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("channels"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(ctx). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested channels. -func (c *channels) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("channels"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch(ctx) -} - -// Create takes the representation of a channel and creates it. Returns the server's representation of the channel, and an error, if there is any. -func (c *channels) Create(ctx context.Context, channel *v1alpha1.Channel, opts v1.CreateOptions) (result *v1alpha1.Channel, err error) { - result = &v1alpha1.Channel{} - err = c.client.Post(). - Namespace(c.ns). - Resource("channels"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(channel). - Do(ctx). - Into(result) - return -} - -// Update takes the representation of a channel and updates it. Returns the server's representation of the channel, and an error, if there is any. -func (c *channels) Update(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (result *v1alpha1.Channel, err error) { - result = &v1alpha1.Channel{} - err = c.client.Put(). - Namespace(c.ns). - Resource("channels"). - Name(channel.Name). - VersionedParams(&opts, scheme.ParameterCodec). - Body(channel). - Do(ctx). - 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 *channels) UpdateStatus(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (result *v1alpha1.Channel, err error) { - result = &v1alpha1.Channel{} - err = c.client.Put(). - Namespace(c.ns). - Resource("channels"). - Name(channel.Name). - SubResource("status"). - VersionedParams(&opts, scheme.ParameterCodec). - Body(channel). - Do(ctx). - Into(result) - return -} - -// Delete takes name of the channel and deletes it. Returns an error if one occurs. -func (c *channels) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("channels"). - Name(name). - Body(&opts). - Do(ctx). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *channels) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - var timeout time.Duration - if listOpts.TimeoutSeconds != nil { - timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("channels"). - VersionedParams(&listOpts, scheme.ParameterCodec). - Timeout(timeout). - Body(&opts). - Do(ctx). - Error() -} - -// Patch applies the patch and returns the patched channel. -func (c *channels) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Channel, err error) { - result = &v1alpha1.Channel{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("channels"). - Name(name). - SubResource(subresources...). - VersionedParams(&opts, scheme.ParameterCodec). - Body(data). - Do(ctx). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/doc.go deleted file mode 100644 index 97ff870da8..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 Google LLC - -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/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/doc.go deleted file mode 100644 index cc740d3ffd..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 fake has the automatically generated clients. -package fake diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_channel.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_channel.go deleted file mode 100644 index bc0368272a..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_channel.go +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 fake - -import ( - "context" - - v1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeChannels implements ChannelInterface -type FakeChannels struct { - Fake *FakeMessagingV1alpha1 - ns string -} - -var channelsResource = schema.GroupVersionResource{Group: "messaging.cloud.google.com", Version: "v1alpha1", Resource: "channels"} - -var channelsKind = schema.GroupVersionKind{Group: "messaging.cloud.google.com", Version: "v1alpha1", Kind: "Channel"} - -// Get takes name of the channel, and returns the corresponding channel object, and an error if there is any. -func (c *FakeChannels) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Channel, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(channelsResource, c.ns, name), &v1alpha1.Channel{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Channel), err -} - -// List takes label and field selectors, and returns the list of Channels that match those selectors. -func (c *FakeChannels) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ChannelList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(channelsResource, channelsKind, c.ns, opts), &v1alpha1.ChannelList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.ChannelList{ListMeta: obj.(*v1alpha1.ChannelList).ListMeta} - for _, item := range obj.(*v1alpha1.ChannelList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested channels. -func (c *FakeChannels) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(channelsResource, c.ns, opts)) - -} - -// Create takes the representation of a channel and creates it. Returns the server's representation of the channel, and an error, if there is any. -func (c *FakeChannels) Create(ctx context.Context, channel *v1alpha1.Channel, opts v1.CreateOptions) (result *v1alpha1.Channel, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(channelsResource, c.ns, channel), &v1alpha1.Channel{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Channel), err -} - -// Update takes the representation of a channel and updates it. Returns the server's representation of the channel, and an error, if there is any. -func (c *FakeChannels) Update(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (result *v1alpha1.Channel, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(channelsResource, c.ns, channel), &v1alpha1.Channel{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Channel), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeChannels) UpdateStatus(ctx context.Context, channel *v1alpha1.Channel, opts v1.UpdateOptions) (*v1alpha1.Channel, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(channelsResource, "status", c.ns, channel), &v1alpha1.Channel{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Channel), err -} - -// Delete takes name of the channel and deletes it. Returns an error if one occurs. -func (c *FakeChannels) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(channelsResource, c.ns, name), &v1alpha1.Channel{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeChannels) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(channelsResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.ChannelList{}) - return err -} - -// Patch applies the patch and returns the patched channel. -func (c *FakeChannels) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Channel, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(channelsResource, c.ns, name, pt, data, subresources...), &v1alpha1.Channel{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.Channel), err -} diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_messaging_client.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_messaging_client.go deleted file mode 100644 index ed4befd7d1..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/fake/fake_messaging_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 fake - -import ( - v1alpha1 "github.com/google/knative-gcp/pkg/client/clientset/versioned/typed/messaging/v1alpha1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeMessagingV1alpha1 struct { - *testing.Fake -} - -func (c *FakeMessagingV1alpha1) Channels(namespace string) v1alpha1.ChannelInterface { - return &FakeChannels{c, namespace} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeMessagingV1alpha1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/generated_expansion.go deleted file mode 100644 index 6320ea88fe..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/generated_expansion.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 ChannelExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/messaging_client.go b/pkg/client/clientset/versioned/typed/messaging/v1alpha1/messaging_client.go deleted file mode 100644 index 82e875b5d4..0000000000 --- a/pkg/client/clientset/versioned/typed/messaging/v1alpha1/messaging_client.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2020 Google LLC - -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/google/knative-gcp/pkg/apis/messaging/v1alpha1" - "github.com/google/knative-gcp/pkg/client/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type MessagingV1alpha1Interface interface { - RESTClient() rest.Interface - ChannelsGetter -} - -// MessagingV1alpha1Client is used to interact with features provided by the messaging.cloud.google.com group. -type MessagingV1alpha1Client struct { - restClient rest.Interface -} - -func (c *MessagingV1alpha1Client) Channels(namespace string) ChannelInterface { - return newChannels(c, namespace) -} - -// NewForConfig creates a new MessagingV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*MessagingV1alpha1Client, error) { - config := *c - if err := setConfigDefaults(&config); err != nil { - return nil, err - } - client, err := rest.RESTClientFor(&config) - if err != nil { - return nil, err - } - return &MessagingV1alpha1Client{client}, nil -} - -// NewForConfigOrDie creates a new MessagingV1alpha1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *MessagingV1alpha1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new MessagingV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *MessagingV1alpha1Client { - return &MessagingV1alpha1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1alpha1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() - - 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 *MessagingV1alpha1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 0bdf41786a..408182b564 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -28,7 +28,6 @@ import ( inteventsv1 "github.com/google/knative-gcp/pkg/apis/intevents/v1" inteventsv1alpha1 "github.com/google/knative-gcp/pkg/apis/intevents/v1alpha1" inteventsv1beta1 "github.com/google/knative-gcp/pkg/apis/intevents/v1beta1" - messagingv1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" messagingv1beta1 "github.com/google/knative-gcp/pkg/apis/messaging/v1beta1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" @@ -122,10 +121,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case inteventsv1beta1.SchemeGroupVersion.WithResource("topics"): return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1beta1().Topics().Informer()}, nil - // Group=messaging.cloud.google.com, Version=v1alpha1 - case messagingv1alpha1.SchemeGroupVersion.WithResource("channels"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1alpha1().Channels().Informer()}, nil - // Group=messaging.cloud.google.com, Version=v1beta1 case messagingv1beta1.SchemeGroupVersion.WithResource("channels"): return &genericInformer{resource: resource.GroupResource(), informer: f.Messaging().V1beta1().Channels().Informer()}, nil diff --git a/pkg/client/informers/externalversions/messaging/interface.go b/pkg/client/informers/externalversions/messaging/interface.go index 74516c5b15..4b78df362d 100644 --- a/pkg/client/informers/externalversions/messaging/interface.go +++ b/pkg/client/informers/externalversions/messaging/interface.go @@ -20,14 +20,11 @@ package messaging import ( internalinterfaces "github.com/google/knative-gcp/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/google/knative-gcp/pkg/client/informers/externalversions/messaging/v1alpha1" v1beta1 "github.com/google/knative-gcp/pkg/client/informers/externalversions/messaging/v1beta1" ) // Interface provides access to each of this group's versions. type Interface interface { - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -43,11 +40,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) -} - // V1beta1 returns a new v1beta1.Interface. func (g *group) V1beta1() v1beta1.Interface { return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/pkg/client/informers/externalversions/messaging/v1alpha1/channel.go b/pkg/client/informers/externalversions/messaging/v1alpha1/channel.go deleted file mode 100644 index 37626b00a7..0000000000 --- a/pkg/client/informers/externalversions/messaging/v1alpha1/channel.go +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - time "time" - - messagingv1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" - versioned "github.com/google/knative-gcp/pkg/client/clientset/versioned" - internalinterfaces "github.com/google/knative-gcp/pkg/client/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/google/knative-gcp/pkg/client/listers/messaging/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// ChannelInformer provides access to a shared informer and lister for -// Channels. -type ChannelInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1alpha1.ChannelLister -} - -type channelInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewChannelInformer constructs a new informer for Channel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredChannelInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredChannelInformer constructs a new informer for Channel type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredChannelInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1alpha1().Channels(namespace).List(context.TODO(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MessagingV1alpha1().Channels(namespace).Watch(context.TODO(), options) - }, - }, - &messagingv1alpha1.Channel{}, - resyncPeriod, - indexers, - ) -} - -func (f *channelInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredChannelInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *channelInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&messagingv1alpha1.Channel{}, f.defaultInformer) -} - -func (f *channelInformer) Lister() v1alpha1.ChannelLister { - return v1alpha1.NewChannelLister(f.Informer().GetIndexer()) -} diff --git a/pkg/client/informers/externalversions/messaging/v1alpha1/interface.go b/pkg/client/informers/externalversions/messaging/v1alpha1/interface.go deleted file mode 100644 index e9cee1290f..0000000000 --- a/pkg/client/informers/externalversions/messaging/v1alpha1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - internalinterfaces "github.com/google/knative-gcp/pkg/client/informers/externalversions/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // Channels returns a ChannelInformer. - Channels() ChannelInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// Channels returns a ChannelInformer. -func (v *version) Channels() ChannelInformer { - return &channelInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/pkg/client/injection/informers/messaging/v1alpha1/channel/channel.go b/pkg/client/injection/informers/messaging/v1alpha1/channel/channel.go deleted file mode 100644 index 6cc1aa9813..0000000000 --- a/pkg/client/injection/informers/messaging/v1alpha1/channel/channel.go +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 injection-gen. DO NOT EDIT. - -package channel - -import ( - context "context" - - v1alpha1 "github.com/google/knative-gcp/pkg/client/informers/externalversions/messaging/v1alpha1" - factory "github.com/google/knative-gcp/pkg/client/injection/informers/factory" - controller "knative.dev/pkg/controller" - injection "knative.dev/pkg/injection" - logging "knative.dev/pkg/logging" -) - -func init() { - injection.Default.RegisterInformer(withInformer) -} - -// Key is used for associating the Informer inside the context.Context. -type Key struct{} - -func withInformer(ctx context.Context) (context.Context, controller.Informer) { - f := factory.Get(ctx) - inf := f.Messaging().V1alpha1().Channels() - return context.WithValue(ctx, Key{}, inf), inf.Informer() -} - -// Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha1.ChannelInformer { - untyped := ctx.Value(Key{}) - if untyped == nil { - logging.FromContext(ctx).Panic( - "Unable to fetch github.com/google/knative-gcp/pkg/client/informers/externalversions/messaging/v1alpha1.ChannelInformer from context.") - } - return untyped.(v1alpha1.ChannelInformer) -} diff --git a/pkg/client/injection/informers/messaging/v1alpha1/channel/fake/fake.go b/pkg/client/injection/informers/messaging/v1alpha1/channel/fake/fake.go deleted file mode 100644 index 94c2e9c417..0000000000 --- a/pkg/client/injection/informers/messaging/v1alpha1/channel/fake/fake.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 injection-gen. DO NOT EDIT. - -package fake - -import ( - context "context" - - fake "github.com/google/knative-gcp/pkg/client/injection/informers/factory/fake" - channel "github.com/google/knative-gcp/pkg/client/injection/informers/messaging/v1alpha1/channel" - controller "knative.dev/pkg/controller" - injection "knative.dev/pkg/injection" -) - -var Get = channel.Get - -func init() { - injection.Fake.RegisterInformer(withInformer) -} - -func withInformer(ctx context.Context) (context.Context, controller.Informer) { - f := fake.Get(ctx) - inf := f.Messaging().V1alpha1().Channels() - return context.WithValue(ctx, channel.Key{}, inf), inf.Informer() -} diff --git a/pkg/client/listers/messaging/v1alpha1/channel.go b/pkg/client/listers/messaging/v1alpha1/channel.go deleted file mode 100644 index a7376d0283..0000000000 --- a/pkg/client/listers/messaging/v1alpha1/channel.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 lister-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1alpha1 "github.com/google/knative-gcp/pkg/apis/messaging/v1alpha1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ChannelLister helps list Channels. -type ChannelLister interface { - // List lists all Channels in the indexer. - List(selector labels.Selector) (ret []*v1alpha1.Channel, err error) - // Channels returns an object that can list and get Channels. - Channels(namespace string) ChannelNamespaceLister - ChannelListerExpansion -} - -// channelLister implements the ChannelLister interface. -type channelLister struct { - indexer cache.Indexer -} - -// NewChannelLister returns a new ChannelLister. -func NewChannelLister(indexer cache.Indexer) ChannelLister { - return &channelLister{indexer: indexer} -} - -// List lists all Channels in the indexer. -func (s *channelLister) List(selector labels.Selector) (ret []*v1alpha1.Channel, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Channel)) - }) - return ret, err -} - -// Channels returns an object that can list and get Channels. -func (s *channelLister) Channels(namespace string) ChannelNamespaceLister { - return channelNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ChannelNamespaceLister helps list and get Channels. -type ChannelNamespaceLister interface { - // List lists all Channels in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha1.Channel, err error) - // Get retrieves the Channel from the indexer for a given namespace and name. - Get(name string) (*v1alpha1.Channel, error) - ChannelNamespaceListerExpansion -} - -// channelNamespaceLister implements the ChannelNamespaceLister -// interface. -type channelNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Channels in the indexer for a given namespace. -func (s channelNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Channel, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.Channel)) - }) - return ret, err -} - -// Get retrieves the Channel from the indexer for a given namespace and name. -func (s channelNamespaceLister) Get(name string) (*v1alpha1.Channel, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha1.Resource("channel"), name) - } - return obj.(*v1alpha1.Channel), nil -} diff --git a/pkg/client/listers/messaging/v1alpha1/expansion_generated.go b/pkg/client/listers/messaging/v1alpha1/expansion_generated.go deleted file mode 100644 index df89b943c1..0000000000 --- a/pkg/client/listers/messaging/v1alpha1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 2020 Google LLC - -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 lister-gen. DO NOT EDIT. - -package v1alpha1 - -// ChannelListerExpansion allows custom methods to be added to -// ChannelLister. -type ChannelListerExpansion interface{} - -// ChannelNamespaceListerExpansion allows custom methods to be added to -// ChannelNamespaceLister. -type ChannelNamespaceListerExpansion interface{} diff --git a/test/conformance/main_test.go b/test/conformance/main_test.go index 333562af05..bda274c967 100644 --- a/test/conformance/main_test.go +++ b/test/conformance/main_test.go @@ -56,14 +56,6 @@ func TestMain(m *testing.M) { // ChannelFeatureMap saves the channel-features mapping. // Each pair means the channel support the given list of features. ComponentFeatureMap: map[metav1.TypeMeta][]eventingtestlib.Feature{ - { - APIVersion: resources.MessagingAPIVersion, - Kind: "Channel", - }: { - eventingtestlib.FeatureBasic, - eventingtestlib.FeatureRedelivery, - eventingtestlib.FeaturePersistence, - }, { APIVersion: resources.MessagingV1beta1APIVersion, Kind: "Channel", diff --git a/test/e2e-conformance-tests.sh b/test/e2e-conformance-tests.sh index 7bdf11242c..1acd71fffb 100755 --- a/test/e2e-conformance-tests.sh +++ b/test/e2e-conformance-tests.sh @@ -26,7 +26,7 @@ fi initialize $@ go_test_e2e -timeout=30m -parallel=12 ./test/conformance \ - -channels='messaging.cloud.google.com/v1alpha1:Channel,messaging.cloud.google.com/v1beta1:Channel' \ + -channels='messaging.cloud.google.com/v1beta1:Channel' \ || fail_test success diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 3d9b9b1cb2..9d05c54b5a 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -26,7 +26,7 @@ fi initialize $@ go_test_e2e -timeout=30m -parallel=12 ./test/e2e \ - -channels='messaging.cloud.google.com/v1alpha1:Channel,messaging.cloud.google.com/v1beta1:Channel' \ + -channels='messaging.cloud.google.com/v1beta1:Channel' \ || fail_test success diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index e20c217198..1a75fc9379 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -56,14 +56,6 @@ func TestMain(m *testing.M) { // ChannelFeatureMap saves the channel-features mapping. // Each pair means the channel support the given list of features. ComponentFeatureMap: map[metav1.TypeMeta][]eventingtestlib.Feature{ - { - APIVersion: resources.MessagingAPIVersion, - Kind: "Channel", - }: { - eventingtestlib.FeatureBasic, - eventingtestlib.FeatureRedelivery, - eventingtestlib.FeaturePersistence, - }, { APIVersion: resources.MessagingV1beta1APIVersion, Kind: "Channel", diff --git a/test/lib/resources/constants.go b/test/lib/resources/constants.go index b437c039a7..e84d4992b0 100644 --- a/test/lib/resources/constants.go +++ b/test/lib/resources/constants.go @@ -21,7 +21,6 @@ import "time" // API versions for the resources. const ( BatchAPIVersion = "batch/v1" - MessagingAPIVersion = "messaging.cloud.google.com/v1alpha1" MessagingV1beta1APIVersion = "messaging.cloud.google.com/v1beta1" EventsV1APIVersion = "events.cloud.google.com/v1" EventsV1beta1APIVersion = "events.cloud.google.com/v1beta1" diff --git a/test/lib/typemetas.go b/test/lib/typemetas.go index 62f59a8c71..3a153f2011 100644 --- a/test/lib/typemetas.go +++ b/test/lib/typemetas.go @@ -45,7 +45,7 @@ var ChannelTypeMeta = messagingTypeMeta(resources.ChannelKind) func messagingTypeMeta(kind string) *metav1.TypeMeta { return &metav1.TypeMeta{ Kind: kind, - APIVersion: resources.MessagingAPIVersion, + APIVersion: resources.MessagingV1beta1APIVersion, } }