cockroachdb / cockroach-operator

k8s operator for CRDB
Apache License 2.0
284 stars 95 forks source link

Fix the clusterStatus should reflect correct state of cluster #976

Closed prafull01 closed 1 year ago

prafull01 commented 1 year ago

Fixes #951

Currently, we are storing the CR in resource.Cluster object and changing this CR during the course of reconcile and at last call the update function. This causes the object has been already modified, please apply your changes to the latest version and try again

With this change, we take the copy of the object before reconcile, run the changes on our CR, then patch will take diff for the before and after of object to find only the changed fields. This patch operation is more safer in terms of updating the CR.

With this change, cluster is in correct state after crdb is provisioned:

Screenshot 2023-04-18 at 3 00 49 AM