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

feat: support allocating IP with index from node chunk #55

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
136 changes: 76 additions & 60 deletions api/grpc/nvidia/ipam/node/v1/node.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/grpc/proto/nvidia/ipam/node/v1/node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ message IPAMMetadata {
message IPAMFeatures {
// optional, request IP of the default gateway from the pool be allocated for container
bool allocate_default_gateway = 1;
// optional, request IP with the given index in the chunk allocated for the particular node to be allocated for the container
optional int32 allocate_ip_with_index = 2;
}

// IsAllocatedRequest contains parameters for IsAllocated rpc call
Expand Down
13 changes: 7 additions & 6 deletions docs/extra-cni-args.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

The NV-IPAM plugin supports the following [args in network config](https://www.cni.dev/docs/conventions/#args-in-network-config):

| Argument | Type | Description |
|------------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ips | `[]string` | Request static IPs from the pool |
| poolNames | `[]string,` max len is 2 | Name of the pools to be used for IP allocation. _The field has higher priority than `ipam.poolName` |
| poolType | `string` | Type (`ippool`, `cidrpool`) of the pool which is referred by the `poolNames`. _The field has higher priority than_ `ipam.poolType` |
| allocateDefaultGateway | `bool` | Request to allocate pool's default gateway as interface IP address for the container. Pool must have the gateway when this argument is used. The argument can't be used together with static IP request. |
| Argument | Type | Description |
|------------------------|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ips | `[]string` | Request static IPs from the pool |
| poolNames | `[]string,` max len is 2 | Name of the pools to be used for IP allocation. _The field has higher priority than `ipam.poolName` |
| poolType | `string` | Type (`ippool`, `cidrpool`) of the pool which is referred by the `poolNames`. _The field has higher priority than_ `ipam.poolType` |
| allocateDefaultGateway | `bool` | Request to allocate pool's default gateway as interface IP address for the container. Pool must have the gateway when this argument is used. The argument can't be used together with static IP request or with allocating IP of specific index. |
| allocateIPWithIndex | `int` | Request to allocate pool's IP with the given index as interface IP address for the container. The argument can't be used together with static IP request or with allocating the gateway IP. |



Expand Down
1 change: 1 addition & 0 deletions pkg/cni/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func cniConfToGRPCReq(conf *types.NetConf, args *skel.CmdArgs) *nodev1.IPAMParam
RequestedIps: requestedIPs,
Features: &nodev1.IPAMFeatures{
AllocateDefaultGateway: conf.IPAM.Features.AllocateDefaultGateway,
AllocateIpWithIndex: conf.IPAM.Features.AllocateIPWithIndex,
},
}
if req.Metadata.K8SPodUid == "" {
Expand Down
Loading
Loading