Skip to content

Commit

Permalink
add kafka msk to the hash cache at the start of reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
nesty156 committed Feb 7, 2025
1 parent cd74d7e commit ae123ab
Show file tree
Hide file tree
Showing 19 changed files with 1,086 additions and 10 deletions.
22 changes: 12 additions & 10 deletions controllers/cloud.redhat.com/clowdenvironment_reconciliation.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,12 @@ func (r *ClowdEnvironmentReconciliation) markedForDeletion() (ctrl.Result, error
func (r *ClowdEnvironmentReconciliation) finalizeEnvironmentImplementation() error {

provider := providers.Provider{
Ctx: r.ctx,
Client: r.client,
Env: r.env,
Cache: r.cache,
Log: *r.log,
Ctx: r.ctx,
Client: r.client,
Env: r.env,
Cache: r.cache,
Log: *r.log,
HashCache: r.hashCache,
}

err := runProvidersForEnvFinalize(*r.log, provider)
Expand Down Expand Up @@ -290,11 +291,12 @@ func (r *ClowdEnvironmentReconciliation) runProviders() (ctrl.Result, error) {
r.hashCache.RemoveClowdObjectFromObjects(r.env)

provider := providers.Provider{
Ctx: r.ctx,
Client: r.client,
Env: r.env,
Cache: r.cache,
Log: *r.log,
Ctx: r.ctx,
Client: r.client,
Env: r.env,
Cache: r.cache,
Log: *r.log,
HashCache: r.hashCache,
}
provErr := runProvidersForEnv(*r.log, provider)

Expand Down
8 changes: 8 additions & 0 deletions controllers/cloud.redhat.com/providers/kafka/msk.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ func (s *mskProvider) configureListeners() error {
return err
}

if _, err := s.HashCache.CreateOrUpdateObject(secret, true); err != nil {
return err
}

if err := s.HashCache.AddClowdObjectToObject(s.Env, secret); err != nil {
return err
}

brokers, err = getBrokerConfig(secret)
if err != nil {
return err
Expand Down
23 changes: 23 additions & 0 deletions tests/kuttl/test-clowdapp-watcher-kafka-msk/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Namespace
metadata:
name: test-clowdapp-watcher-kafka-msk
spec:
finalizers:
- kubernetes
---
apiVersion: v1
kind: Namespace
metadata:
name: test-clowdapp-watcher-kafka-msk-sec-source
spec:
finalizers:
- kubernetes
---
apiVersion: v1
kind: Namespace
metadata:
name: test-clowdapp-watcher-kafka-msk-env
spec:
finalizers:
- kubernetes
26 changes: 26 additions & 0 deletions tests/kuttl/test-clowdapp-watcher-kafka-msk/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: test-clowdapp-watcher-kafka-msk
namespace: test-clowdapp-watcher-kafka-msk
status:
conditions:
- reason: ZooKeeperStorage
status: "True"
type: Warning
- reason: KafkaStorage
status: "True"
type: Warning
- status: "True"
type: Ready
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
labels:
strimzi.io/cluster: test-clowdapp-watcher-kafka-msk
name: test-clowdapp-watcher-kafka-msk-connect
namespace: test-clowdapp-watcher-kafka-msk
status:
username: test-clowdapp-watcher-kafka-msk-connect
Loading

0 comments on commit ae123ab

Please sign in to comment.