cass-operator icon indicating copy to clipboard operation
cass-operator copied to clipboard

PodDisruptionBudget are not named according to overrides

Open adejanovski opened this issue 1 year ago • 2 comments

What happened?

When using datacenterName overrides, the dc name label is set to the overridden one, and the pdb object is created with this name as well. If two cassdc are created with a dc1 overridden name in the same namespace, they will end up competing for the ownership of the same dc1-pdb PodDisruptionBudget object, and reconcile in a loop.

What did you expect to happen?

The pdb objects should be created with the cassdc meta.name as prefix for their name, which will then avoid creating conflicts as two cassdc objects cannot have the same name in the same namespace.

How can we reproduce it (as minimally and precisely as possible)?

Create a first cassdc using dc1 as datacenterName:

apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
metadata:
  name: cluster1-dc1
  namespace: test
spec:
  clusterName: cluster1
  datacenterName: dc1
  ...

and another one with the same datacenterName value:

apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
metadata:
  name: cluster2-dc1
  namespace: test
spec:
  clusterName: cluster2
  datacenterName: dc1
  ...

They'll both end up creating a dc1-pdb object.

cass-operator version

v1.22.4

Kubernetes version

v1.30

Method of installation

Helm

Anything else we need to know?

No response

┆Issue is synchronized with this Jira Story by Unito ┆Fix Versions: 2024-11 ┆Issue Number: CASS-75

adejanovski avatar Oct 24 '24 14:10 adejanovski

Actually, what it is missing is the clusterName prefix which is present in every other object. Otherwise the naming uses the same methods as other resources.

burmanm avatar Oct 24 '24 14:10 burmanm

Now, while fixing when creating a new one is easy, this will require us to also delete the old one. Will have to use the new field metadataVersion.

burmanm avatar Oct 24 '24 14:10 burmanm