instaclustr / operator

Instaclustr Kubernetes Operator
Apache License 2.0
2 stars 0 forks source link

Default user secret already exists error #728

Closed testisnullus closed 8 months ago

testisnullus commented 8 months ago

We have a createDefaultSecret function for managing default user credentials for Cassandra, Zookeeper, and KafkaConnect clusters. If the secret already exists, we will get the next error:

024-02-28T15:42:31Z ERROR Cassandra creation event Cannot create default secret for Cassandra {"controller": "cassandra", "controllerGroup": "clusters.instaclustr.com", "controllerKind": "Cassandra", "cassandra": {"name":"cassandra-cadence-sample","namespace":"default"}, "namespace": "default", "name": "cassandra-cadence-sample", "reconcileID": "2957f5df-3209-49e0-93f5-04d12a7886eb", "cluster name": "cassandra-cadence-sample", "clusterID": "fcd5cd42-07c4-444f-a98d-c32b478f04b4", "error": "secrets \"default-user-password-cassandra-cadence-sample\" already exists"}

It happens because we don't check if a secret exists for the specified resource before creating it inside the createDefaultSecret function. It's proposed to add such checks to fix the problem.

ribaraka commented 8 months ago

https://github.com/instaclustr/operator/pull/734