Done
Details
Assignee
ege.gunesege.gunesReporter
andrew.pogrebnoiandrew.pogrebnoiLabels
Time tracking
7h 35m loggedFix versions
Priority
Medium
Details
Details
Assignee
ege.gunes
ege.gunesReporter
andrew.pogrebnoi
andrew.pogrebnoiLabels
Time tracking
7h 35m logged
Fix versions
Priority
Smart Checklist
Smart Checklist
Smart Checklist
Created June 30, 2020 at 10:39 AM
Updated March 5, 2024 at 6:13 PM
Resolved August 9, 2021 at 8:08 AM
Be aware that any changes in statuses may affect compatibility with DBaaS-CLI tool and other 3d-party libs/tools.
There are duplicating (overlapping) statuses:
https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/apis/pxc/v1/pxc_types.go#L62-L65
https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/apis/pxc/v1/pxc_types.go#L91-L97
Most of the statuses here in fact untyped constants: https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/apis/pxc/v1/pxc_types.go#L83-L97 which already lead to misuse of "types" here https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/controller/pxc/status.go#L31 and here https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/controller/pxc/status.go#L42 - `cr.Status.Status` has type `api.AppState` but it being compared and set to const that intend to be `api.ClusterConditionType`
The logic in `cr.updateStatus()` (https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/controller/pxc/status.go#L23) is so bloody sophisticated. I'm sure it can be simplified. Anyway the logic should be described in some way in the comments, plus it gonna be lovely to have unit tests to cover all that stuff.
Also, it might be worth to align PXC & PSMDB some statues. Like:
https://github.com/percona/percona-xtradb-cluster-operator/blob/6a7ccc3958ab4bad99580a77c4be9c52d30d000a/pkg/apis/pxc/v1/pxc_backup_types.go#L44-L50
https://github.com/percona/percona-server-mongodb-operator/blob/8801a95aea56d5974e3f05e54f9c63564e580c98/pkg/apis/psmdb/v1/perconaservermongodbbackup_types.go#L23-L31