Closed robobario closed 1 year ago
@robobario the approach looks good to me.
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.
Kudos, SonarCloud Quality Gate passed!
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