bf2fc6cc711aee1a0c2a / kas-fleetshard

The kas-fleetshard-operator is responsible for provisioning and managing instances of kafka on a cluster. The kas-fleetshard-synchronizer synchronizes the state of a fleet shard with the kas-fleet-manager.
Apache License 2.0
7 stars 20 forks source link

MGDSTRM-10325: Delete Strimzi cluster operator leadership lease on deployment deletion #851

Closed robobario closed 1 year ago

robobario commented 1 year ago

Why: As part of enabling StrimziPodSets in the cluster operator we are also increasing availability of the operator by running 2 replicas and using a k8s lease to elect one of them as a leader, the other will be in standby in case it needs to take over reconciliation. The lease is not able to be automatically cleaned up when we tear down a cluster operator deployment, so we are making the Fleetshard Operator responsible for deleting the lease in reaction to a deployment deletion.

This is the upstream issue in the fabric8 client https://github.com/fabric8io/kubernetes-client/issues/4638, once this is resolved we can remove this work from Fleetshard and configure an owner reference in the Strimzi cluster operator

Note that the lease is named ${deploymentName}-leadership-token by convention to enable fleetshard to clean it.

https://issues.redhat.com/browse/MGDSTRM-10325

k-wall commented 1 year ago

@robobario the approach looks good to me.

shawkins commented 1 year ago

Only note is it looks like the delete DSL in the fabric8 client has a different return type in the latest version, so when kas-fleetshard upgrades their fabric8 client the code will likely need a slight change, but for now it looks good to me.

Yes - the boolean return value isn't generally useful and confusing for some of the multi-delete scenarios. Later versions return a list of items marked for deletion and the ability to await all of those deletions to be processed.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

83.3% 83.3% Coverage
0.0% 0.0% Duplication