@@ -24,12 +24,14 @@ const (
24
24
DefaultRefreshDelay = 1 * time .Second
25
25
// DefaultMaxIPs default maximum allocatable IPs
26
26
DefaultMaxIPs = 250
27
+ // fieldManager is the field manager used when patching the NodeNetworkConfig.
28
+ fieldManager = "azure-cns"
27
29
// Subnet ARM ID /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/$(SUBNET)
28
30
subnetARMIDTemplate = "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s"
29
31
)
30
32
31
33
type nodeNetworkConfigSpecUpdater interface {
32
- UpdateSpec (context.Context , * v1alpha.NodeNetworkConfigSpec ) (* v1alpha.NodeNetworkConfig , error )
34
+ PatchSpec (context.Context , * v1alpha.NodeNetworkConfigSpec , string ) (* v1alpha.NodeNetworkConfig , error )
33
35
}
34
36
35
37
// metaState is the Monitor's configuration state for the IP pool.
@@ -281,7 +283,7 @@ func (pm *Monitor) increasePoolSize(ctx context.Context, meta metaState, state i
281
283
282
284
logger .Printf ("[ipam-pool-monitor] Increasing pool size, pool %+v, spec %+v" , state , tempNNCSpec )
283
285
284
- if _ , err := pm .nnccli .UpdateSpec (ctx , & tempNNCSpec ); err != nil {
286
+ if _ , err := pm .nnccli .PatchSpec (ctx , & tempNNCSpec , fieldManager ); err != nil {
285
287
// caller will retry to update the CRD again
286
288
return errors .Wrap (err , "executing UpdateSpec with NNC client" )
287
289
}
@@ -347,7 +349,7 @@ func (pm *Monitor) decreasePoolSize(ctx context.Context, meta metaState, state i
347
349
attempts := 0
348
350
if err := retry .Do (func () error {
349
351
attempts ++
350
- _ , err := pm .nnccli .UpdateSpec (ctx , & tempNNCSpec )
352
+ _ , err := pm .nnccli .PatchSpec (ctx , & tempNNCSpec , fieldManager )
351
353
if err != nil {
352
354
// caller will retry to update the CRD again
353
355
logger .Printf ("failed to update NNC spec attempt #%d, err: %v" , attempts , err )
@@ -378,7 +380,7 @@ func (pm *Monitor) decreasePoolSize(ctx context.Context, meta metaState, state i
378
380
func (pm * Monitor ) cleanPendingRelease (ctx context.Context ) error {
379
381
tempNNCSpec := pm .createNNCSpecForCRD ()
380
382
381
- _ , err := pm .nnccli .UpdateSpec (ctx , & tempNNCSpec )
383
+ _ , err := pm .nnccli .PatchSpec (ctx , & tempNNCSpec , fieldManager )
382
384
if err != nil {
383
385
// caller will retry to update the CRD again
384
386
return errors .Wrap (err , "executing UpdateSpec with NNC client" )
0 commit comments