Repository: triggermesh/aws-event-sources
Pull request #191 (2020-08-17 14:16:15)

Allow setting the ConditionSet used in status updater
Mirror PR of https://github.com/triggermesh/knative-sources/pull/80.


Patch:
diff --git a/pkg/apis/sources/v1alpha1/awscodecommit_lifecycle.go b/pkg/apis/sources/v1alpha1/awscodecommit_lifecycle.go
index 8b59e5e..ec0edbc 100644
--- a/pkg/apis/sources/v1alpha1/awscodecommit_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awscodecommit_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSCodeCommitSource) GetGroupVersionKind() schema.GroupVersionKind {
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSCodeCommitSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSCodeCommitSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSCodeCommitSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSCodeCommitSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // GetEventTypes implements EventSource.
diff --git a/pkg/apis/sources/v1alpha1/awscognitoidentity_lifecycle.go b/pkg/apis/sources/v1alpha1/awscognitoidentity_lifecycle.go
index f517e4a..3876c98 100644
--- a/pkg/apis/sources/v1alpha1/awscognitoidentity_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awscognitoidentity_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSCognitoIdentitySource) GetGroupVersionKind() schema.GroupVersionKind
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSCognitoIdentitySource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSCognitoIdentitySource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSCognitoIdentitySource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSCognitoIdentitySource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // Supported event types
diff --git a/pkg/apis/sources/v1alpha1/awscognitouserpool_lifecycle.go b/pkg/apis/sources/v1alpha1/awscognitouserpool_lifecycle.go
index f81855f..087370a 100644
--- a/pkg/apis/sources/v1alpha1/awscognitouserpool_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awscognitouserpool_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSCognitoUserPoolSource) GetGroupVersionKind() schema.GroupVersionKind
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSCognitoUserPoolSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSCognitoUserPoolSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSCognitoUserPoolSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSCognitoUserPoolSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // Supported event types
diff --git a/pkg/apis/sources/v1alpha1/awsdynamodb_lifecycle.go b/pkg/apis/sources/v1alpha1/awsdynamodb_lifecycle.go
index 63f806f..a2ca306 100644
--- a/pkg/apis/sources/v1alpha1/awsdynamodb_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awsdynamodb_lifecycle.go
@@ -34,7 +34,7 @@ func (s *AWSDynamoDBSource) GetGroupVersionKind() schema.GroupVersionKind {
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSDynamoDBSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -47,9 +47,12 @@ func (s *AWSDynamoDBSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSDynamoDBSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSDynamoDBSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // GetEventTypes implements EventSource.
diff --git a/pkg/apis/sources/v1alpha1/awsiot_lifecycle.go b/pkg/apis/sources/v1alpha1/awsiot_lifecycle.go
index 06153ee..0891e72 100644
--- a/pkg/apis/sources/v1alpha1/awsiot_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awsiot_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSIoTSource) GetGroupVersionKind() schema.GroupVersionKind {
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSIoTSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSIoTSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSIoTSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSIoTSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // Supported event types
diff --git a/pkg/apis/sources/v1alpha1/awskinesis_lifecycle.go b/pkg/apis/sources/v1alpha1/awskinesis_lifecycle.go
index 4e05343..e58a691 100644
--- a/pkg/apis/sources/v1alpha1/awskinesis_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awskinesis_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSKinesisSource) GetGroupVersionKind() schema.GroupVersionKind {
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSKinesisSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSKinesisSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSKinesisSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSKinesisSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // Supported event types
diff --git a/pkg/apis/sources/v1alpha1/awssns_lifecycle.go b/pkg/apis/sources/v1alpha1/awssns_lifecycle.go
index adde4ec..16a900e 100644
--- a/pkg/apis/sources/v1alpha1/awssns_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awssns_lifecycle.go
@@ -48,9 +48,12 @@ func (s *AWSSNSSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSSNSSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status.EventSourceStatus
+// GetStatusManager implements EventSource.
+func (s *AWSSNSSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status.EventSourceStatus,
+	}
 }
 
 // Supported event types
@@ -90,7 +93,7 @@ const (
 )
 
 // awsSNSSourceConditionSet is a set of conditions for AWSSNSSource objects.
-var awsSNSSourceConditionSet = apis.NewLivingConditionSet(
+var awsSNSSourceConditionSet = NewEventSourceConditionSet(
 	AWSSNSConditionSubscribed,
 )
 
diff --git a/pkg/apis/sources/v1alpha1/awssqs_lifecycle.go b/pkg/apis/sources/v1alpha1/awssqs_lifecycle.go
index 51874c2..1ff0a41 100644
--- a/pkg/apis/sources/v1alpha1/awssqs_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/awssqs_lifecycle.go
@@ -30,7 +30,7 @@ func (s *AWSSQSSource) GetGroupVersionKind() schema.GroupVersionKind {
 
 // GetConditionSet implements duckv1.KRShaped.
 func (s *AWSSQSSource) GetConditionSet() apis.ConditionSet {
-	return awsEventSourceConditionSet
+	return eventSourceConditionSet
 }
 
 // GetStatus implements duckv1.KRShaped.
@@ -43,9 +43,12 @@ func (s *AWSSQSSource) GetSink() *duckv1.Destination {
 	return &s.Spec.Sink
 }
 
-// GetSourceStatus implements EventSource.
-func (s *AWSSQSSource) GetSourceStatus() *EventSourceStatus {
-	return &s.Status
+// GetStatusManager implements EventSource.
+func (s *AWSSQSSource) GetStatusManager() *EventSourceStatusManager {
+	return &EventSourceStatusManager{
+		ConditionSet:      s.GetConditionSet(),
+		EventSourceStatus: &s.Status,
+	}
 }
 
 // Supported event types
diff --git a/pkg/apis/sources/v1alpha1/common_lifecycle.go b/pkg/apis/sources/v1alpha1/common_lifecycle.go
index d335676..f40334e 100644
--- a/pkg/apis/sources/v1alpha1/common_lifecycle.go
+++ b/pkg/apis/sources/v1alpha1/common_lifecycle.go
@@ -39,33 +39,47 @@ func AWSEventType(awsService, eventType string) string {
 	return "com.amazon." + awsService + "." + eventType
 }
 
-// awsEventSourceConditionSet is a common set of conditions for AWS event
-// sources objects.
-var awsEventSourceConditionSet = apis.NewLivingConditionSet(
+// eventSourceConditionSet is a generic set of status conditions used by
+// default in all event sources.
+var eventSourceConditionSet = NewEventSourceConditionSet()
+
+// NewEventSourceConditionSet returns a set of status conditions for an event
+// source. Default conditions can be augmented by passing condition types as
+// function arguments.
+func NewEventSourceConditionSet(cts ...apis.ConditionType) apis.ConditionSet {
+	return apis.NewLivingConditionSet(
+		append(eventSourceConditionTypes, cts...)...,
+	)
+}
+
+// eventSourceConditionTypes is a list of condition types common to all event
+// sources.
+var eventSourceConditionTypes = []apis.ConditionType{
 	ConditionSinkProvided,
 	ConditionDeployed,
-)
+}
 
-// InitializeConditions sets relevant unset conditions to Unknown state.
-func (s *EventSourceStatus) InitializeConditions() {
-	awsEventSourceConditionSet.Manage(s).InitializeConditions()
+// EventSourceStatusManager manages the status of event sources.
+type EventSourceStatusManager struct {
+	apis.ConditionSet
+	*EventSourceStatus
 }
 
 // MarkSink sets the SinkProvided condition to True using the given URI.
-func (s *EventSourceStatus) MarkSink(uri *apis.URL) {
-	s.SinkURI = uri
+func (m *EventSourceStatusManager) MarkSink(uri *apis.URL) {
+	m.SinkURI = uri
 	if uri == nil {
-		awsEventSourceConditionSet.Manage(s).MarkFalse(ConditionSinkProvided,
+		m.Manage(m).MarkFalse(ConditionSinkProvided,
 			ReasonSinkEmpty, "The sink has no URI")
 		return
 	}
-	awsEventSourceConditionSet.Manage(s).MarkTrue(ConditionSinkProvided)
+	m.Manage(m).MarkTrue(ConditionSinkProvided)
 }
 
 // MarkNoSink sets the SinkProvided condition to False.
-func (s *EventSourceStatus) MarkNoSink() {
-	s.SinkURI = nil
-	awsEventSourceConditionSet.Manage(s).MarkFalse(ConditionSinkProvided,
+func (m *EventSourceStatusManager) MarkNoSink() {
+	m.SinkURI = nil
+	m.ConditionSet.Manage(m).MarkFalse(ConditionSinkProvided,
 		ReasonSinkNotFound, "The sink does not exist or its URI is not set")
 }
 
@@ -75,20 +89,20 @@ func (s *EventSourceStatus) MarkNoSink() {
 // Given an optional PodInterface, the status of dependant Pods is inspected to
 // generate a more meaningful failure reason in case of non-ready status of the
 // Deployment.
-func (s *EventSourceStatus) PropagateDeploymentAvailability(ctx context.Context,
+func (m *EventSourceStatusManager) PropagateDeploymentAvailability(ctx context.Context,
 	d *appsv1.Deployment, pi coreclientv1.PodInterface) {
 
 	// Deployments are not addressable
-	s.Address = nil
+	m.Address = nil
 
 	if d == nil {
-		awsEventSourceConditionSet.Manage(s).MarkUnknown(ConditionDeployed, ReasonUnavailable,
+		m.ConditionSet.Manage(m).MarkUnknown(ConditionDeployed, ReasonUnavailable,
 			"The status of the adapter Deployment can not be determined")
 		return
 	}
 
 	if duck.DeploymentIsAvailable(&d.Status, false) {
-		awsEventSourceConditionSet.Manage(s).MarkTrue(ConditionDeployed)
+		m.ConditionSet.Manage(m).MarkTrue(ConditionDeployed)
 		return
 	}
 
@@ -111,25 +125,25 @@ func (s *EventSourceStatus) PropagateDeploymentAvailability(ctx context.Context,
 		}
 	}
 
-	awsEventSourceConditionSet.Manage(s).MarkFalse(ConditionDeployed, reason, msg)
+	m.ConditionSet.Manage(m).MarkFalse(ConditionDeployed, reason, msg)
 }
 
 // PropagateServiceAvailability uses the readiness of the provided Service to
 // determine whether the Deployed condition should be marked as True or False.
-func (s *EventSourceStatus) PropagateServiceAvailability(ksvc *servingv1.Service) {
+func (m *EventSourceStatusManager) PropagateServiceAvailability(ksvc *servingv1.Service) {
 	if ksvc == nil {
-		awsEventSourceConditionSet.Manage(s).MarkUnknown(ConditionDeployed, ReasonUnavailable,
+		m.ConditionSet.Manage(m).MarkUnknown(ConditionDeployed, ReasonUnavailable,
 			"The status of the adapter Service can not be determined")
 		return
 	}
 
-	if s.Address == nil {
-		s.Address = &duckv1.Addressable{}
+	if m.Address == nil {
+		m.Address = &duckv1.Addressable{}
 	}
-	s.Address.URL = ksvc.Status.URL
+	m.Address.URL = ksvc.Status.URL
 
 	if ksvc.IsReady() {
-		awsEventSourceConditionSet.Manage(s).MarkTrue(ConditionDeployed)
+		m.ConditionSet.Manage(m).MarkTrue(ConditionDeployed)
 		return
 	}
 
@@ -153,5 +167,5 @@ func (s *EventSourceStatus) PropagateServiceAvailability(ksvc *servingv1.Service
 		msg += "; " + configCond.Message
 	}
 
-	awsEventSourceConditionSet.Manage(s).MarkFalse(ConditionDeployed, reason, msg)
+	m.ConditionSet.Manage(m).MarkFalse(ConditionDeployed, reason, msg)
 }
diff --git a/pkg/apis/sources/v1alpha1/interfaces.go b/pkg/apis/sources/v1alpha1/interfaces.go
index 3d1484d..8f14735 100644
--- a/pkg/apis/sources/v1alpha1/interfaces.go
+++ b/pkg/apis/sources/v1alpha1/interfaces.go
@@ -38,8 +38,8 @@ type EventSource interface {
 	duckv1.KRShaped
 	// GetSink returns the source's event sink.
 	GetSink() *duckv1.Destination
-	// GetSourceStatus returns the source's status.
-	GetSourceStatus() *EventSourceStatus
+	// GetStatusManager returns a manager for the source's status.
+	GetStatusManager() *EventSourceStatusManager
 	// GetEventTypes returns the event types generated by the source.
 	GetEventTypes() []string
 	// AsEventSource returns a unique reference to the source suitable for
diff --git a/pkg/reconciler/common/reconcile.go b/pkg/reconciler/common/reconcile.go
index 3a0626c..86c8e6d 100644
--- a/pkg/reconciler/common/reconcile.go
+++ b/pkg/reconciler/common/reconcile.go
@@ -52,15 +52,16 @@ type AdapterDeploymentBuilderFunc func(sinkURI *apis.URL) *appsv1.Deployment
 func (r *GenericDeploymentReconciler) ReconcileSource(ctx context.Context, adb AdapterDeploymentBuilderFunc) reconciler.Event {
 	src := v1alpha1.SourceFromContext(ctx)
 
-	src.GetSourceStatus().CloudEventAttributes = CreateCloudEventAttributes(src.AsEventSource(), src.GetEventTypes())
+	src.GetStatusManager().CloudEventAttributes = CreateCloudEventAttributes(
+		src.AsEventSource(), src.GetEventTypes())
 
 	sinkURI, err := r.resolveSinkURL(ctx)
 	if err != nil {
-		src.GetSourceStatus().MarkNoSink()
+		src.GetStatusManager().MarkNoSink()
 		return controller.NewPermanentError(reconciler.NewEvent(corev1.EventTypeWarning,
 			ReasonBadSinkURI, "Could not resolve sink URI: %s", err))
 	}
-	src.GetSourceStatus().MarkSink(sinkURI)
+	src.GetStatusManager().MarkSink(sinkURI)
 
 	if err := r.reconcileAdapter(ctx, adb(sinkURI)); err != nil {
 		return fmt.Errorf("failed to reconcile adapter: %w", err)
@@ -86,7 +87,7 @@ func (r *GenericDeploymentReconciler) reconcileAdapter(ctx context.Context, desi
 
 	currentAdapter, err := r.getOrCreateAdapter(ctx, desiredAdapter)
 	if err != nil {
-		src.GetSourceStatus().PropagateDeploymentAvailability(ctx, currentAdapter, r.PodClient(src.GetNamespace()))
+		src.GetStatusManager().PropagateDeploymentAvailability(ctx, currentAdapter, r.PodClient(src.GetNamespace()))
 		return err
 	}
 
@@ -94,7 +95,7 @@ func (r *GenericDeploymentReconciler) reconcileAdapter(ctx context.Context, desi
 	if err != nil {
 		return fmt.Errorf("failed to synchronize adapter Deployment: %w", err)
 	}
-	src.GetSourceStatus().PropagateDeploymentAvailability(ctx, currentAdapter, r.PodClient(src.GetNamespace()))
+	src.GetStatusManager().PropagateDeploymentAvailability(ctx, currentAdapter, r.PodClient(src.GetNamespace()))
 
 	return nil
 }
@@ -163,15 +164,16 @@ type AdapterServiceBuilderFunc func(sinkURI *apis.URL) *servingv1.Service
 func (r *GenericServiceReconciler) ReconcileSource(ctx context.Context, adb AdapterServiceBuilderFunc) reconciler.Event {
 	src := v1alpha1.SourceFromContext(ctx)
 
-	src.GetSourceStatus().CloudEventAttributes = CreateCloudEventAttributes(src.AsEventSource(), src.GetEventTypes())
+	src.GetStatusManager().CloudEventAttributes = CreateCloudEventAttributes(
+		src.AsEventSource(), src.GetEventTypes())
 
 	sinkURI, err := r.resolveSinkURL(ctx)
 	if err != nil {
-		src.GetSourceStatus().MarkNoSink()
+		src.GetStatusManager().MarkNoSink()
 		return controller.NewPermanentError(reconciler.NewEvent(corev1.EventTypeWarning,
 			ReasonBadSinkURI, "Could not resolve sink URI: %s", err))
 	}
-	src.GetSourceStatus().MarkSink(sinkURI)
+	src.GetStatusManager().MarkSink(sinkURI)
 
 	if err := r.reconcileAdapter(ctx, adb(sinkURI)); err != nil {
 		return fmt.Errorf("failed to reconcile adapter: %w", err)
@@ -197,7 +199,7 @@ func (r *GenericServiceReconciler) reconcileAdapter(ctx context.Context, desired
 
 	currentAdapter, err := r.getOrCreateAdapter(ctx, desiredAdapter)
 	if err != nil {
-		src.GetSourceStatus().PropagateServiceAvailability(currentAdapter)
+		src.GetStatusManager().PropagateServiceAvailability(currentAdapter)
 		return err
 	}
 
@@ -205,7 +207,7 @@ func (r *GenericServiceReconciler) reconcileAdapter(ctx context.Context, desired
 	if err != nil {
 		return fmt.Errorf("failed to synchronize adapter Service: %w", err)
 	}
-	src.GetSourceStatus().PropagateServiceAvailability(currentAdapter)
+	src.GetStatusManager().PropagateServiceAvailability(currentAdapter)
 
 	return nil
 }


Test patch:
diff --git a/pkg/reconciler/testing/reconcile.go b/pkg/reconciler/testing/reconcile.go
index 3897055..cd90861 100644
--- a/pkg/reconciler/testing/reconcile.go
+++ b/pkg/reconciler/testing/reconcile.go
@@ -243,7 +243,7 @@ func assertPopulatedSource(t *testing.T, src v1alpha1.EventSource) {
 
 	assert.NotEmpty(t, src.GetSink().Ref, "Provided source should reference a sink")
 	assert.NotEmpty(t, src.GetEventTypes(), "Provided source should declare its event types")
-	assert.NotEmpty(t, src.GetSourceStatus().Status.Conditions, "Provided source should have initialized conditions")
+	assert.NotEmpty(t, src.GetStatus().GetConditions(), "Provided source should have initialized conditions")
 }
 
 func nameKindAndResource(object runtime.Object) (string /*name*/, string /*kind*/, string /*resource*/) {
@@ -285,7 +285,7 @@ func Populate(srcCpy v1alpha1.EventSource) {
 	// object is initialized in the same manner, and prevents tests from wrongly reporting unexpected status updates.
 	reconciler.PreProcessReconcile(context.Background(), srcCpy)
 
-	srcCpy.GetSourceStatus().CloudEventAttributes = common.CreateCloudEventAttributes(
+	srcCpy.GetStatusManager().CloudEventAttributes = common.CreateCloudEventAttributes(
 		srcCpy.AsEventSource(), srcCpy.GetEventTypes())
 }
 
@@ -313,17 +313,17 @@ type sourceOption func(v1alpha1.EventSource)
 
 // noCEAttributes sets empty CE attributes. Simulates the creation of a new source.
 func noCEAttributes(src v1alpha1.EventSource) {
-	src.GetSourceStatus().CloudEventAttributes = nil
+	src.GetStatusManager().CloudEventAttributes = nil
 }
 
 // Sink: True
 func withSink(src v1alpha1.EventSource) {
-	src.GetSourceStatus().MarkSink(tSinkURI)
+	src.GetStatusManager().MarkSink(tSinkURI)
 }
 
 // Sink: False
 func withoutSink(src v1alpha1.EventSource) {
-	src.GetSourceStatus().MarkNoSink()
+	src.GetStatusManager().MarkNoSink()
 }
 
 // Deployed: True
@@ -360,9 +360,9 @@ func propagateAdapterAvailabilityFunc(adapter runtime.Object) func(src v1alpha1.
 	return func(src v1alpha1.EventSource) {
 		switch a := adapter.(type) {
 		case *appsv1.Deployment:
-			src.GetSourceStatus().PropagateDeploymentAvailability(context.Background(), a, nil)
+			src.GetStatusManager().PropagateDeploymentAvailability(context.Background(), a, nil)
 		case *servingv1.Service:
-			src.GetSourceStatus().PropagateServiceAvailability(a)
+			src.GetStatusManager().PropagateServiceAvailability(a)
 		}
 	}
 }