k8ssandra / k8ssandra-operator

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

Create a new ClusterIP service in the CP per CassDc #1382

Closed adejanovski closed 1 month ago

adejanovski commented 2 months ago

In order to allow Reaper to discover the IPs of all pods in all the managed clusters, which could be hosted in remote dataplanes, we'd need one additional service to be created in the CP for each CassDc. This service would be equivalent to the additional-seed-service, where k8ssandra-operator explicitly sets the endpoints to the IP addresses of the seed nodes, but we would get the IPs of all pods in the DC instead of the pods for other DCs. k8ssandra-operator would be responsible for reconciling those endpoints in case of IP changes, and Reaper would use the service URL as contact point for the cluster. A new watcher must be added on the Endpoints object named <cluster>-<dc>-all-pods-services across all dataplanes (and the control plane), then in the reconcileDatacenters() method, a call must be made to a newly created method which will reconcile our new service along with the corresponding endpoints. A new label must be added on the all pods service to be able to filter services in the watcher efficiently.

### Definition of Done
- [ ] One headless ClusterIP service gets created in the control plane for each DC
- [ ] this service endpoints contains the IPs of all nodes across the DC
- [ ] k8ssandra-operator explicitly sets the endpoints for these services like it does for additional-seed services
- [ ] The list of endpoints is copied directly from the watched service
- [ ] The **-**-all-pods-service services in cass-operator get an additional label such as `cassandra.datastax.com/all-pods: true`

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

olim7t commented 2 months ago

Marking this as blocked because it requires a change in cass-operator, see this PR comment.