Skip to content

Add registeredIPAddresses (reserve specific IPs in IPAM without NIC allocation)#435

Merged
yingzhan-msft merged 3 commits into
mainfrom
users/yingzhan/moc-reserveip
Jun 4, 2026
Merged

Add registeredIPAddresses (reserve specific IPs in IPAM without NIC allocation)#435
yingzhan-msft merged 3 commits into
mainfrom
users/yingzhan/moc-reserveip

Conversation

@yingzhan-msft

Copy link
Copy Markdown
Contributor

Add registeredIPAddresses (reserve specific IPs in IPAM without NIC allocation)

Add proto support for the new registeredIPAddresses feature, which lets a
caller mark specific IPs as reserved in IPAM without allocating them to a
NIC/LB. The reserved IPs are persisted on each IPPool and survive
restarts.

Proto changes:

  • rpc/common/moc_common_networkcommon.proto:

    • IPPool.registeredIPAddresses (field 7): per-pool list of registered IPs
      (storage layer; rehydration loops directly without re-running pool
      range-routing).
    • IPUpdateErrorCode enum: per-IP failure codes
      (UNKNOWN, INVALID_FORMAT, OUT_OF_RANGE, SUBNET_NOT_FOUND,
      ALREADY_ALLOCATED, NO_POOLS_IN_SUBNET).
    • IPAddressUpdateFailure message: { SubnetName, IPAddress, Code, Error }.
  • rpc/cloudagent/network/{logicalnetwork,virtualnetwork}/*.proto:

    • UpdateRegisteredIPs RPC.
    • {Logical,Virtual}NetworkIPUpdateRequest / Response.
    • {Logical,Virtual}SubnetIPUpdate { SubnetName, RegisteredIPAddresses[] }
      (subnet-scoped flat list; cloudagent routes IPs to pools by range).

The dual layer (subnet-scoped on the wire, per-pool in storage) keeps the
RPC ergonomic while making rehydration cheap and self-describing.

…llocation)

Add proto support for the new registeredIPAddresses feature, which lets a
caller mark specific IPs as reserved in IPAM without allocating them to a
NIC/LB. The reserved IPs are persisted on each IPPool and survive
restarts.

Proto changes:
- rpc/common/moc_common_networkcommon.proto:
  - IPPool.registeredIPAddresses (field 7): per-pool list of registered IPs
    (storage layer; rehydration loops directly without re-running pool
    range-routing).
  - IPUpdateErrorCode enum: per-IP failure codes
    (UNKNOWN, INVALID_FORMAT, OUT_OF_RANGE, SUBNET_NOT_FOUND,
    ALREADY_ALLOCATED, NO_POOLS_IN_SUBNET).
  - IPAddressUpdateFailure message: { SubnetName, IPAddress, Code, Error }.

- rpc/cloudagent/network/{logicalnetwork,virtualnetwork}/*.proto:
  - UpdateRegisteredIPs RPC.
  - {Logical,Virtual}NetworkIPUpdateRequest / Response.
  - {Logical,Virtual}SubnetIPUpdate { SubnetName, RegisteredIPAddresses[] }
    (subnet-scoped flat list; cloudagent routes IPs to pools by range).

The dual layer (subnet-scoped on the wire, per-pool in storage) keeps the
RPC ergonomic while making rehydration cheap and self-describing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yingzhan-msft yingzhan-msft force-pushed the users/yingzhan/moc-reserveip branch from 962d2cc to 4bb9f73 Compare May 11, 2026 17:35
The Error field on LogicalNetworkIPUpdateResponse and
VirtualNetworkIPUpdateResponse was never reachable on the wire:
the cloudagent only set it together with a non-OK gRPC status, and
gRPC clients discard the response body on non-OK status. Document
Failures as the per-IP failure channel and the gRPC status as the
whole-batch failure channel; regenerate the .pb.go files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yingzhan-msft yingzhan-msft marked this pull request as ready for review May 19, 2026 00:41
// This RPC is independent of spec Update: it does not run Validate or
// validateUpdate, does not touch ProvisionState, and does not fan out
// to nodeagents.
rpc UpdateRegisteredIPs(LogicalNetworkIPUpdateRequest) returns (LogicalNetworkIPUpdateResponse) {}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refrain from making API changes. We do not plan to make any API changes in MOC.

It is in bug fix mode.

// flows.
message IPAddressUpdateFailure {
string SubnetName = 1;
string IPAddress = 2;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should double check if ip are to be exposed in error string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added IP redaction in the logs. Just wanted to call out one tradeoff: because this is a full-list update, we emit a failure message per IP, and each IP may have a different error code. If the IPs are redacted in logs, it may be harder to debug issues from telemetry.

Mark IP-bearing fields in registeredIPAddresses protos with [(sensitive) = true]
so that redact.RedactedMessage() scrubs them from cloudagent span logs and
telemetry. IPAddressUpdateFailure.Error is intentionally left visible (the
failure reason is meaningful for debugging), with callers responsible for
keeping IPs out of the error string.

Affected fields:
- IPPool.registeredIPAddresses
- IPAddressUpdateFailure.IPAddress
- LogicalSubnetIPUpdate.RegisteredIPAddresses
- VirtualSubnetIPUpdate.RegisteredIPAddresses

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@yingzhan-msft

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@yingzhan-msft yingzhan-msft merged commit fb23243 into main Jun 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants