Skip to content

Commit

Permalink
Unify IPPool subnet and ExternalIPPool definitions
Browse files Browse the repository at this point in the history
1. Make IPPoolSpec of IPPool use the same way to define IP ranges
and subnet as ExternalIPPool.With this change, one IPPool can have
multiple IP Ranges, but it can only have one SubnetInfo, so this change
also adjusts the related tests, especially the ones for antrea ipam validation.

2. Deprecated IPVersion field in IPPool definition.

3. Change IPPool VLAN from uint16 to int32 to be consisitent
with ExternalIPPool definition.

4. Promote IPPool CRD to v1beta1

5. Add conversion webhook to IPPool for compatibility.

Fixes:#5961

Signed-off-by: Mengdie Song <[email protected]>
  • Loading branch information
mengdie-song committed Apr 24, 2024
1 parent 27424c3 commit c07b1b6
Show file tree
Hide file tree
Showing 48 changed files with 2,789 additions and 525 deletions.
128 changes: 127 additions & 1 deletion build/charts/antrea/crds/ippool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ metadata:
name: ippools.crd.antrea.io
labels:
app: antrea
served-by: antrea-controller
spec:
group: crd.antrea.io
versions:
- name: v1alpha2
served: true
storage: true
storage: false
deprecated: true
deprecationWarning: "crd.antrea.io/v1alpha2 IPPool is deprecated; use crd.antrea.io/v1beta1 IPPool"
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -122,6 +125,129 @@ spec:
type: date
subresources:
status: {}
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required:
- spec
properties:
spec:
required:
- ipRanges
- subnetInfo
type: object
properties:
ipRanges:
items:
oneOf:
- required:
- cidr
- required:
- start
- end
properties:
cidr:
format: cidr
type: string
start:
oneOf:
- format: ipv4
- format: ipv6
type: string
end:
oneOf:
- format: ipv4
- format: ipv6
type: string
type: object
type: array
subnetInfo:
type: object
required:
- gateway
- prefixLength
properties:
gateway:
type: string
oneOf:
- format: ipv4
- format: ipv6
prefixLength:
type: integer
minimum: 1
maximum: 127
vlan:
type: integer
minimum: 0
maximum: 4094
status:
properties:
ipAddresses:
items:
properties:
ipAddress:
type: string
owner:
properties:
pod:
properties:
name:
type: string
namespace:
type: string
containerID:
type: string
ifName:
type: string
type: object
statefulSet:
properties:
name:
type: string
namespace:
type: string
index:
type: integer
type: object
type: object
phase:
type: string
type: object
type: array
usage:
properties:
used:
type: integer
total:
type: integer
type: object
type: object
additionalPrinterColumns:
- description: The number of total IPs
jsonPath: .status.usage.total
name: Total
type: integer
- description: The number of allocated IPs
jsonPath: .status.usage.used
name: Used
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
subresources:
status: {}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions: ["v1", "v1beta1"]
clientConfig:
service:
name: "antrea"
namespace: "kube-system"
path: "/convert/ippool"
scope: Cluster
names:
plural: ippools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha2"]
apiVersions: ["v1beta1"]
resources: ["ippools"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
130 changes: 128 additions & 2 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1771,12 +1771,15 @@ metadata:
name: ippools.crd.antrea.io
labels:
app: antrea
served-by: antrea-controller
spec:
group: crd.antrea.io
versions:
- name: v1alpha2
served: true
storage: true
storage: false
deprecated: true
deprecationWarning: "crd.antrea.io/v1alpha2 IPPool is deprecated; use crd.antrea.io/v1beta1 IPPool"
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -1889,6 +1892,129 @@ spec:
type: date
subresources:
status: {}
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
required:
- spec
properties:
spec:
required:
- ipRanges
- subnetInfo
type: object
properties:
ipRanges:
items:
oneOf:
- required:
- cidr
- required:
- start
- end
properties:
cidr:
format: cidr
type: string
start:
oneOf:
- format: ipv4
- format: ipv6
type: string
end:
oneOf:
- format: ipv4
- format: ipv6
type: string
type: object
type: array
subnetInfo:
type: object
required:
- gateway
- prefixLength
properties:
gateway:
type: string
oneOf:
- format: ipv4
- format: ipv6
prefixLength:
type: integer
minimum: 1
maximum: 127
vlan:
type: integer
minimum: 0
maximum: 4094
status:
properties:
ipAddresses:
items:
properties:
ipAddress:
type: string
owner:
properties:
pod:
properties:
name:
type: string
namespace:
type: string
containerID:
type: string
ifName:
type: string
type: object
statefulSet:
properties:
name:
type: string
namespace:
type: string
index:
type: integer
type: object
type: object
phase:
type: string
type: object
type: array
usage:
properties:
used:
type: integer
total:
type: integer
type: object
type: object
additionalPrinterColumns:
- description: The number of total IPs
jsonPath: .status.usage.total
name: Total
type: integer
- description: The number of allocated IPs
jsonPath: .status.usage.used
name: Used
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
subresources:
status: {}
conversion:
strategy: Webhook
webhook:
conversionReviewVersions: ["v1", "v1beta1"]
clientConfig:
service:
name: "antrea"
namespace: "kube-system"
path: "/convert/ippool"
scope: Cluster
names:
plural: ippools
Expand Down Expand Up @@ -5378,7 +5504,7 @@ webhooks:
rules:
- operations: ["CREATE", "UPDATE", "DELETE"]
apiGroups: ["crd.antrea.io"]
apiVersions: ["v1alpha2"]
apiVersions: ["v1beta1"]
resources: ["ippools"]
scope: "Cluster"
admissionReviewVersions: ["v1", "v1beta1"]
Expand Down
Loading

0 comments on commit c07b1b6

Please sign in to comment.