Commit 3b27679
authored
[floating-ip,fix,api] Fix floating IP creation API to distinguish explicit IP from pool selection (#9687)
Fixes #9680.
This work clears up ambiguity.
`AddressAllocator::Explicit` now requires only an IP field, with the pool inferred from the address (since IP pools cannot have overlapping ranges). Pool-based allocation moves to `AddressAllocator::Auto` with `PoolSelector::Explicit { pool }`.
Includes:
- Simplifies `AddressAllocator::Explicit` to only require `ip` as a field (pool inferred)
- Moves explicit pool selection to `Auto { pool_selector: PoolSelector::Explicit { pool } }`
- Adds API version 2026012200 (`FLOATING_IP_ALLOCATOR_UPDATE`)
- Adds `ip_pool_fetch_containing_address()` to resolve pool from explicit IP address correctly
* Consolidates multicast pool resolution to use `ip_pool_fetch_containing_address()` too
- Adds versioned types in v2026011600.rs and updates v2026011501.rs delegation chain
- Adds unit tests for wire format compatibility and version conversions
- Adds FloatingIpAllocation enum at datastore layer (type-safe, mirrors multicast pattern)
- Adds Display impl for consistent pool selection logging (inferred/explicit/default/auto)
- Converts `NotFound` to `InvalidRequest` for an IP not in any configured pool
- Adds an index on `ip_pool_range.ip_pool_id` (schema version 223) for optimizing `ip_pool_fetch_containing_address()` and other queries
Current params JSON:
- Explicit IP (pool inferred from address):
```json
{"type": "explicit", "ip": "10.0.0.1"}
```
- Auto with explicit pool:
```json
{"type": "auto", "pool_selector": {"type": "explicit", "pool": "my-pool"}}
```
- Auto with default pool (specific IP version)
```json
{"type": "auto", "pool_selector": {"type": "auto", "ip_version": "v4"}}
```
- Auto with default pool (silo default, works only if there's a single
default pool)
```json
{"type": "auto", "pool_selector": {"type": "auto"}}
```
- Auto with all defaults (works only if there's a single default pool)
```json
{"type": "auto"}
```
Example `FloatingIpCreate` request body:
```json
{
"name": "my-floating-ip",
"description": "Example floating IP",
"address_allocator": {"type": "explicit", "ip": "10.0.0.1"}
}
```
Or with pool selection:
```json
{
"name": "my-floating-ip",
"description": "Example floating IP",
"address_allocator": {
"type": "auto",
"pool_selector": {"type": "explicit", "pool": "my-pool"}
}
}
```
Note: There's some multicast cleanup here to make sure of the same functionality, which just removes unnecessary code.1 parent 6cef874 commit 3b27679
File tree
30 files changed
+32567
-621
lines changed- nexus
- db-model/src
- db-queries/src/db
- datastore
- multicast
- ops
- pub_test_utils
- external-api
- src
- src/app
- multicast
- sagas
- test-utils/src
- tests/integration_tests
- multicast
- types/src/external_api
- openapi/nexus
- schema/crdb
- ip-pool-range-by-pool-id-index
30 files changed
+32567
-621
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
64 | 95 | | |
65 | 96 | | |
66 | 97 | | |
| |||
220 | 251 | | |
221 | 252 | | |
222 | 253 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | 254 | | |
228 | 255 | | |
229 | 256 | | |
230 | 257 | | |
231 | 258 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 259 | + | |
235 | 260 | | |
236 | 261 | | |
237 | 262 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
246 | 302 | | |
247 | | - | |
| 303 | + | |
248 | 304 | | |
249 | 305 | | |
250 | 306 | | |
| |||
1699 | 1755 | | |
1700 | 1756 | | |
1701 | 1757 | | |
1702 | | - | |
| 1758 | + | |
1703 | 1759 | | |
1704 | 1760 | | |
1705 | 1761 | | |
| |||
1708 | 1764 | | |
1709 | 1765 | | |
1710 | 1766 | | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
| 1767 | + | |
1714 | 1768 | | |
1715 | 1769 | | |
1716 | 1770 | | |
| |||
1773 | 1827 | | |
1774 | 1828 | | |
1775 | 1829 | | |
1776 | | - | |
| 1830 | + | |
1777 | 1831 | | |
1778 | 1832 | | |
1779 | 1833 | | |
| |||
1782 | 1836 | | |
1783 | 1837 | | |
1784 | 1838 | | |
1785 | | - | |
1786 | | - | |
1787 | | - | |
| 1839 | + | |
1788 | 1840 | | |
1789 | 1841 | | |
1790 | 1842 | | |
| |||
0 commit comments