Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use v1 instead of v1beta1 and v1alpha1 #5316

Merged
merged 5 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/adapter/apiserver/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"k8s.io/client-go/dynamic"
"k8s.io/client-go/tools/cache"
"knative.dev/eventing/pkg/adapter/v2"
"knative.dev/eventing/pkg/apis/sources/v1alpha2"
v1 "knative.dev/eventing/pkg/apis/sources/v1"
)

type envConfig struct {
Expand Down Expand Up @@ -66,7 +66,7 @@ func (a *apiServerAdapter) start(ctx context.Context, stopCh <-chan struct{}) er
ce: a.ce,
source: a.source,
logger: a.logger,
ref: a.config.EventMode == v1alpha2.ReferenceMode,
ref: a.config.EventMode == v1.ReferenceMode,
}

if a.config.ResourceOwner != nil {
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/eventing/v1/trigger_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ var (
Namespace: "namespace",
Name: "subscriber_test",
Kind: "Service",
APIVersion: "serving.knative.dev/v1alpha1",
APIVersion: "serving.knative.dev/v1",
},
}
invalidSubscriber = duckv1.Destination{
Ref: &duckv1.KReference{
Namespace: "namespace",
Kind: "Service",
APIVersion: "serving.knative.dev/v1alpha1",
APIVersion: "serving.knative.dev/v1",
},
}
// Dependency annotation
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestTriggerValidation(t *testing.T) {
ObjectMeta: v1.ObjectMeta{
Namespace: "test-ns-1",
Annotations: map[string]string{
DependencyAnnotation: `{"kind":"PingSource","namespace":"test-ns-2", "name":"test-ping-source","apiVersion":"sources.knative.dev/v1alpha1"}`,
DependencyAnnotation: `{"kind":"PingSource","namespace":"test-ns-2", "name":"test-ping-source","apiVersion":"sources.knative.dev/v1beta2"}`,
}},
Spec: TriggerSpec{
Broker: "test_broker",
Expand All @@ -132,7 +132,7 @@ func TestTriggerValidation(t *testing.T) {
ObjectMeta: v1.ObjectMeta{
Namespace: "test-ns",
Annotations: map[string]string{
DependencyAnnotation: `{"name":"test-ping-source","apiVersion":"sources.knative.dev/v1alpha1"}`,
DependencyAnnotation: `{"name":"test-ping-source","apiVersion":"sources.knative.dev/v1beta2"}`,
}},
Spec: TriggerSpec{
Broker: "test_broker",
Expand All @@ -149,7 +149,7 @@ func TestTriggerValidation(t *testing.T) {
ObjectMeta: v1.ObjectMeta{
Namespace: "test-ns",
Annotations: map[string]string{
DependencyAnnotation: `{"kind":"PingSource","apiVersion":"sources.knative.dev/v1alpha1"}`,
DependencyAnnotation: `{"kind":"PingSource","apiVersion":"sources.knative.dev/v1"}`,
}},
Spec: TriggerSpec{
Broker: "test_broker",
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/flows/v1/sequence_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestSequenceGetConditionSet(t *testing.T) {
func getSubscription(name string, ready bool) *messagingv1.Subscription {
s := messagingv1.Subscription{
TypeMeta: metav1.TypeMeta{
APIVersion: "eventing.knative.dev/v1alpha1",
APIVersion: "messaging.knative.dev/v1",
Kind: "Subscription",
},
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestSequencePropagateSubscriptionStatuses(t *testing.T) {
name: "empty status",
subs: []*messagingv1.Subscription{{
TypeMeta: metav1.TypeMeta{
APIVersion: "eventing.knative.dev/v1alpha1",
APIVersion: "messaging.knative.dev/v1",
Kind: "Subscription",
},
ObjectMeta: metav1.ObjectMeta{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var validationTests = []struct {
name: "valid object ref",
ref: corev1.ObjectReference{
Name: "boaty-mcboatface",
APIVersion: "messaging.knative.dev/v1alpha1",
APIVersion: "messaging.knative.dev/v1",
Kind: "MyChannel",
},
want: nil,
Expand All @@ -42,7 +42,7 @@ var validationTests = []struct {
name: "invalid object ref",
ref: corev1.ObjectReference{
Name: "boaty-mcboatface",
APIVersion: "messaging.knative.dev/v1alpha1",
APIVersion: "messaging.knative.dev/v1",
Kind: "",
},
want: apis.ErrMissingField("kind"),
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/sources/v1/apiserver_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestApiServerSourceDefaults(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -68,7 +68,7 @@ func TestApiServerSourceDefaults(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -92,7 +92,7 @@ func TestApiServerSourceDefaults(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -115,7 +115,7 @@ func TestApiServerSourceDefaults(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/sources/v1/apiserver_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -99,7 +99,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -117,7 +117,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -136,7 +136,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand All @@ -159,7 +159,7 @@ func TestAPIServerValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1alpha1",
APIVersion: "v1",
Kind: "broker",
Name: "default",
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/sources/v1/container_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestContainerSourceValidation(t *testing.T) {
SourceSpec: duckv1.SourceSpec{
Sink: duckv1.Destination{
Ref: &duckv1.KReference{
APIVersion: "v1beta1",
APIVersion: "v1",
Kind: "Broker",
Name: "default",
},
Expand Down
3 changes: 1 addition & 2 deletions pkg/reconciler/apiserversource/apiserversource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
reconcilersource "knative.dev/eventing/pkg/reconciler/source"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
"knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
_ "knative.dev/pkg/client/injection/ducks/duck/v1beta1/addressable/fake"
fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake"
Expand Down Expand Up @@ -93,7 +92,7 @@ func init() {
// Add types to scheme
_ = appsv1.AddToScheme(scheme.Scheme)
_ = corev1.AddToScheme(scheme.Scheme)
_ = duckv1alpha1.AddToScheme(scheme.Scheme)
_ = duckv1.AddToScheme(scheme.Scheme)
}

func TestReconcile(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/broker/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestOurConfig(t *testing.T) {
want: &Config{
DefaultChannelTemplate: messagingv1.ChannelTemplateSpec{
TypeMeta: metav1.TypeMeta{
APIVersion: "messaging.knative.dev/v1alpha1",
APIVersion: "messaging.knative.dev/v1",
Kind: "InMemoryChannel",
},
Spec: &exampleSpec,
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/broker/testdata/config-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data:
channelTemplateSpec: |
# The api and version of the kind of channel to use inthe broker.
# This field required.
apiVersion: messaging.knative.dev/v1alpha1
apiVersion: messaging.knative.dev/v1

# The api and version of the kind of channel to use inthe broker.
# This field required.
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/parallel/parallel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const (

var (
subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Version: "v1alpha1",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/sequence/sequence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const (

var (
subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Version: "v1alpha1",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}
)
Expand Down
25 changes: 12 additions & 13 deletions pkg/reconciler/subscription/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
clientgotesting "k8s.io/client-go/testing"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
"knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
"knative.dev/pkg/configmap"
"knative.dev/pkg/controller"
Expand Down Expand Up @@ -95,14 +94,14 @@ var (
dlc2DNS = "dlc2.mynamespace.svc." + network.GetClusterDomainName()

subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Version: "v1alpha1",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}

nonAddressableGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Version: "v1alpha1",
Version: "v1",
Kind: "Trigger",
}

Expand Down Expand Up @@ -134,7 +133,7 @@ var (
func init() {
// Add types to scheme
_ = eventingv1.AddToScheme(scheme.Scheme)
_ = duckv1alpha1.AddToScheme(scheme.Scheme)
_ = duckv1.AddToScheme(scheme.Scheme)
_ = apiextensionsv1.AddToScheme(scheme.Scheme)
_ = messagingv1.AddToScheme(scheme.Scheme)
}
Expand Down Expand Up @@ -294,7 +293,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:messaging.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -303,7 +302,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionSubscriberRef(subscriberGVK, subscriberName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:messaging.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand All @@ -325,7 +324,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: subscribers.eventing.knative.dev %q not found", subscriberName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: subscribers.messaging.knative.dev %q not found", subscriberName),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -334,7 +333,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionSubscriberRef(subscriberGVK, subscriberName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, `Failed to resolve spec.subscriber: subscribers.eventing.knative.dev "subscriber" not found`),
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, `Failed to resolve spec.subscriber: subscribers.messaging.knative.dev "subscriber" not found`),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand Down Expand Up @@ -397,7 +396,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
Eventf(corev1.EventTypeWarning, replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -408,7 +407,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionReply(nonAddressableGVK, replyName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
WithSubscriptionReferencesNotResolved(replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand Down Expand Up @@ -478,7 +477,7 @@ func TestAllCases(t *testing.T) {
WantErr: false,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.eventing.knative.dev "dlc" not found`),
Eventf(corev1.EventTypeWarning, "DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.messaging.knative.dev "dlc" not found`),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -488,7 +487,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionDeliveryRef(subscriberGVK, dlcName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved("DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.eventing.knative.dev "dlc" not found`),
WithSubscriptionReferencesNotResolved("DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.messaging.knative.dev "dlc" not found`),
WithSubscriptionPhysicalSubscriptionSubscriber(subscriberURI),
),
}},
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/testing/listers.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ import (
)

var subscriberAddToScheme = func(scheme *runtime.Scheme) error {
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.eventing.knative.dev", Version: "v1alpha1", Kind: "Subscriber"}, &unstructured.Unstructured{})
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.eventing.knative.dev", Version: "v1", Kind: "Subscriber"}, &unstructured.Unstructured{})
return nil
}

var sourceAddToScheme = func(scheme *runtime.Scheme) error {
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.sources.knative.dev", Version: "v1alpha1", Kind: "TestSource"}, &duckv1.Source{})
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.sources.knative.dev", Version: "v1", Kind: "TestSource"}, &duckv1.Source{})
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/testing/v1/listers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ import (
)

var subscriberAddToScheme = func(scheme *runtime.Scheme) error {
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.eventing.knative.dev", Version: "v1alpha1", Kind: "Subscriber"}, &unstructured.Unstructured{})
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.eventing.knative.dev", Version: "v1", Kind: "Subscriber"}, &unstructured.Unstructured{})
return nil
}

var sourceAddToScheme = func(scheme *runtime.Scheme) error {
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.sources.knative.dev", Version: "v1alpha1", Kind: "TestSource"}, &duckv1.Source{})
scheme.AddKnownTypeWithName(schema.GroupVersionKind{Group: "testing.sources.knative.dev", Version: "v1", Kind: "TestSource"}, &duckv1.Source{})
return nil
}

Expand Down