Commit b105adb
Deprecate boolean
* Deprecate boolean `associatePublicIp` and add `AssociateIpStrategy` enum for IP assignment control
JENKINS-75002
Currently, public IP assignment behavior is inconsistent:
- `associatePublicIp=true`:
- Creates a `NetworkInterface`
- Sets `associatePublicIpAddress(true)`
- Configures subnet and security groups on the interface
- `associatePublicIp=false`:
- **On-demand**:
- Does *not* use a `NetworkInterface`
- Configures subnet/security groups at the RunInstance level
- Public IP assignment depends on the subnet's `MapPublicIpOnLaunch` setting (inherited)
- **Spot**:
- Uses a `NetworkInterface`
- Sets `associatePublicIpAddress(false)`, enforcing *no* public IP (does *not* inherit)
This prevents reliable enforcement of "no public IP" via AWS Service Control Policies.
The current logic follows [PR 447](#447), which reverted [JENKINS-58578](https://issues.jenkins.io/browse/JENKINS-58578), losing the ability of `associatePublicIp=false` to always disable public IP assignment.
- **Always create** the primary `NetworkInterface`.
- Replace the boolean `associatePublicIp` with the `AssociateIpStrategy` enum:
- `PUBLIC_IP`: Always assign a public IP (`associatePublicIpAddress=true`)
- `PRIVATE_IP`: Never assign a public IP (`associatePublicIpAddress=false`)
- `SUBNET`: Inherit the subnet's `MapPublicIpOnLaunch` (leave unset)
- `DEFAULT`: Matches current behavior: `PRIVATE_IP` for spot, `SUBNET` for on-demand
The `DEFAULT` option maintains backward compatibility and is used as the UI default.
* permission check in AssociateIPStrategy requests
* fix javadoc links
* Use label 'Associate IP Strategy' instead of 'Associate IP'
Co-authored-by: Jérôme Pochat <[email protected]>
---------
Co-authored-by: Jérôme Pochat <[email protected]>associatePublicIp and add AssociateIpStrategy enum for IP assignment control (#1148)1 parent 95ca008 commit b105adb
File tree
18 files changed
+453
-120
lines changed- src
- main
- java/hudson/plugins/ec2
- resources/hudson/plugins/ec2/SlaveTemplate
- test
- java/hudson/plugins/ec2
- resources/hudson/plugins/ec2
- EC2CloudMigrationTest/testAssociatePublicIpMigration
18 files changed
+453
-120
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| |||
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
328 | | - | |
| 331 | + | |
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
| |||
382 | 385 | | |
383 | 386 | | |
384 | 387 | | |
385 | | - | |
386 | 388 | | |
387 | 389 | | |
388 | 390 | | |
| |||
431 | 433 | | |
432 | 434 | | |
433 | 435 | | |
| 436 | + | |
| 437 | + | |
434 | 438 | | |
435 | 439 | | |
436 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
437 | 536 | | |
438 | 537 | | |
439 | 538 | | |
| |||
1640 | 1739 | | |
1641 | 1740 | | |
1642 | 1741 | | |
| 1742 | + | |
1643 | 1743 | | |
1644 | | - | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
1645 | 1749 | | |
1646 | 1750 | | |
1647 | 1751 | | |
1648 | 1752 | | |
1649 | 1753 | | |
1650 | 1754 | | |
1651 | 1755 | | |
1652 | | - | |
| 1756 | + | |
1653 | 1757 | | |
1654 | 1758 | | |
1655 | 1759 | | |
1656 | 1760 | | |
1657 | 1761 | | |
1658 | 1762 | | |
1659 | 1763 | | |
1660 | | - | |
| 1764 | + | |
1661 | 1765 | | |
1662 | 1766 | | |
1663 | 1767 | | |
| |||
2011 | 2115 | | |
2012 | 2116 | | |
2013 | 2117 | | |
2014 | | - | |
2015 | | - | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
| 2118 | + | |
2019 | 2119 | | |
2020 | 2120 | | |
2021 | 2121 | | |
| |||
2026 | 2126 | | |
2027 | 2127 | | |
2028 | 2128 | | |
2029 | | - | |
2030 | | - | |
2031 | | - | |
2032 | | - | |
2033 | | - | |
| 2129 | + | |
2034 | 2130 | | |
2035 | 2131 | | |
2036 | 2132 | | |
| |||
2042 | 2138 | | |
2043 | 2139 | | |
2044 | 2140 | | |
2045 | | - | |
2046 | | - | |
2047 | | - | |
2048 | | - | |
2049 | | - | |
| 2141 | + | |
| 2142 | + | |
2050 | 2143 | | |
2051 | 2144 | | |
2052 | 2145 | | |
| |||
2055 | 2148 | | |
2056 | 2149 | | |
2057 | 2150 | | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
2063 | 2161 | | |
2064 | 2162 | | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
2065 | 2166 | | |
2066 | 2167 | | |
2067 | 2168 | | |
| |||
2505 | 2606 | | |
2506 | 2607 | | |
2507 | 2608 | | |
2508 | | - | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
2509 | 2621 | | |
2510 | 2622 | | |
2511 | 2623 | | |
| |||
2889 | 3001 | | |
2890 | 3002 | | |
2891 | 3003 | | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
2892 | 3008 | | |
2893 | 3009 | | |
2894 | | - | |
2895 | | - | |
| 3010 | + | |
| 3011 | + | |
2896 | 3012 | | |
2897 | 3013 | | |
2898 | 3014 | | |
| |||
3384 | 3500 | | |
3385 | 3501 | | |
3386 | 3502 | | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
| 3523 | + | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
| 3530 | + | |
3387 | 3531 | | |
3388 | 3532 | | |
3389 | 3533 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
209 | | - | |
| 208 | + | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments