Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 47f8aef

Browse files
author
odacremolbap
committed
use common broker reconciler
1 parent ac51133 commit 47f8aef

File tree

9 files changed

+514
-166
lines changed

9 files changed

+514
-166
lines changed

pkg/apis/eventing/v1alpha1/interfaces.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
package v1alpha1
22

33
import (
4+
"context"
5+
6+
appsv1 "k8s.io/api/apps/v1"
47
"knative.dev/pkg/kmeta"
58
)
69

10+
type Broker struct {
11+
Port *int `json:"port,omitempty"`
12+
13+
Observability *Observability `json:"observability,omitempty"`
14+
}
15+
16+
type Observability struct {
17+
ValueFromConfigMap string `json:"valueFromConfigMap"`
18+
}
19+
720
type ReconcilableBroker interface {
821
kmeta.OwnerRefable
922

1023
GetReconcilableBrokerStatus() ReconcilableBrokerStatus
1124
GetOwnedObjectsSuffix() string
25+
GetReconcilableBrokerSpec() *Broker
1226
}
1327

1428
type ReconcilableBrokerStatus interface {
15-
// Secret status management.
29+
// Secret as config status management.
1630
MarkConfigSecretFailed(reason, messageFormat string, messageA ...interface{})
1731
MarkConfigSecretReady()
1832

@@ -23,4 +37,17 @@ type ReconcilableBrokerStatus interface {
2337
// RoleBinding status management.
2438
MarkBrokerRoleBindingFailed(reason, messageFormat string, messageA ...interface{})
2539
MarkBrokerRoleBindingReady()
40+
41+
// Broker Deployment status management.
42+
MarkBrokerDeploymentFailed(reason, messageFormat string, messageA ...interface{})
43+
PropagateBrokerDeploymentAvailability(ctx context.Context, ds *appsv1.DeploymentStatus)
44+
45+
// Broker Service status management
46+
MarkBrokerServiceFailed(reason, messageFormat string, messageA ...interface{})
47+
MarkBrokerServiceReady()
48+
49+
// Broker Endpoints status management.
50+
MarkBrokerEndpointsTrue()
51+
MarkBrokerEndpointsUnknown(reason, messageFormat string, messageA ...interface{})
52+
MarkBrokerEndpointsFailed(reason, messageFormat string, messageA ...interface{})
2653
}

pkg/apis/eventing/v1alpha1/memory_lifecycle.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ func (t *MemoryBroker) GetStatus() *duckv1.Status {
4949
return &t.Status.Status
5050
}
5151

52+
// GetReconcilableBrokerSpec returns the all brokers common Broker spec.
53+
func (t *MemoryBroker) GetReconcilableBrokerSpec() *Broker {
54+
return &t.Spec.Broker
55+
}
56+
5257
// GetReconcilableBrokerStatus returns a status interface that allows generic reconciler
5358
// to manage it.
5459
func (t *MemoryBroker) GetReconcilableBrokerStatus() ReconcilableBrokerStatus {

pkg/apis/eventing/v1alpha1/redisbroker_lifecycle.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func (t *RedisBroker) GetStatus() *duckv1.Status {
5757
return &t.Status.Status
5858
}
5959

60+
// GetReconcilableBrokerSpec returns the all brokers common Broker spec.
61+
func (t *RedisBroker) GetReconcilableBrokerSpec() *Broker {
62+
return &t.Spec.Broker
63+
}
64+
6065
// GetReconcilableBrokerStatus returns a status interface that allows generic reconciler
6166
// to manage it.
6267
func (t *RedisBroker) GetReconcilableBrokerStatus() ReconcilableBrokerStatus {
@@ -217,7 +222,6 @@ func (bs *RedisBrokerStatus) MarkRedisEndpointsTrue() {
217222

218223
// Manage Redis broker state for
219224
// Deployment, Service and Endpoint
220-
221225
func (bs *RedisBrokerStatus) MarkBrokerDeploymentFailed(reason, messageFormat string, messageA ...interface{}) {
222226
redisBrokerCondSet.Manage(bs).MarkFalse(RedisBrokerBrokerDeployment, reason, messageFormat, messageA...)
223227
}

pkg/apis/eventing/v1alpha1/redisbroker_types.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,6 @@ type SecretValueFromSource struct {
7676
SecretKeyRef corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
7777
}
7878

79-
type Broker struct {
80-
Port *int `json:"port,omitempty"`
81-
82-
Observability *Observability `json:"observability,omitempty"`
83-
}
84-
85-
type Observability struct {
86-
ValueFromConfigMap string `json:"valueFromConfigMap"`
87-
}
88-
8979
type RedisBrokerSpec struct {
9080
Redis *Redis `json:"redis,omitempty"`
9181

0 commit comments

Comments
 (0)