Skip to content

Commit 689aab6

Browse files
committed
Add dual-stack API support for Egress
Extend ExternalIPPool subnet configuration to support IPv4 and IPv6 subnets with a shared VLAN. Add Egress IP family selection and explicit dual-stack Egress IPs while preserving the legacy single-stack fields. Add CRD and admission validation for IP family consistency, subnet matching, mutually exclusive representations, and immutable pool IP families. Remove the unused externalIPPools field. Signed-off-by: Shuyang Xin <xin_shuyang@hotmail.com>
1 parent 1357c60 commit 689aab6

24 files changed

Lines changed: 1321 additions & 210 deletions

build/charts/antrea/crds/egress.yaml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@ spec:
2020
type: object
2121
required:
2222
- appliedTo
23-
oneOf:
24-
- anyOf:
25-
- required:
26-
- egressIP
27-
- required:
28-
- externalIPPool
29-
- anyOf:
30-
- required:
31-
- egressIPs
32-
- required:
33-
- externalIPPools
23+
anyOf:
24+
- required:
25+
- egressIP
26+
- required:
27+
- egressIPs
28+
- required:
29+
- externalIPPool
30+
x-kubernetes-validations:
31+
- message: egressIP and egressIPs are mutually exclusive
32+
rule: "!(has(self.egressIP) && has(self.egressIPs))"
3433
properties:
3534
appliedTo:
3635
type: object
@@ -96,18 +95,30 @@ spec:
9695
- format: ipv6
9796
egressIPs:
9897
type: array
98+
minItems: 2
99+
maxItems: 2
100+
x-kubernetes-validations:
101+
- message: egressIPs must not contain duplicate IP families
102+
rule: "self.size() < 2 || self[0].contains(':') != self[1].contains(':')"
99103
items:
100104
type: string
101105
oneOf:
102-
- maxLength: 0
103106
- format: ipv4
104107
- format: ipv6
105108
externalIPPool:
106109
type: string
107-
externalIPPools:
110+
ipFamilies:
108111
type: array
112+
minItems: 1
113+
maxItems: 2
114+
x-kubernetes-validations:
115+
- message: ipFamilies must not contain duplicate entries
116+
rule: "self.size() < 2 || self[0] != self[1]"
109117
items:
110118
type: string
119+
enum:
120+
- IPv4
121+
- IPv6
111122
bandwidth:
112123
type: object
113124
required:

build/charts/antrea/crds/externalippool.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,17 @@ spec:
4848
- format: ipv6
4949
subnetInfo:
5050
type: object
51-
required:
52-
- gateway
53-
- prefixLength
51+
oneOf:
52+
- required:
53+
- gateway
54+
- prefixLength
55+
- required:
56+
- ipFamilySubnets
57+
x-kubernetes-validations:
58+
- message: gateway and prefixLength cannot be set with ipFamilySubnets
59+
rule: >-
60+
!has(self.ipFamilySubnets) ||
61+
!(has(self.gateway) || has(self.prefixLength))
5462
properties:
5563
gateway:
5664
type: string
@@ -61,6 +69,28 @@ spec:
6169
type: integer
6270
minimum: 1
6371
maximum: 127
72+
ipFamilySubnets:
73+
type: array
74+
minItems: 1
75+
maxItems: 2
76+
x-kubernetes-validations:
77+
- message: ipFamilySubnets must not contain duplicate IP families
78+
rule: "self.size() < 2 || self[0].gateway.contains(':') != self[1].gateway.contains(':')"
79+
items:
80+
type: object
81+
required:
82+
- gateway
83+
- prefixLength
84+
properties:
85+
gateway:
86+
type: string
87+
oneOf:
88+
- format: ipv4
89+
- format: ipv6
90+
prefixLength:
91+
type: integer
92+
minimum: 1
93+
maximum: 127
6494
vlan:
6595
type: integer
6696
minimum: 0

