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

Fix sanitization of DC label (fixes #622) #623

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

olim7t
Copy link
Contributor

@olim7t olim7t commented Mar 21, 2024

What this PR does:
Fix sanitization of DC label

Which issue(s) this PR fixes:
Fixes #622

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CHANGELOG.md updated (not required for documentation PRs)
  • CLA Signed: DataStax CLA

@olim7t olim7t requested a review from a team as a code owner March 21, 2024 18:05
@@ -144,7 +144,7 @@ func (rc *ReconciliationContext) listPVCs() (*corev1.PersistentVolumeClaimList,
rc.ReqLogger.Info("reconciler::listPVCs")

selector := map[string]string{
api.DatacenterLabel: rc.Datacenter.Name,
api.DatacenterLabel: api.CleanLabelValue(rc.Datacenter.DatacenterName()),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was probably a bug.

@@ -133,7 +133,7 @@ var _ = Describe(testName, func() {
wg.Add(1)
go func() {
k = kubectl.Logs("-f").
WithLabel(fmt.Sprintf("statefulset.kubernetes.io/pod-name=cluster1-%s-r1-sts-0", api.CleanupForKubernetes(dcNameOverride))).
WithLabel(fmt.Sprintf("statefulset.kubernetes.io/pod-name=cluster1-%s-r1-sts-0", api.CleanLabelValue(dcNameOverride))).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: This is wrong and the test shouldn't pass if we mess up naming of the StatefulSet. The StatefulSet name must adhere to the CleanupForKubernetes process (minimum), not CleanLabelValue as those values are not allowed in the StatefulSet's name.

Although we're polling for label value here, the DNS name of the pod matters. The name defined must match what's in here:

https://github.com/k8ssandra/cass-operator/blob/master/pkg/reconciliation/construct_statefulset.go#L29

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, my bad, I saw a label and just changed the function, not realizing that the value was actually referencing a resource name. I'll revert this.

@olim7t
Copy link
Contributor Author

olim7t commented Mar 26, 2024

@burmanm is the decommmission_dc integration test flaky? I see it's failing on master too.

@adejanovski adejanovski merged commit 66aa5f1 into k8ssandra:master Mar 27, 2024
37 of 38 checks passed
@olim7t olim7t deleted the sanitize-dc-label branch March 27, 2024 15:28
burmanm pushed a commit that referenced this pull request Mar 28, 2024
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 this pull request may close these issues.

Fix sanitization of the datacenter label
3 participants