Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify documentation for IPPool and ExternalIPPool CRDs #6183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/antrea-ipam.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,17 @@ spec:
## `IPPool` CRD

Antrea IP pools are defined with the `IPPool` CRD. The following two examples
define an IPv4 and an IPv6 IP pool respectively.
define an IPv4 and an IPv6 IP pool respectively. The first example (IPv4) uses a
CIDR to define the range of allocatable IPs, while the second example uses a
"range", with a start and end IP address. When using a CIDR, it is important to
keep in mind that the first IP in the CIDR will be excluded and will never be
allocated. When the CIDR represents a traditional subnet, the first IP is
typically the "network IP". Additionally, for IPv4, when the `prefixLength`
matches the CIDR mask size, the last IP in the CIDR, which traditionally
represents the "broadcast IP", will also be excluded. The provided gateway IP
will of course always be excluded. On the other hand, when using a range with a
start and end IP address, both of these IPs will be allocatable (except if one
of them corresponds to the gateway).

```yaml
apiVersion: "crd.antrea.io/v1alpha2"
Expand All @@ -449,9 +459,10 @@ metadata:
spec:
ipVersion: 4
ipRanges:
# 61 different IPs can be allocated from this pool: 64 (2^6) - 3 (network IP, broadcast IP, gateway IP).
- cidr: "10.10.1.0/26"
gateway: "10.10.1.1"
prefixLength: 24
prefixLength: 26
```

```yaml
Expand All @@ -462,6 +473,7 @@ metadata:
spec:
ipVersion: 6
ipRanges:
# 257 different IPs can be allocated from this pool: 0x200 - 0x100 + 1.
- start: "3ffe:ffff:1:01ff::0100"
end: "3ffe:ffff:1:01ff::0200"
gateway: "3ffe:ffff:1:01ff::1"
Expand Down
9 changes: 9 additions & 0 deletions docs/egress.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ The `ipRanges` field contains a list of IP ranges representing the available IPs
of this IP pool. Each IP range may consist of a `cidr` or a pair of `start` and
`end` IPs (which are themselves included in the range).

When using a CIDR to define an IP range, it is important to keep in mind that
the first IP in the CIDR will be excluded and will never be allocated. This is
because when the CIDR represents a traditional subnet, the first IP is typically
the "network IP". Additionally, for IPv4, the last IP in the CIDR, which
traditionally represents the "broadcast IP", will also be excluded. As a result,
providing a /32 CIDR or a /31 CIDR will yield an empty pool of IP addresses. A
/28 CIDR will yield 14 allocatable IP addresses. In the future we may make this
behavior configurable, so that the full CIDR can be used if desired.

### SubnetInfo

By default, it's assumed that the IPs allocated from an ExternalIPPool are in
Expand Down