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

microcloud: terminate a session in joiner members when setup is aborted or just fail on initiator #525

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gabrielmougard
Copy link
Contributor

closes #520

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>
@gabrielmougard gabrielmougard force-pushed the fix/aborted-setup-microcloud-join branch from 1522a7e to 8555b38 Compare December 3, 2024 16:13
@gabrielmougard gabrielmougard changed the title microcloud: terminate a session in joiner members when setup is aborted on initiator microcloud: terminate a session in joiner members when setup is aborted or just fail on initiator Dec 3, 2024
Copy link
Contributor

@roosterfish roosterfish left a 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)
Copy link
Contributor

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.
Copy link
Contributor

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.

@roosterfish
Copy link
Contributor

You can rebase main this should resolve the pipeline error.

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.

Aborted setup doesnt terminate microcloud join
2 participants