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:antrea-io#5961

Signed-off-by: Mengdie Song <[email protected]>
  • Loading branch information
mengdie-song committed Apr 11, 2024
1 parent 90b3710 commit a380cca
Show file tree
Hide file tree
Showing 48 changed files with 2,659 additions and 524 deletions.
127 changes: 126 additions & 1 deletion build/charts/antrea/crds/ippool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ 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
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -122,6 +124,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
129 changes: 127 additions & 2 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2912,12 +2912,14 @@ 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
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -3030,6 +3032,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 @@ -7389,7 +7514,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 a380cca

Please sign in to comment.