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

nsfs | wait for endpoint startup before namespace monitor registration #8474

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/endpoint/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,15 @@ async function main(options = {}) {
if (internal_rpc_client && config.NAMESPACE_MONITOR_ENABLED) {
endpoint_stats_collector.instance().set_rpc_client(internal_rpc_client);

// Register a bg monitor on the endpoint
background_scheduler.register_bg_worker(new NamespaceMonitor({
name: 'namespace_fs_monitor',
client: internal_rpc_client,
should_monitor: nsr => Boolean(nsr.nsfs_config),
}));
//wait with monitoring until pod has started
setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not add a retry in the namespace monitor if the error was ENOENT and start time of the endpoint is lower than 60 seconds? also why 60 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like more code with equivalent solution.

60 seconds to allow pod to stabilize (get to 'ready' or be deleted).

Copy link
Contributor

Choose a reason for hiding this comment

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

the reason is understood, but how do you know it takes a minute? is it always a minute? should it be configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, there's no way for node to know status of the pod.
I assume we don't want to make such a dependency.

60 seconds is more than enough on my minikube and is low enough not to bother other deployments in other envs, but I can make it an env variable.

// Register a bg monitor on the endpoint
background_scheduler.register_bg_worker(new NamespaceMonitor({
name: 'namespace_fs_monitor',
client: internal_rpc_client,
should_monitor: nsr => Boolean(nsr.nsfs_config),
}));
}, 1000 * 60);
alphaprinz marked this conversation as resolved.
Show resolved Hide resolved
}

if (config.ENABLE_SEMAPHORE_MONITOR) {
Expand Down