Skip to content

Commit 5eb8c8d

Browse files
committed
more TODOs
1 parent f0cf0da commit 5eb8c8d

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

cns/kubecontroller/nodenetworkconfig/conversion_linux.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,23 @@ func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPre
1818

1919
// iterate through all IP addresses in the subnet described by primaryPrefix and
2020
// add them to the request as secondary IPConfigs.
21+
// TODO: If we decide to look to not change the contract to add an IPFamilies flag and just detect it we would have to do it here
22+
// By doing this we can also have it work for Dualstack Overlay
23+
// To do it we would need to pass in a pointer to an IPFamilies slice to this function and add the family of the IPs added in
24+
// Here we check the primary CIDR which is needed for overlay and VNET Block
2125
for addr := primaryIPPrefix.Masked().Addr(); primaryIPPrefix.Contains(addr); addr = addr.Next() {
2226
secondaryIPConfigs[addr.String()] = cns.SecondaryIPConfig{
2327
IPAddress: addr.String(),
2428
NCVersion: int(nc.Version),
2529
}
30+
2631
}
2732

2833
// Add IPs from CIDR block to the secondary IPConfigs
2934
if nc.Type == v1alpha.VNETBlock {
3035

3136
for _, ipAssignment := range nc.IPAssignments {
37+
// Here we would need to check all other assigned CIDR Blocks that aren't the primary.
3238
cidrPrefix, err := netip.ParsePrefix(ipAssignment.IP)
3339
if err != nil {
3440
return nil, errors.Wrapf(err, "invalid CIDR block: %s", ipAssignment.IP)

cns/middlewares/k8sSwiftV2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var _ cns.IPConfigsHandlerMiddleware = (*K8sSWIFTv2Middleware)(nil)
3838

3939
// IPConfigsRequestHandlerWrapper is the middleware function for handling SWIFT v2 IP configs requests for AKS-SWIFT. This function wrapped the default SWIFT request
4040
// and release IP configs handlers.
41-
// this will need to change to also work for a delegated NIC with multiple IPs
41+
// TODO: this will need to changed or add a new function to also work for a delegated NIC with multiple pods
4242
func (k *K8sSWIFTv2Middleware) IPConfigsRequestHandlerWrapper(defaultHandler, failureHandler cns.IPConfigsHandlerFunc) cns.IPConfigsHandlerFunc {
4343
return func(ctx context.Context, req cns.IPConfigsRequest) (*cns.IPConfigsResponse, error) {
4444
podInfo, respCode, message := k.validateIPConfigsRequest(ctx, &req)

cns/middlewares/k8sSwiftV2_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
1818
var routes []cns.Route
1919

2020
switch podIPInfo.NICType {
21+
// TODO: We may want to create a new type of NIC. Currently we are using delegated NICs but this set routes method only
22+
// takes in for the multitenant scenario. We should have a new case that behaves similarly to InfraNIC but for a delegated NIC
23+
// Q: Does the code currently see the kube pods as Infra or Delegated? They currently use the delegated pod subnet for IPs
2124
case cns.DelegatedVMNIC:
2225
virtualGWRoute := cns.Route{
2326
IPAddress: fmt.Sprintf("%s/%d", virtualGW, prefixLength),
@@ -65,6 +68,7 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
6568
return errors.Wrapf(err, "failed to parse podIPConfig IP address %s", podIPInfo.PodIPConfig.IPAddress)
6669
}
6770

71+
//This function is called per IP so we shouldn't have to worry about adding both v4 and v6 at once
6872
if ip.Is4() {
6973
routes = append(routes, addRoutes(podCIDRsV4, overlayGatewayv4)...)
7074
routes = append(routes, addRoutes(serviceCIDRsV4, overlayGatewayv4)...)

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
2020

2121
// assignSubnetPrefixLengthFields will assign the subnet-prefix length to some fields of podipinfo
2222
// this is required for the windows scenario so that HNS programming is successful for pods
23+
// TODO: This is being used for the delegated NIC for Windows solution. Once we are testing Windows we will
24+
// Need to confirm that this assigns the whole pod subnet that we expect for both v4 and v6
2325
func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(podIPInfo *cns.PodIpInfo, interfaceInfo v1alpha1.InterfaceInfo, ip string) error {
2426
// Parse MTPNC SubnetAddressSpace to get the subnet prefix length
2527
subnet, subnetPrefix, err := utils.ParseIPAndPrefix(interfaceInfo.SubnetAddressSpace)

0 commit comments

Comments
 (0)