Skip to content

Conversation

charliepark
Copy link
Contributor

This adds SNAT IPs to the list of an instance's external IPs. This is the console counterpart to oxidecomputer/omicron#8685. We're still talking through a few design decisions around ports, but I wanted to get a PR going for it.

Screenshot 2025-07-30 at 3 00 46 PM

Closes #2866

Copy link

vercel bot commented Jul 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Aug 4, 2025 11:00pm

@charliepark
Copy link
Contributor Author

charliepark commented Jul 31, 2025

I just updated some IP Pool utilization tests, but they highlight that our "allocated" count (e.g. http://localhost:4000/system/networking/ip-pools/ip-pool-1) might be quadruple-counting SNAT IPs, because of the shared IP situation. That is, the test had expected 6, but now we have a 7th allocated, split across 4 SNATs. The utilization page, though, indicates that 10 are in use. Will take a look at this tomorrow.

Have fixed this.

@david-crespo
Copy link
Collaborator

david-crespo commented Aug 1, 2025

@bnaecker suggests we should filter out the SNAT IP here. I think that's a good idea. (In this case it's not showing because it's third in the list and we only show 2.)

image

export function ExternalIps({ project, instance }: PP.Instance) {
const { data, isPending } = useApiQuery('instanceExternalIpList', {
path: { instance },
query: { project },
})

Comment on lines +892 to +894
// Include SNAT IPs in IP utilization calculation, deduplicating by IP address
// since multiple instances can share the same SNAT IP with different port ranges
const uniqueSnatIps = [...new Set(db.snatIps.map((sip) => sip.external_ip.ip))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just wanted to call out that this is where we handle the SNAT IP address de-duplication (de-quadification?). Essentially, only pull unique IPs, and use that for the utilization count.

@david-crespo
Copy link
Collaborator

I think this is basically ready to go. My only issue is that in the SNAT IP-only case (which may be rare), it's not explained in the UI why there is nothing in the external IPs at the top, but there is this SNAT IP in the table lower down. The tooltip on the kind column could explain this but it's already getting too wordy. I'm tempted to put a tooltip next to every badge that explains only that kind, but it would look silly. Another option would be to change "external IPs" in the properties table to "inbound IPs" or something — not sure whether that is clever or terrible. Yet another option would be to stick an info tooltip next to the empty cell thing to explain, but only in the case where there is a SNAT IP and no others.

image image

@david-crespo david-crespo force-pushed the add-snat-to-external-ips branch from f1cfb39 to 111a295 Compare August 4, 2025 22:59
@david-crespo
Copy link
Collaborator

Adding the bit about how they can't receive traffic helps a little.

image

@david-crespo
Copy link
Collaborator

david-crespo commented Aug 4, 2025

TipIcon in properties table, making the empty cell itself the tooltip (not pictured, but I tried it), and changing "external IPs" to "inbound IPs" all feel bad to me. I'm going to merge as-is on the idea that the tooltip on the kind column helps a bit, and we can tweak it later.

image image

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.

Display SNAT IPs on instance external IPs list
2 participants