Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[do-not-review]Singularitywork #2416

Closed
wants to merge 14 commits into from
Closed

[do-not-review]Singularitywork #2416

wants to merge 14 commits into from

Conversation

paulyufan2
Copy link
Contributor

Reason for Change:

Issue Fixed:

Requirements:

Notes:

return nil, err
}

secondaryIP := ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: var string secondaryIP instead of empty string init

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also Note: we need to pass macAddress in this function & return interface based on i.IsPrimary=false & i.MACAddress==mac

if service.state.secondaryInterface == nil {
res, err := service.wscli.GetInterfaces(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to get interfaces from IMDS")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would be good to add comment on what is IMDS

hostSubnet: response.PodIPInfo[i].HostPrimaryIPInfo.Subnet,
hostPrimaryIP: response.PodIPInfo[i].HostPrimaryIPInfo.PrimaryIP,
hostGateway: response.PodIPInfo[i].HostPrimaryIPInfo.Gateway,
hostSubnet: response.PodIPInfo[i].HostSecondaryIPInfo.Subnet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: change the fields returned here as per NIC type (primary or secondary) as this is a common code path


addSnatInterface(nwCfg, defaultCniResult)
//defaultCniResult := convertInterfaceInfoToCniResult(ipamAddResult.defaultInterfaceInfo, args.IfName)
secondaryCniResult := convertInterfaceInfoToCniResult(ipamAddResult.secondaryInterfacesInfo[0], args.IfName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need branching here to program either default interface or secondary interface - TBD on approach/config to use

zap.String("network", networkID),
zap.String("subnet", nwInfo.Subnets[0].Prefix.String()))
// logger.Info("Found network with subnet",
// zap.String("network", networkID),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have we commented this part? todo: uncomment

@@ -666,7 +676,7 @@ func (plugin *NetPlugin) createNetworkInternal(

// construct network info with ipv4/ipv6 subnets
func addSubnetToNetworkInfo(ipamAddResult IPAMAddResult, nwInfo *network.NetworkInfo) error {
for _, ipConfig := range ipamAddResult.defaultInterfaceInfo.IPConfigs {
for _, ipConfig := range ipamAddResult.secondaryInterfacesInfo[0].IPConfigs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add branching or call different function on L678 (new function for secondary nics)

@@ -707,15 +717,24 @@ func (plugin *NetPlugin) createEndpointInternal(opt *createEndpointInternalOpt)
epInfo := network.EndpointInfo{}

defaultInterfaceInfo := opt.ipamAddResult.defaultInterfaceInfo
epDNSInfo, err := getEndpointDNSSettings(opt.nwCfg, defaultInterfaceInfo.DNS, opt.k8sNamespace)
secondaryInterfaceInfo := opt.ipamAddResult.secondaryInterfacesInfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need branching here too for primary vs secondary nics

@@ -489,6 +491,7 @@ type IPConfigsRequest struct {
OrchestratorContext json.RawMessage `json:"orchestratorContext"`
Ifname string `json:"ifname"` // Used by delegated IPAM
SecondaryInterfacesExist bool `json:"secondaryInterfacesExist"` // will be set by SWIFT v2 validator func
ProgramSecondaryNICOnly bool `json:"programSecondaryNICOnly"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: kmurudi: remove & use the previous field if possible to set

}, err
}
}
// if service.Options[common.OptManageEndpointState] == true {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: we need to discuss branching here or take it up in my PR

if err != nil {
return nil, err
}

return nw.newEndpointImplHnsV2(cli, epInfo[0])
return nw.newEndpointImplHnsV2(cli, epInfo[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to choose the right endpoint here based on interface

@@ -206,6 +207,10 @@ func (nw *network) addIPv6NeighborEntryForGateway(epInfo *EndpointInfo, plc plat
func (nw *network) configureHcnEndpoint(epInfo *EndpointInfo) (*hcn.HostComputeEndpoint, error) {
infraEpName, _ := ConstructEndpointID(epInfo.ContainerID, epInfo.NetNsPath, epInfo.IfName)

mac := epInfo.MacAddress.String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will these new fields be needed for every request? (primary, non-swift2.0, secondary) if not need branching here too

@@ -338,6 +339,12 @@ func (nm *networkManager) CreateEndpoint(cli apipaClient, networkID string, epIn
return err
}

for _, n := range nw.Endpoints {
n.IfName = "eth0"
n.Id = n.Id + "eth0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add constant variable for this string addition

@@ -290,10 +290,14 @@ func (nm *networkManager) configureHcnNetwork(nwInfo *NetworkInfo, extIf *extern
hcnNetwork.Type = hcn.L2Bridge
case opModeTunnel:
hcnNetwork.Type = hcn.L2Tunnel
case opModeTransparent:
hcnNetwork.Type = hcn.Transparent
hcnNetwork.Flags = 1024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: determine later if we need this flag constant or hns changes will support this

Copy link

github-actions bot commented Jan 3, 2024

This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale due to inactivity. label Jan 3, 2024
Copy link

Pull request closed due to inactivity.

@github-actions github-actions bot closed this Jan 11, 2024
@github-actions github-actions bot deleted the singularitywork branch January 11, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants