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

[nexus][sled-agent] Try more to load firewall rules during service bringup #5054

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

smklein
Copy link
Collaborator

@smklein smklein commented Feb 13, 2024

Fixes #5053 , with this solution implemented:

Nexus Internal Endpoint to Ask for FW Rules, Triggered After Individual Zones Launch. Rather than waiting for "all zones to launch", the Sled Agent could just re-apply firewall rules after any zones that need FW rules come up.

I used a bit of a brute-force solution here -- "just do it each time we try to launch a set of zones". This could certainly be more fine-grained, but it gets the job done.

Comment on lines +608 to +625
// Load as many services as we can, and don't exit immediately
// upon failure...
let load_services_result =
self.inner.services.load_services().await.map_err(|err| {
BackoffError::transient(Error::from(err))
});

// ... and request firewall rule updates for as many services as
// we can. Note that we still make this request even if we only
// partially load some services.
let firewall_result = self
.request_firewall_update()
.await
.map_err(|err| BackoffError::transient(err))
.map_err(|err| BackoffError::transient(err));

// Only complete if we have loaded all services and firewall
// rules successfully.
load_services_result.and(firewall_result)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By doing this operations back-to-back, we basically "load as many firewall rules as we can" for a set of services.

I could make this trigger more individually for "services which need firewall rules" (e.g., the request is only made after adding a Nexus / External DNS / boundary NTP zone), but felt that this was more "obviously not missing anything".

I could push down the triggers into the ServiceManager if folks felt strongly about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, like this we'll continue to hit the endpoint if we get stuck in the disk error loop right? Wonder if cause any issues constantly trying to update fw rules. Oh but there's the backoff in the retry loop. So, should be fine

@smklein smklein marked this pull request as ready for review February 13, 2024 20:54
Copy link
Contributor

@luqmana luqmana 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 putting this together so quick Sean!

Comment on lines +608 to +625
// Load as many services as we can, and don't exit immediately
// upon failure...
let load_services_result =
self.inner.services.load_services().await.map_err(|err| {
BackoffError::transient(Error::from(err))
});

// ... and request firewall rule updates for as many services as
// we can. Note that we still make this request even if we only
// partially load some services.
let firewall_result = self
.request_firewall_update()
.await
.map_err(|err| BackoffError::transient(err))
.map_err(|err| BackoffError::transient(err));

// Only complete if we have loaded all services and firewall
// rules successfully.
load_services_result.and(firewall_result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, like this we'll continue to hit the endpoint if we get stuck in the disk error loop right? Wonder if cause any issues constantly trying to update fw rules. Oh but there's the backoff in the retry loop. So, should be fine

Copy link
Contributor

@FelixMcFelix FelixMcFelix 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 very quick turnaround! This looks about right to me from what we talked over.

@smklein smklein merged commit 8b4d2e9 into main Feb 13, 2024
21 checks passed
@smklein smklein deleted the firewall-shenanigans branch February 13, 2024 22:47
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.

Any services failing to load -> Firewall rules don't come up
3 participants