Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"StatefulSet XXXX has no owner reference to MySQLCluster" is not an error #779

Open
rassie opened this issue Feb 4, 2025 · 1 comment · May be fixed by #781
Open

"StatefulSet XXXX has no owner reference to MySQLCluster" is not an error #779

rassie opened this issue Feb 4, 2025 · 1 comment · May be fixed by #781
Assignees
Labels
bug Something isn't working

Comments

@rassie
Copy link

rassie commented Feb 4, 2025

Describe the bug

When started, Moco Operator goes through all StatefulSets in the cluster to find the ones it manages, i.e. which have an OwnerReference to a MySQLCluster CRD. However, for every StatefulSet it doesn't own, an error log line is output to the logs, stating that StatefulSet XXXX has no owner reference to MySQLCluster. This reconciliation is repeated on the timer, spamming the logs.

I'd like to argue that this is not an error and should be informative at best: it's perfectly normal to have StatefulSets in the cluster which are not Moco-operated, even if and especially if those StatefulSets are MySQL clusters created by another operator, e.g. when the intention is to migrate the database to Moco.

Environments

  • Version: 0.25.1

Expected behavior
No error messages are output, since there is no error state

@rassie rassie added the bug Something isn't working label Feb 4, 2025
@ymmt2005
Copy link
Member

ymmt2005 commented Feb 4, 2025

Fair enough. That log was introduced in 0c4d537.

0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 262) func (r *StatefulSetPartitionReconciler) getMySQLCluster(ctx context.Context, sts *appsv1.StatefulSet) (*mocov1beta2.MySQLCluster, error) {
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 263)        for _, ownerRef := range sts.GetOwnerReferences() {
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 264)                if ownerRef.Kind != "MySQLCluster" {
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 265)                        continue
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 266)                }
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 267)
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 268)                cluster := &mocov1beta2.MySQLCluster{}
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 269)                if err := r.Get(ctx, types.NamespacedName{Name: ownerRef.Name, Namespace: sts.Namespace}, cluster); err != nil {
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 270)                        return nil, err
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 271)                }
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 272)
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 273)                return cluster, nil
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 274)        }
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 275)
0c4d5375b (d-kuro 2024-08-30 09:38:17 +0900 276)        return nil, fmt.Errorf("StatefulSet %s/%s has no owner reference to MySQLCluster", sts.Namespace, sts.Name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants