-
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
Add Restart task to CassandraTasks #394
Conversation
@@ -69,6 +73,12 @@ const ( | |||
CommandScrub CassandraCommand = "scrub" | |||
) | |||
|
|||
const ( | |||
KeyspaceArgument string = "keyspace_name" |
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.
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 { |
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.
How is this related to a restart?
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 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 { |
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.
How is this related to a restart?
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.
And same here
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.
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) |
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.
The res
value doesn't seem to be used at all. Maybe that's what could be causing prematurely setting the completion time?
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.
Isn't that res used on the line 333? I don't see it being overwritten anywhere.
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.
Isn't it overwritten on line 320?
res, failed, completed, err = r.reconcileEveryPodTask(ctx, dc, taskConfig)
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.
Or is break JobDefinition
sending us straight to line 333?
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.
break JobDefinition should break us from the for() clause and thus line 320 should never be run.
032a9eb
to
2673975
Compare
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.
Looks good now 👍
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