build/yamls/antrea-aks.yml

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,17 +1589,16 @@ spec:
15891589
type: object
15901590
required:
15911591
- appliedTo
1592-
oneOf:
1593-
- anyOf:
1594-
- required:
1595-
- egressIP
1596-
- required:
1597-
- externalIPPool
1598-
- anyOf:
1599-
- required:
1600-
- egressIPs
1601-
- required:
1602-
- externalIPPools
1592+
anyOf:
1593+
- required:
1594+
- egressIP
1595+
- required:
1596+
- egressIPs
1597+
- required:
1598+
- externalIPPool
1599+
x-kubernetes-validations:
1600+
- message: egressIP and egressIPs are mutually exclusive
1601+
rule: "!(has(self.egressIP) && has(self.egressIPs))"
16031602
properties:
16041603
appliedTo:
16051604
type: object
@@ -1665,18 +1664,30 @@ spec:
16651664
- format: ipv6
16661665
egressIPs:
16671666
type: array
1667+
minItems: 2
1668+
maxItems: 2
1669+
x-kubernetes-validations:
1670+
- message: egressIPs must not contain duplicate IP families
1671+
rule: "self.size() < 2 || self[0].contains(':') != self[1].contains(':')"
16681672
items:
16691673
type: string
16701674
oneOf:
1671-
- maxLength: 0
16721675
- format: ipv4
16731676
- format: ipv6
16741677
externalIPPool:
16751678
type: string
1676-
externalIPPools:
1679+
ipFamilies:
16771680
type: array
1681+
minItems: 1
1682+
maxItems: 2
1683+
x-kubernetes-validations:
1684+
- message: ipFamilies must not contain duplicate entries
1685+
rule: "self.size() < 2 || self[0] != self[1]"
16781686
items:
16791687
type: string
1688+
enum:
1689+
- IPv4
1690+
- IPv6
16801691
bandwidth:
16811692
type: object
16821693
required:
@@ -1838,9 +1849,17 @@ spec:
18381849
- format: ipv6
18391850
subnetInfo:
18401851
type: object
1841-
required:
1842-
- gateway
1843-
- prefixLength
1852+
oneOf:
1853+
- required:
1854+
- gateway
1855+
- prefixLength
1856+
- required:
1857+
- ipFamilySubnets
1858+
x-kubernetes-validations:
1859+
- message: gateway and prefixLength cannot be set with ipFamilySubnets
1860+
rule: >-
1861+
!has(self.ipFamilySubnets) ||
1862+
!(has(self.gateway) || has(self.prefixLength))
18441863
properties:
18451864
gateway:
18461865
type: string
@@ -1851,6 +1870,28 @@ spec:
18511870
type: integer
18521871
minimum: 1
18531872
maximum: 127
1873+
ipFamilySubnets:
1874+
type: array
1875+
minItems: 1
1876+
maxItems: 2
1877+
x-kubernetes-validations:
1878+
- message: ipFamilySubnets must not contain duplicate IP families
1879+
rule: "self.size() < 2 || self[0].gateway.contains(':') != self[1].gateway.contains(':')"
1880+
items:
1881+
type: object
1882+
required:
1883+
- gateway
1884+
- prefixLength
1885+
properties:
1886+
gateway:
1887+
type: string
1888+
oneOf:
1889+
- format: ipv4
1890+
- format: ipv6
1891+
prefixLength:
1892+
type: integer
1893+
minimum: 1
1894+
maximum: 127
18541895
vlan:
18551896
type: integer
18561897
minimum: 0

build/yamls/antrea-crds.yml

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,17 +1572,16 @@ spec:
15721572
type: object
15731573
required:
15741574
- appliedTo
1575-
oneOf:
1576-
- anyOf:
1577-
- required:
1578-
- egressIP
1579-
- required:
1580-
- externalIPPool
1581-
- anyOf:
1582-
- required:
1583-
- egressIPs
1584-
- required:
1585-
- externalIPPools
1575+
anyOf:
1576+
- required:
1577+
- egressIP
1578+
- required:
1579+
- egressIPs
1580+
- required:
1581+
- externalIPPool
1582+
x-kubernetes-validations:
1583+
- message: egressIP and egressIPs are mutually exclusive
1584+
rule: "!(has(self.egressIP) && has(self.egressIPs))"
15861585
properties:
15871586
appliedTo:
15881587
type: object
@@ -1648,18 +1647,30 @@ spec:
16481647
- format: ipv6
16491648
egressIPs:
16501649
type: array
1650+
minItems: 2
1651+
maxItems: 2
1652+
x-kubernetes-validations:
1653+
- message: egressIPs must not contain duplicate IP families
1654+
rule: "self.size() < 2 || self[0].contains(':') != self[1].contains(':')"
16511655
items:
16521656
type: string
16531657
oneOf:
1654-
- maxLength: 0
16551658
- format: ipv4
16561659
- format: ipv6
16571660
externalIPPool:
16581661
type: string
1659-
externalIPPools:
1662+
ipFamilies:
16601663
type: array
1664+
minItems: 1
1665+
maxItems: 2
1666+
x-kubernetes-validations:
1667+
- message: ipFamilies must not contain duplicate entries
1668+
rule: "self.size() < 2 || self[0] != self[1]"
16611669
items:
16621670
type: string
1671+
enum:
1672+
- IPv4
1673+
- IPv6
16631674
bandwidth:
16641675
type: object
16651676
required:
@@ -1817,9 +1828,17 @@ spec:
18171828
- format: ipv6
18181829
subnetInfo:
18191830
type: object
1820-
required:
1821-
- gateway
1822-
- prefixLength
1831+
oneOf:
1832+
- required:
1833+
- gateway
1834+
- prefixLength
1835+
- required:
1836+
- ipFamilySubnets
1837+
x-kubernetes-validations:
1838+
- message: gateway and prefixLength cannot be set with ipFamilySubnets
1839+
rule: >-
1840+
!has(self.ipFamilySubnets) ||
1841+
!(has(self.gateway) || has(self.prefixLength))
18231842
properties:
18241843
gateway:
18251844
type: string
@@ -1830,6 +1849,28 @@ spec:
18301849
type: integer
18311850
minimum: 1
18321851
maximum: 127
1852+
ipFamilySubnets:
1853+
type: array
1854+
minItems: 1
1855+
maxItems: 2
1856+
x-kubernetes-validations:
1857+
- message: ipFamilySubnets must not contain duplicate IP families
1858+
rule: "self.size() < 2 || self[0].gateway.contains(':') != self[1].gateway.contains(':')"
1859+
items:
1860+
type: object
1861+
required:
1862+
- gateway
1863+
- prefixLength
1864+
properties:
1865+
gateway:
1866+
type: string
1867+
oneOf:
1868+
- format: ipv4
1869+
- format: ipv6
1870+
prefixLength:
1871+
type: integer
1872+
minimum: 1
1873+
maximum: 127
18331874
vlan:
18341875
type: integer
18351876
minimum: 0

0 commit comments

Comments
 (0)