-
Notifications
You must be signed in to change notification settings - Fork 66
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
CheckRackLabels patching is ignored? #719
Comments
This unit test seems to work fine for StS: func TestCheckRackLabels(t *testing.T) {
rc, _, cleanupMockScr := setupTest()
defer cleanupMockScr()
require := require.New(t)
err := rc.CalculateRackInformation()
require.NoError(err)
desiredStatefulSet, err := newStatefulSetForCassandraDatacenter(
nil,
"default",
rc.Datacenter,
3)
require.NoErrorf(err, "error occurred creating statefulset")
desiredStatefulSet.Status.ReadyReplicas = *desiredStatefulSet.Spec.Replicas
trackObjects := []runtime.Object{
desiredStatefulSet,
rc.Datacenter,
}
rc.Client = fake.NewClientBuilder().WithStatusSubresource(rc.Datacenter).WithRuntimeObjects(trackObjects...).Build()
rc.statefulSets = []*appsv1.StatefulSet{desiredStatefulSet}
res := rc.CheckRackLabels()
require.Equal(result.Continue(), res, "Label updates should not cause errors")
require.Subset(desiredStatefulSet.Labels, rc.Datacenter.GetRackLabels("default"))
desiredStatefulSet.Labels[api.RackLabel] = "r1"
require.NotSubset(desiredStatefulSet.Labels, rc.Datacenter.GetRackLabels("default"))
res = rc.CheckRackLabels()
require.Equal(result.Continue(), res, "Label updates should not cause errors")
require.Subset(desiredStatefulSet.Labels, rc.Datacenter.GetRackLabels("default"))
} |
I can't replicate this behavior with manual testing either. |
In manual testing, I do:
I had to go manually edit the cass-operator deployment to get I then see:
I waited another 10 minutes just to be sure, eventually indeed I got:
So it looks like I just wasn't waiting long enough. I do wonder whether the selector.matchLabels and template.metadata.labels fields will come back to bite us, as they never get updated (by design). Is this a weird little bit of hidden complexity that we should try to iron out? |
They get updated once it's allowed. So once there's any change to CassandraDatacenter object or allowupdate-spec=once/always is set as annotation, we will update them. |
What happened?
In this comment on PR: #698 (comment)
The StS labels were not changed in CheckRackLabels() for some reason. We need to investigate if we can replicate this or if this was just something Kubernetes opted not to do in this test run.
The unit tests have not caught this sort of behavior.
What did you expect to happen?
CheckRackLabels() should always update the StS ObjectMeta labels (not Spec labels) on every run.
How can we reproduce it (as minimally and precisely as possible)?
Not known.
cass-operator version
1.22.4
Kubernetes version
Method of installation
No response
Anything else we need to know?
No response
┆Issue is synchronized with this Jira Story by Unito
┆Issue Number: CASS-74
The text was updated successfully, but these errors were encountered: