-
Notifications
You must be signed in to change notification settings - Fork 604
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
Reconcile ET properly with no reference #7423
Changes from all commits
d6a98e3
d40cd1b
3f28384
dd41e9b
9cfa2fa
56346e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,16 @@ import ( | |
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"knative.dev/eventing/pkg/apis/eventing/v1beta2" | ||
"knative.dev/eventing/pkg/apis/eventing/v1beta3" | ||
"knative.dev/pkg/apis" | ||
) | ||
|
||
// EventTypeOption enables further configuration of an EventType. | ||
type EventTypeOption func(*v1beta2.EventType) | ||
type EventTypeOption func(*v1beta3.EventType) | ||
|
||
// NewEventType creates a EventType with EventTypeOptions. | ||
func NewEventType(name, namespace string, o ...EventTypeOption) *v1beta2.EventType { | ||
et := &v1beta2.EventType{ | ||
func NewEventType(name, namespace string, o ...EventTypeOption) *v1beta3.EventType { | ||
et := &v1beta3.EventType{ | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should land in new package There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to update this either in this PR or a separate PR if we want, but this file seemed to be using |
||
ObjectMeta: metav1.ObjectMeta{ | ||
Namespace: namespace, | ||
Name: name, | ||
|
@@ -46,59 +46,63 @@ func NewEventType(name, namespace string, o ...EventTypeOption) *v1beta2.EventTy | |
} | ||
|
||
// WithInitEventTypeConditions initializes the EventType's conditions. | ||
func WithInitEventTypeConditions(et *v1beta2.EventType) { | ||
func WithInitEventTypeConditions(et *v1beta3.EventType) { | ||
et.Status.InitializeConditions() | ||
} | ||
|
||
func WithEventTypeSource(source *apis.URL) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.Spec.Source = source | ||
} | ||
} | ||
|
||
func WithEventTypeType(t string) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.Spec.Type = t | ||
} | ||
} | ||
|
||
func WithEventTypeReference(ref *duckv1.KReference) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.Spec.Reference = ref | ||
} | ||
} | ||
|
||
func WithEventTypeDescription(description string) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.Spec.Description = description | ||
} | ||
} | ||
|
||
func WithEventTypeLabels(labels map[string]string) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.ObjectMeta.Labels = labels | ||
} | ||
} | ||
|
||
func WithEventTypeOwnerReference(ownerRef metav1.OwnerReference) EventTypeOption { | ||
return func(et *v1beta2.EventType) { | ||
return func(et *v1beta3.EventType) { | ||
et.ObjectMeta.OwnerReferences = []metav1.OwnerReference{ | ||
ownerRef, | ||
} | ||
} | ||
} | ||
|
||
func WithEventTypeDeletionTimestamp(et *v1beta2.EventType) { | ||
func WithEventTypeDeletionTimestamp(et *v1beta3.EventType) { | ||
t := metav1.NewTime(time.Unix(1e9, 0)) | ||
et.ObjectMeta.SetDeletionTimestamp(&t) | ||
} | ||
|
||
// WithEventTypeResourceDoesNotExist calls .Status.MarkFilterFailed on the EventType. | ||
func WithEventTypeResourceDoesNotExist(et *v1beta2.EventType) { | ||
func WithEventTypeResourceDoesNotExist(et *v1beta3.EventType) { | ||
et.Status.MarkReferenceDoesNotExist() | ||
} | ||
|
||
func WithEventTypeReferenceNotSet(et *v1beta3.EventType) { | ||
et.Status.MarkReferenceExistsNotSet() | ||
} | ||
|
||
// WithEventTypeResourceExists calls .Status.MarkReferenceExists on the EventType. | ||
func WithEventTypeResourceExists(et *v1beta2.EventType) { | ||
func WithEventTypeResourceExists(et *v1beta3.EventType) { | ||
et.Status.MarkReferenceExists() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having this comment here. thx