Skip to content

Azure backports#668

Merged
HadrienPatte merged 2 commits into
v1.19-ddfrom
hadrien/1.19/azure-backports
May 28, 2026
Merged

Azure backports#668
HadrienPatte merged 2 commits into
v1.19-ddfrom
hadrien/1.19/azure-backports

Conversation

@HadrienPatte
Copy link
Copy Markdown
Member

Since Azure does not expose a single API to list all network interfaces
for VMSS instances, the way we currently list them is we first make an
API call to list all VMSSs, then for each VMSS, we make a call to list
its network interfaces. The thing is if a VMSS has zero instances (and
so zero network interfaces), we still make that call to list VMSS
network interfaces. Since the initial call that listed all VMSS also
returned the number of instances in each VMSS, we can skip empty ones to
save unnecessary API calls.

Not only is this good for API call rate limit buckets consumption, but
since each VMSS listNetworkInterfaces calls are done serially, this can
also significantly speed up the overall instance sync.

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
`resyncInstance` previously called `GetInstance` twice:
* once with an empty subnet map to discover referenced subnet IDs
* then again with the resolved subnets to repopulate CIDR/gateway info.

Each end up causing Azure API calls through
`listVirtualMachineScaleSetVMNetworkInterfaces` even though the NIC data
returned is identical in both cases.

This PR mirrors the fetch-once/parse-twice pattern already used by the
full-cluster `resyncInstances` path: call `ListVMNetworkInterfaces` once,
then run `ParseInterfacesIntoInstance` twice (first with an empty subnet
map, then with the resolved subnets). The second parse is a pure
in-memory operation, eliminating the redundant `GetInstance` call per
InstanceSync.

Note: Since `GetInstance` was a wrapper over `ListVMNetworkInterfaces` +
`ParseInterfacesIntoInstance` but we now run those separately as we only
get once and parse twice, the `GetInstance` function is no longer used
and is removed. Similarly, the already unused `GetInstances` function is
removed as well.

Signed-off-by: Hadrien Patte <hadrien.patte@datadoghq.com>
@HadrienPatte HadrienPatte marked this pull request as ready for review May 28, 2026 10:14
@HadrienPatte HadrienPatte merged commit 0f14f8d into v1.19-dd May 28, 2026
27 checks passed
@HadrienPatte HadrienPatte deleted the hadrien/1.19/azure-backports branch May 28, 2026 15:13
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.

2 participants