Skip to content

Commit

Permalink
sled-agent: refresh firewall rules upon receiving a new zone config
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallagher committed Feb 16, 2024
1 parent fdae702 commit c0df8d2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,25 @@ impl SledAgent {
.services
.ensure_all_omicron_zones_persistent(requested_zones)
.await?;

// It's possible we just added new zones, in which case we may need new
// firewall rules.
//
// In theory, we should only need to request new firewall rules if we
// just added a zone. In practice knowing whether that's true would
// require state across mulitple calls; for example:
//
// 1. Client calls this endpoint. We succeed in adding a zone, so we try
// to refresh firewall rules, but the refresh fails. We return a 500.
// 2. Client retries; we already succeeded in adding their zone, so this
// time we don't start any new zones. How do we know we still need to
// refresh firewall rules from the previous request?
//
// Instead, we'll unconditionally request a firewall rule refresh every
// time. If this succeeds, our caller knows that any zones they sent us
// are both running and any relevant firewall rules have been applied.
self.request_firewall_update().await?;

Ok(())
}

Expand Down

0 comments on commit c0df8d2

Please sign in to comment.