Skip to content

Commit f570f0f

Browse files
committed
[azure] Merge subnets in resyncInstance instead of replacing
Signed-off-by: jaredledvina <jared.ledvina@datadoghq.com>
1 parent 12e325a commit f570f0f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

pkg/azure/ipam/instances.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,19 @@ func (m *InstancesManager) resyncInstance(ctx context.Context, instanceID string
150150
m.mutex.Lock()
151151
defer m.mutex.Unlock()
152152
m.instances.UpdateInstance(instanceID, instance)
153-
m.subnets = subnets
153+
// Merge the freshly-fetched subnets into the cluster-wide map rather
154+
// than replacing it. This per-instance resync only fetches the subnets
155+
// referenced by *this* instance's interfaces, so a wholesale replace
156+
// drops every other node's subnets and causes PrepareIPAllocation on
157+
// other nodes to fall through to the wrong subnet (Azure rejects with
158+
// VMScaleSetIpConfigurationsOnSameNicCannotUseDifferentSubnets). The
159+
// full resync (resyncInstances) is authoritative and replaces wholesale.
160+
if m.subnets == nil {
161+
m.subnets = ipamTypes.SubnetMap{}
162+
}
163+
for id, s := range subnets {
164+
m.subnets[id] = s
165+
}
154166

155167
return resyncStart
156168
}

0 commit comments

Comments
 (0)