Skip to content

Commit 0258be2

Browse files
refactor: remove public ipam reconciler interface
1 parent 2d80ab1 commit 0258be2

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

cns/ipam/interfaces.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

cns/nodesubnet/initialization.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ import (
44
"context"
55

66
"github.com/Azure/azure-container-networking/cns"
7-
"github.com/Azure/azure-container-networking/cns/ipam"
87
"github.com/Azure/azure-container-networking/cns/logger"
9-
"github.com/Azure/azure-container-networking/cns/types"
8+
cnstypes "github.com/Azure/azure-container-networking/cns/types"
9+
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
1010
"github.com/pkg/errors"
1111
"golang.org/x/exp/maps"
1212
)
1313

14-
func ReconcileInitialCNSState(_ context.Context, ipamReconciler ipam.StateReconciler, podInfoByIPProvider cns.PodInfoByIPProvider) (int, error) {
14+
type ipamReconciler interface {
15+
ReconcileIPAMState(ncRequests []*cns.CreateNetworkContainerRequest, podInfoByIP map[string]cns.PodInfo, nnc *v1alpha.NodeNetworkConfig) cnstypes.ResponseCode
16+
}
17+
18+
func ReconcileInitialCNSState(_ context.Context, ipamReconciler ipamReconciler, podInfoByIPProvider cns.PodInfoByIPProvider) (int, error) {
1519
// Get previous PodInfo state from podInfoByIPProvider
1620
podInfoByIP, err := podInfoByIPProvider.PodInfoByIP()
1721
if err != nil {
@@ -25,7 +29,7 @@ func ReconcileInitialCNSState(_ context.Context, ipamReconciler ipam.StateReconc
2529
ncRequest := CreateNodeSubnetNCRequest(secondaryIPs)
2630
responseCode := ipamReconciler.ReconcileIPAMState([]*cns.CreateNetworkContainerRequest{ncRequest}, podInfoByIP, nil)
2731

28-
if responseCode != types.Success {
32+
if responseCode != cnstypes.Success {
2933
return 0, errors.Errorf("failed to reconcile initial CNS state: %d", responseCode)
3034
}
3135

0 commit comments

Comments
 (0)