-
Notifications
You must be signed in to change notification settings - Fork 48
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
microcloud: terminate a session in joiner members when setup is aborted or just fail on initiator #525
base: main
Are you sure you want to change the base?
Conversation
When an initiator stops during a cluster setup, the joiner nodes are still running a joining session. A 'SessionStopPut' is sent to the joiner with a 'reason' field, which when received, is used to call `session.Stop(reason)` Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
This method should be called by the initiator to stop a joiner member session Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
…f the initiator does not finish properly after initiating a session Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
1522a7e
to
8555b38
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.
Thanks for the proposal.
Could we also stop the session on the joiners if something doesn't go well in case of preseed?
The stop endpoint can be used to quit the session prematurely (with a reason/error), but may also be leveraged to notify the joiner when the creation of the MicroCloud is complete (graceful exit).
I saw you have already extended the reverter to call the stop on every joiner in case of error but can we also extend this a bit to let the joiners wait until the initiator formed the cluster and is done?
IIRC there is already logic in the session stop for gracefully exiting out in case no reason is given.
In case of preseed we just let the joiner exit, see https://github.com/canonical/microcloud/blob/main/cmd/microcloud/preseed.go#L254.
In case of interactive we print a message here https://github.com/canonical/microcloud/blob/main/cmd/microcloud/ask.go#L1729 and let the joiner exit out.
It would be great if those could wait until the initiator is actually done setting up MicroCloud.
} | ||
|
||
data := types.SessionStopPut{Reason: stopMsg} | ||
err = client.Query(ctx, "PUT", types.APIVersion, api.NewURL().Path("session", "stop"), data, nil) |
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.
Can you please move this into client/client.go
as it's done for StartSession
.
} | ||
} | ||
|
||
// sessionStopPut receives a stop request from an initiator member and stops the current session. |
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.
Theoretically the stop endpoint could also be invoked on the initiator so I would not be too specific in the comment and try to be generic by saying that is just stops the current session.
You can rebase |
closes #520