@@ -13,16 +13,22 @@ import (
1313)
1414
1515const (
16- BrokerConditionReady = apis .ConditionReady
17- BrokerConditionIngress apis.ConditionType = "IngressReady"
18- BrokerConditionAddressable apis.ConditionType = "Addressable"
16+ RedisBrokerConditionReady = apis .ConditionReady
17+ RedisBrokerRedisDeployment apis.ConditionType = "RedisDeploymentReady"
18+ RedisBrokerRedisService apis.ConditionType = "RedisServiceReady"
19+ RedisBrokerBrokerDeployment apis.ConditionType = "BrokerDeploymentReady"
20+ RedisBrokerBrokerService apis.ConditionType = "BrokerServiceReady"
21+ RedisBrokerConditionAddressable apis.ConditionType = "Addressable"
1922)
2023
21- var brokerCondSet = apis .NewLivingConditionSet (
22- BrokerConditionIngress ,
23- BrokerConditionAddressable ,
24+ var redisBrokerCondSet = apis .NewLivingConditionSet (
25+ RedisBrokerRedisDeployment ,
26+ RedisBrokerRedisService ,
27+ RedisBrokerBrokerDeployment ,
28+ RedisBrokerBrokerService ,
29+ RedisBrokerConditionAddressable ,
2430)
25- var brokerCondSetLock = sync.RWMutex {}
31+ var redisBrokerCondSetLock = sync.RWMutex {}
2632
2733// GetGroupVersionKind returns GroupVersionKind for Brokers
2834func (t * RedisBroker ) GetGroupVersionKind () schema.GroupVersionKind {
@@ -36,26 +42,26 @@ func (t *RedisBroker) GetStatus() *duckv1.Status {
3642
3743// RegisterAlternateBrokerConditionSet register a apis.ConditionSet for the given broker class.
3844func RegisterAlternateBrokerConditionSet (conditionSet apis.ConditionSet ) {
39- brokerCondSetLock .Lock ()
40- defer brokerCondSetLock .Unlock ()
45+ redisBrokerCondSetLock .Lock ()
46+ defer redisBrokerCondSetLock .Unlock ()
4147
42- brokerCondSet = conditionSet
48+ redisBrokerCondSet = conditionSet
4349}
4450
4551// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
4652func (b * RedisBroker ) GetConditionSet () apis.ConditionSet {
47- brokerCondSetLock .RLock ()
48- defer brokerCondSetLock .RUnlock ()
53+ redisBrokerCondSetLock .RLock ()
54+ defer redisBrokerCondSetLock .RUnlock ()
4955
50- return brokerCondSet
56+ return redisBrokerCondSet
5157}
5258
5359// GetConditionSet retrieves the condition set for this resource.
5460func (bs * RedisBrokerStatus ) GetConditionSet () apis.ConditionSet {
55- brokerCondSetLock .RLock ()
56- defer brokerCondSetLock .RUnlock ()
61+ redisBrokerCondSetLock .RLock ()
62+ defer redisBrokerCondSetLock .RUnlock ()
5763
58- return brokerCondSet
64+ return redisBrokerCondSet
5965}
6066
6167// GetTopLevelCondition returns the top level Condition.
@@ -68,9 +74,9 @@ func (bs *RedisBrokerStatus) GetTopLevelCondition() *apis.Condition {
6874func (bs * RedisBrokerStatus ) SetAddress (url * apis.URL ) {
6975 bs .Address .URL = url
7076 if url != nil {
71- bs .GetConditionSet ().Manage (bs ).MarkTrue (BrokerConditionAddressable )
77+ bs .GetConditionSet ().Manage (bs ).MarkTrue (RedisBrokerConditionAddressable )
7278 } else {
73- bs .GetConditionSet ().Manage (bs ).MarkFalse (BrokerConditionAddressable , "nil URL" , "URL is nil" )
79+ bs .GetConditionSet ().Manage (bs ).MarkFalse (RedisBrokerConditionAddressable , "nil URL" , "URL is nil" )
7480 }
7581}
7682
@@ -90,3 +96,7 @@ func (b *RedisBroker) IsReady() bool {
9096func (bs * RedisBrokerStatus ) InitializeConditions () {
9197 bs .GetConditionSet ().Manage (bs ).InitializeConditions ()
9298}
99+
100+ func (bs * RedisBrokerStatus ) MarkRedisBrokerFailed (reason , messageFormat string , messageA ... interface {}) {
101+ redisBrokerCondSet .Manage (bs ).MarkFalse (RedisBrokerRedisDeployment , reason , messageFormat , messageA ... )
102+ }
0 commit comments