Skip to content

Bug: topologySpreadConstraints uses incorrect instance label for DM Discovery pods #6149

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

Open
shunki-fujita opened this issue Apr 11, 2025 · 0 comments · May be fixed by #6150
Open

Bug: topologySpreadConstraints uses incorrect instance label for DM Discovery pods #6149

shunki-fujita opened this issue Apr 11, 2025 · 0 comments · May be fixed by #6150

Comments

@shunki-fujita
Copy link

shunki-fujita commented Apr 11, 2025

Bug Report

What version of Kubernetes are you using?
1.30

What version of TiDB Operator are you using?
1.6.1

What did you do?
In the DMCluster resource, the dm-discovery deployment is created with a topologySpreadConstraints that does not match the actual labels on the Pod.

The name of the discovery pod in a DMCluster is suffixed with -dm at the following location:

case *v1alpha1.DMCluster:
// NOTE: for DmCluster, add a `-dm` prefix for discovery to avoid name conflicts.
name = fmt.Sprintf("%s-dm", cluster.GetName())
instanceName := fmt.Sprintf("%s-dm", cluster.GetInstanceName())
ownerRef = controller.GetDMOwnerRef(cluster) // TODO: refactor to unify methods
discoveryLabel = label.NewDM().Instance(instanceName).Discovery()

However, the TopologySpreadConstraints configuration uses DMCluster.name directly as the instanceLabel:

instanceLabelVal := a.name
if v, ok := tsc.MatchLabels[label.InstanceLabelKey]; ok {
instanceLabelVal = v
}
l[label.InstanceLabelKey] = instanceLabelVal

What did you expect to see?
The topologySpreadConstraints for the dm-discovery pod should match the pod's actual labels, including the app.kubernetes.io/instance label with the -dm suffix.

What did you see instead?
The topologySpreadConstraints uses the DMCluster.name as the instance label without the -dm suffix, which causes a mismatch with the actual label on the dm-discovery pod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant