Skip to content

Commit

Permalink
Propagated the NC Status inside the CNS and IPAM Monitor pool states
Browse files Browse the repository at this point in the history
  • Loading branch information
nairashu authored Sep 5, 2023
1 parent 2b55ae8 commit ce6dbe3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cns/NetworkContainerContract.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/Azure/azure-container-networking/cns/types"
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
)
Expand Down Expand Up @@ -95,6 +96,7 @@ type CreateNetworkContainerRequest struct {
AllowHostToNCCommunication bool
AllowNCToHostCommunication bool
EndpointPolicies []NetworkContainerRequestPolicies
NCStatus v1alpha.NetworkContainerStatus
}

// CreateNetworkContainerRequest implements fmt.Stringer for logging
Expand Down
2 changes: 2 additions & 0 deletions cns/ipampool/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type metaState struct {
subnet string
subnetARMID string
subnetCIDR string
nncStatus v1alpha.NetworkContainerStatus
}

type Options struct {
Expand Down Expand Up @@ -120,6 +121,7 @@ func (pm *Monitor) Start(ctx context.Context) error {
pm.metastate.subnet = nnc.Status.NetworkContainers[0].SubnetName
pm.metastate.subnetCIDR = nnc.Status.NetworkContainers[0].SubnetAddressSpace
pm.metastate.subnetARMID = GenerateARMID(&nnc.Status.NetworkContainers[0])
pm.metastate.nncStatus = nnc.Status.NetworkContainers[0].UpdateStatus
}
pm.metastate.primaryIPAddresses = make(map[string]struct{})
// Add Primary IP to Map, if not present.
Expand Down
1 change: 1 addition & 0 deletions cns/kubecontroller/nodenetworkconfig/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func CreateNCRequestFromDynamicNC(nc v1alpha.NetworkContainer) (*cns.CreateNetwo
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus,
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions cns/kubecontroller/nodenetworkconfig/conversion_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus,
}, nil
}
1 change: 1 addition & 0 deletions cns/kubecontroller/nodenetworkconfig/conversion_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
IPSubnet: subnet,
GatewayIPAddress: nc.DefaultGateway,
},
NCStatus: nc.UpdateStatus
}, nil
}

0 comments on commit ce6dbe3

Please sign in to comment.