-
Notifications
You must be signed in to change notification settings - Fork 65
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ var ( | |
dcNameOverride = "My_Super_Dc" | ||
dcYaml = "../testdata/default-two-rack-two-node-dc.yaml" | ||
dcResource = fmt.Sprintf("CassandraDatacenter/%s", dcName) | ||
dcLabel = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", api.CleanupForKubernetes(dcNameOverride)) | ||
dcLabel = fmt.Sprintf("cassandra.datastax.com/datacenter=%s", api.CleanLabelValue(dcNameOverride)) | ||
ns = ginkgo_util.NewWrapper(testName, namespace) | ||
) | ||
|
||
|
@@ -89,7 +89,7 @@ var _ = Describe(testName, func() { | |
ns.WaitForDatacenterOperatorProgress(dcName, "Updating", 60) | ||
ns.WaitForDatacenterConditionWithTimeout(dcName, "ScalingUp", string(corev1.ConditionFalse), 1200) | ||
// Ensure that when 'ScaleUp' becomes 'false' that our pods are in fact up and running | ||
Expect(len(ns.GetDatacenterReadyPodNames(api.CleanupForKubernetes(dcNameOverride)))).To(Equal(4)) | ||
Expect(len(ns.GetDatacenterReadyPodNames(api.CleanLabelValue(dcNameOverride)))).To(Equal(4)) | ||
|
||
ns.ExpectDoneReconciling(dcName) | ||
ns.WaitForDatacenterReady(dcName) | ||
|
@@ -114,7 +114,7 @@ var _ = Describe(testName, func() { | |
FormatOutput(json) | ||
ns.WaitForOutputAndLog(step, k, "4", 20) | ||
|
||
ns.WaitForDatacenterToHaveNoPods(api.CleanupForKubernetes(dcNameOverride)) | ||
ns.WaitForDatacenterToHaveNoPods(api.CleanLabelValue(dcNameOverride)) | ||
|
||
step = "resume the dc" | ||
json = "{\"spec\": {\"stopped\": false}}" | ||
|
@@ -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))). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
WithFlag("container", "cassandra") | ||
output, err := ns.Output(k) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
@@ -148,7 +148,7 @@ var _ = Describe(testName, func() { | |
|
||
found, err := regexp.MatchString("node/drain status=200 OK", logOutput) | ||
if err == nil && !found { | ||
ns.Log(fmt.Sprintf("logOutput, pod: statefulset.kubernetes.io/pod-name=cluster1-%s-r1-sts-0 => %s", api.CleanupForKubernetes(dcNameOverride), logOutput)) | ||
ns.Log(fmt.Sprintf("logOutput, pod: statefulset.kubernetes.io/pod-name=cluster1-%s-r1-sts-0 => %s", api.CleanLabelValue(dcNameOverride), logOutput)) | ||
} | ||
if err != nil { | ||
ns.Log(fmt.Sprintf("Regexp parsing failed: %v", err)) | ||
|
There was a problem hiding this comment.
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.