Skip to content

Conversation

@matmerr
Copy link
Member

@matmerr matmerr commented Jun 29, 2020

Reason for Change:

Using the CNS IPAM found in #584

Issue Fixed:

Requirements:

Notes:

@matmerr matmerr added work-in-progress cni Related to CNI. labels Jun 29, 2020
@codecov
Copy link

codecov bot commented Jul 8, 2020

Codecov Report

Merging #597 into master will decrease coverage by 3.14%.
The diff coverage is 8.69%.

@@            Coverage Diff             @@
##           master     #597      +/-   ##
==========================================
- Coverage   41.72%   38.57%   -3.15%     
==========================================
  Files          72       78       +6     
  Lines        9474    10416     +942     
==========================================
+ Hits         3953     4018      +65     
- Misses       5052     5907     +855     
- Partials      469      491      +22     

@matmerr matmerr marked this pull request as ready for review July 17, 2020 01:23
cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
)

type IPAMInvoker interface {
Copy link
Member

Choose a reason for hiding this comment

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

Document your interface? What is deletepoolonerrr? for example?

Here's a question from left field. Is there a future where we want other cni's invoking cns for ipam? Or would we want them to use the crd? If we think they might want to hit up cns making this interface really clear might pay future dividedends.

Copy link
Member

Choose a reason for hiding this comment

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

Also that first result is ipv4 second is ipv6. (hopefully I die before there is ipv8).

cniTypesCurr "github.com/containernetworking/cni/pkg/types/current"
)

type AzureInvoker struct {
Copy link
Member

Choose a reason for hiding this comment

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

nit: AzureIpamInvoker or does it do more?

}
}

switch nwCfg.Ipam.Type {
Copy link
Member

Choose a reason for hiding this comment

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

This is coming from the json that gets laid down with the cni plugin I assume?

Are we allowed to look for the extiance of any other files to make this decision?

nwCfg6.Ipam.Type = ipamV6

if len(nwInfo.Subnets) > 1 {
nwCfg6.Ipam.Subnet = nwInfo.Subnets[1].Prefix.String()
Copy link
Member

Choose a reason for hiding this comment

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

magic number index 1. Know this is old code you're just moving.

Do we have some backlog item to try and prove ipv6 works with cns?

return err
}

return invoker.cnsClient.ReleaseIPAddress(orchestratorContext)
Copy link
Member

Choose a reason for hiding this comment

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

what happens on err? Do we leak, retry, does cns notices and free on its own?


if address.IP.To4() != nil {

if isDeletePoolOnError {
Copy link
Member

Choose a reason for hiding this comment

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

kinda of curious why this is important.

Copy link
Member

@paulgmiller paulgmiller left a comment

Choose a reason for hiding this comment

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

Thanks this help me leared some. Not sure I'm qualified to sign off but looking close in my eyes :)

)

type IPAMInvoker interface {
Add(args *cniSkel.CmdArgs, nwCfg *cni.NetworkConfig, nwInfo network.NetworkInfo, isDeletePoolOnError bool) (*cniTypesCurr.Result, *cniTypesCurr.Result, error)
Copy link
Member

Choose a reason for hiding this comment

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

networkinfo is more specific to azure case. can we intialize that only as part of azureinvoker and remove from interface calls?

Copy link
Member

Choose a reason for hiding this comment

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

can we pass something like options map[string]string?

Copy link
Member Author

Choose a reason for hiding this comment

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

added an options map, but nwInfo seems pretty ubiquitous throughout the ADD/DELETE calls

Comment on lines 60 to 112
result.IPs = make([]*cniTypesCurr.IPConfig, 1)
result.IPs[0] = &cniTypesCurr.IPConfig{
Address: resultIPnet,
}
Copy link
Member

Choose a reason for hiding this comment

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

instead of doing this way, can we initialize cniTypesCurr.IPConfig and then append to array..so that it can be extensible

ipconfig := &cniTypesCurr.IPConfig{}
var ipconfigs []*cniTypesCurr.IPConfig
ipconfigs = append(ipconfigs, ipconfig)

Copy link
Member Author

Choose a reason for hiding this comment

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

updating to add gwip and dns

Copy link
Collaborator

@thatmattlong thatmattlong left a comment

Choose a reason for hiding this comment

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

Can we have the CNS client constructed to talk to CNS over the Node IP instead of localhost? @pjohnst5 's PR for the CNS Helm chart has CNS listening on the Node IP only, and doesn't not bind to 127.0.0.1.

@matmerr matmerr force-pushed the cniwithcnsipam branch 2 times, most recently from 9c747c5 to aa653c5 Compare August 17, 2020 15:48
@matmerr matmerr force-pushed the cniwithcnsipam branch 3 times, most recently from 4e59e03 to 936eb1a Compare August 27, 2020 20:34
}

// set host ip interface name
hostInterfaceName, err := getHostInterfaceName(hostIPNet, hostIP)
Copy link
Member Author

Choose a reason for hiding this comment

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

reuse FindMasterInterface

}

// SetNCAddressSpaceOnHostBrige Add's the NC subnet space to the primary interface
func SetNCAddressSpaceOnHostBrige(ncSubnetAddressSpace string, ncSubnetPrefix uint8, hostPrimaryIfName string) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

Sent Route for NC subnet on host bridge

- matchExpressions:
- key: node-role.kubernetes.io/agent
operator: Exists
tolerations:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you'll need this toleration on the agent installer

tamilmani1989
tamilmani1989 previously approved these changes Sep 24, 2020
Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

gave feedback that will be addressed in different PR

@@ -0,0 +1,14 @@
FROM golang as build
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the closest I could comment on this :). There's a busybox blob being checked in which should be removed.

@matmerr matmerr force-pushed the cniwithcnsipam branch 2 times, most recently from a73662f to 240ea0f Compare September 25, 2020 23:21
@matmerr matmerr dismissed thatmattlong’s stale review September 29, 2020 21:41

configuring CNS to listen localhost is going to be configured with the deployment

@matmerr matmerr merged commit 41232c1 into Azure:master Sep 29, 2020
neaggarwMS pushed a commit to neaggarwMS/azure-container-networking that referenced this pull request Nov 13, 2020
* Configure CNI to use CNS IPAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants