k8ssandra / k8ssandra-operator

The Kubernetes operator for K8ssandra
https://k8ssandra.io/
Apache License 2.0
176 stars 79 forks source link

Refactor K8ssandraCluster deletion cleanup operation #992

Open adejanovski opened 1 year ago

adejanovski commented 1 year ago

In controllers/k8ssandra/cleanup.go we delete all the objects that are tied to a deleted K8ssandraCluster object. The deleteDeployments(), deleteServices() and deleteConfigMaps() could benefit from the following improvements:

┆Issue is synchronized with this Jira Story by Unito ┆Issue Number: K8OP-90

olim7t commented 1 year ago

Note: this is closely related to #961.

As I'm digging into the code I'm encountering more questions:

In fact, I think we could generalize the use of controller references. As long as every remote object we create is owned by the CassandraDatacenter (directly or transitively), we shouldn't need to do anything beyond deleting the DC. I'm going to experiment with that.