Skip to content

Commit

Permalink
IPAM: add support for ippool
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jun 19, 2023
1 parent 9fbebd3 commit 83b02a3
Show file tree
Hide file tree
Showing 42 changed files with 2,586 additions and 752 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ jobs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 25
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
Expand Down
116 changes: 116 additions & 0 deletions charts/templates/kube-ovn-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,122 @@ spec:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: ippools.kubeovn.io
spec:
group: kubeovn.io
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns:
- name: Subnet
type: string
jsonPath: .spec.subnet
- name: Protocol
type: string
jsonPath: .spec.protocol
- name: IPs
type: string
jsonPath: .spec.ips
- name: V4Used
type: number
jsonPath: .status.v4UsingIPs
- name: V4Available
type: number
jsonPath: .status.v4AvailableIPs
- name: V6Used
type: number
jsonPath: .status.v6UsingIPs
- name: V6Available
type: number
jsonPath: .status.v6AvailableIPs
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
subnet:
type: string
x-kubernetes-validations:
- rule: "self == oldSelf"
message: "This field is immutable."
namespaces:
type: array
x-kubernetes-list-type: set
items:
type: string
protocol:
type: string
enum:
- IPv4
- IPv6
- Dual
ips:
type: array
minItems: 1
x-kubernetes-list-type: set
items:
type: string
anyOf:
- format: ipv4
- format: ipv6
- format: cidr
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.\.(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))\.\.((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
required:
- subnet
- ips
status:
type: object
properties:
v4AvailableIPs:
type: number
v4UsingIPs:
type: number
v6AvailableIPs:
type: number
v6UsingIPs:
type: number
v4AvailableIPRange:
type: string
v4UsingIPRange:
type: string
v6AvailableIPRange:
type: string
v6UsingIPRange:
type: string
conditions:
type: array
items:
type: object
properties:
type:
type: string
status:
type: string
reason:
type: string
message:
type: string
lastUpdateTime:
type: string
lastTransitionTime:
type: string
scope: Cluster
names:
plural: ippools
singular: ippool
kind: IPPool
shortNames:
- ippool
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: vlans.kubeovn.io
spec:
Expand Down
2 changes: 2 additions & 0 deletions charts/templates/ovn-CR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ rules:
- vpc-nat-gateways/status
- subnets
- subnets/status
- ippools
- ippools/status
- ips
- vips
- vips/status
Expand Down
31 changes: 25 additions & 6 deletions dist/images/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ for slr in $(kubectl get switch-lb-rule -o name); do
kubectl delete --ignore-not-found $slr
done

for ippool in $(kubectl get ippool -o name); do
kubectl delete --ignore-not-found $ippool
done

set +e
for subnet in $(kubectl get subnet -o name); do
kubectl patch "$subnet" --type='json' -p '[{"op": "replace", "path": "/metadata/finalizers", "value": []}]'
Expand Down Expand Up @@ -108,12 +112,27 @@ kubectl delete --ignore-not-found clusterrolebinding vpc-dns
kubectl delete --ignore-not-found sa vpc-dns -n kube-system

# delete CRD
kubectl delete --ignore-not-found crd htbqoses.kubeovn.io security-groups.kubeovn.io ips.kubeovn.io subnets.kubeovn.io \
vpc-nat-gateways.kubeovn.io vpcs.kubeovn.io vlans.kubeovn.io provider-networks.kubeovn.io \
iptables-dnat-rules.kubeovn.io iptables-eips.kubeovn.io iptables-fip-rules.kubeovn.io \
iptables-snat-rules.kubeovn.io vips.kubeovn.io switch-lb-rules.kubeovn.io vpc-dnses.kubeovn.io \
ovn-eips.kubeovn.io ovn-fips.kubeovn.io ovn-snat-rules.kubeovn.io ovn-dnat-rules.kubeovn.io \
qos-policies.kubeovn.io
kubectl delete --ignore-not-found crd \
htbqoses.kubeovn.io \
security-groups.kubeovn.io \
ips.kubeovn.io \
ippools.kubeovn.io \
subnets.kubeovn.io \
vpc-nat-gateways.kubeovn.io \
vpcs.kubeovn.io \
vlans.kubeovn.io \
provider-networks.kubeovn.io \
iptables-dnat-rules.kubeovn.io \
iptables-eips.kubeovn.io \
iptables-fip-rules.kubeovn.io \
iptables-snat-rules.kubeovn.io \
vips.kubeovn.io \
switch-lb-rules.kubeovn.io \
vpc-dnses.kubeovn.io \
ovn-eips.kubeovn.io ovn-fips.kubeovn.io \
ovn-snat-rules.kubeovn.io \
ovn-dnat-rules.kubeovn.io \
qos-policies.kubeovn.io

# Remove annotations/labels in namespaces and nodes
kubectl annotate no --all ovn.kubernetes.io/cidr-
Expand Down
118 changes: 118 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,122 @@ spec:
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: ippools.kubeovn.io
spec:
group: kubeovn.io
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
additionalPrinterColumns:
- name: Subnet
type: string
jsonPath: .spec.subnet
- name: Protocol
type: string
jsonPath: .spec.protocol
- name: IPs
type: string
jsonPath: .spec.ips
- name: V4Used
type: number
jsonPath: .status.v4UsingIPs
- name: V4Available
type: number
jsonPath: .status.v4AvailableIPs
- name: V6Used
type: number
jsonPath: .status.v6UsingIPs
- name: V6Available
type: number
jsonPath: .status.v6AvailableIPs
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
subnet:
type: string
x-kubernetes-validations:
- rule: "self == oldSelf"
message: "This field is immutable."
namespaces:
type: array
x-kubernetes-list-type: set
items:
type: string
protocol:
type: string
enum:
- IPv4
- IPv6
- Dual
ips:
type: array
minItems: 1
x-kubernetes-list-type: set
items:
type: string
anyOf:
- format: ipv4
- format: ipv6
- format: cidr
- pattern: ^(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.\.(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])$
- pattern: ^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))\.\.((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|:)))$
required:
- subnet
- ips
status:
type: object
properties:
v4AvailableIPs:
type: number
v4UsingIPs:
type: number
v6AvailableIPs:
type: number
v6UsingIPs:
type: number
v4AvailableIPRange:
type: string
v4UsingIPRange:
type: string
v6AvailableIPRange:
type: string
v6UsingIPRange:
type: string
conditions:
type: array
items:
type: object
properties:
type:
type: string
status:
type: string
reason:
type: string
message:
type: string
lastUpdateTime:
type: string
lastTransitionTime:
type: string
scope: Cluster
names:
plural: ippools
singular: ippool
kind: IPPool
shortNames:
- ippool
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: vlans.kubeovn.io
spec:
Expand Down Expand Up @@ -2742,6 +2858,8 @@ rules:
- vpc-nat-gateways/status
- subnets
- subnets/status
- ippools
- ippools/status
- ips
- vips
- vips/status
Expand Down
Loading

0 comments on commit 83b02a3

Please sign in to comment.