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

Add Restart task to CassandraTasks #394

Merged
merged 8 commits into from
Sep 6, 2022
Merged

Conversation

burmanm
Copy link
Contributor

@burmanm burmanm commented Aug 19, 2022

What this PR does:
Creates a new option that does rolling restart outside cads-operator's controller.

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

Checklist

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

@burmanm burmanm requested a review from a team as a code owner August 19, 2022 14:33
@@ -69,6 +73,12 @@ const (
CommandScrub CassandraCommand = "scrub"
)

const (
KeyspaceArgument string = "keyspace_name"
Copy link
Member

Choose a reason for hiding this comment

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

How is this related to a restart?

)

// Cleanup functionality

func callCleanup(nodeMgmtClient httphelper.NodeMgmtClient, pod *corev1.Pod, taskConfig *TaskConfiguration) (string, error) {
// TODO Add more arguments configurations
keyspaceName := ""
if keyspace, found := taskConfig.Arguments["keyspace_name"]; found {
if keyspace, found := taskConfig.Arguments[api.KeyspaceArgument]; found {
Copy link
Member

Choose a reason for hiding this comment

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

How is this related to a restart?

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 is mostly superceded by #395 , just to ensure we don't have magic strings around the code. Same for previous comment.

@@ -27,7 +32,7 @@ func callCleanup(nodeMgmtClient httphelper.NodeMgmtClient, pod *corev1.Pod, task
func callCleanupSync(nodeMgmtClient httphelper.NodeMgmtClient, pod *corev1.Pod, taskConfig *TaskConfiguration) error {
// TODO Add more arguments configurations
keyspaceName := ""
if keyspace, found := taskConfig.Arguments["keyspace_name"]; found {
if keyspace, found := taskConfig.Arguments[api.KeyspaceArgument]; found {
Copy link
Member

Choose a reason for hiding this comment

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

How is this related to a restart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And same here

Copy link
Contributor

@adejanovski adejanovski left a comment

Choose a reason for hiding this comment

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

The code mostly looks good to me, aside from a Result return that isn't used when invoking the rolling restart on the STS, unless I'm missing something.

It could be causing the only thing that looks problematic when testing this feature, which is that the completion time gets set right away when the CassandraTask gets created.
We'd need the completion time to be set only when the rolling restart is completed.

return ctrl.Result{}, err
}

res, err = r.restartSts(ctx, sts, taskConfig)
Copy link
Contributor

Choose a reason for hiding this comment

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

The res value doesn't seem to be used at all. Maybe that's what could be causing prematurely setting the completion time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that res used on the line 333? I don't see it being overwritten anywhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it overwritten on line 320?

res, failed, completed, err = r.reconcileEveryPodTask(ctx, dc, taskConfig)

Copy link
Contributor

Choose a reason for hiding this comment

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

Or is break JobDefinition sending us straight to line 333?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

break JobDefinition should break us from the for() clause and thus line 320 should never be run.

Copy link
Contributor

@adejanovski adejanovski left a comment

Choose a reason for hiding this comment

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

Looks good now 👍

@burmanm burmanm merged commit 7fe8e24 into k8ssandra:master Sep 6, 2022
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.

K8SSAND-1707 ⁃ Add task for rolling restart
3 participants