-
Notifications
You must be signed in to change notification settings - Fork 260
CNI using CNS IPAM #597
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
CNI using CNS IPAM #597
Conversation
Codecov Report
@@ 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 |
| cniTypesCurr "github.com/containernetworking/cni/pkg/types/current" | ||
| ) | ||
|
|
||
| type IPAMInvoker interface { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
cni/network/invoker_azure.go
Outdated
| cniTypesCurr "github.com/containernetworking/cni/pkg/types/current" | ||
| ) | ||
|
|
||
| type AzureInvoker struct { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
cni/network/invoker_azure.go
Outdated
| nwCfg6.Ipam.Type = ipamV6 | ||
|
|
||
| if len(nwInfo.Subnets) > 1 { | ||
| nwCfg6.Ipam.Subnet = nwInfo.Subnets[1].Prefix.String() |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
cni/network/invoker_azure.go
Outdated
|
|
||
| if address.IP.To4() != nil { | ||
|
|
||
| if isDeletePoolOnError { |
There was a problem hiding this comment.
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.
paulgmiller
left a comment
There was a problem hiding this 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 :)
cni/network/invoker.go
Outdated
| ) | ||
|
|
||
| type IPAMInvoker interface { | ||
| Add(args *cniSkel.CmdArgs, nwCfg *cni.NetworkConfig, nwInfo network.NetworkInfo, isDeletePoolOnError bool) (*cniTypesCurr.Result, *cniTypesCurr.Result, error) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
cni/network/invoker_cns.go
Outdated
| result.IPs = make([]*cniTypesCurr.IPConfig, 1) | ||
| result.IPs[0] = &cniTypesCurr.IPConfig{ | ||
| Address: resultIPnet, | ||
| } |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
thatmattlong
left a comment
There was a problem hiding this 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.
9c747c5 to
aa653c5
Compare
4e59e03 to
936eb1a
Compare
cni/network/invoker_cns.go
Outdated
| } | ||
|
|
||
| // set host ip interface name | ||
| hostInterfaceName, err := getHostInterfaceName(hostIPNet, hostIP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reuse FindMasterInterface
cni/network/invoker_cns.go
Outdated
| } | ||
|
|
||
| // SetNCAddressSpaceOnHostBrige Add's the NC subnet space to the primary interface | ||
| func SetNCAddressSpaceOnHostBrige(ncSubnetAddressSpace string, ncSubnetPrefix uint8, hostPrimaryIfName string) error { |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
f61f54f to
997657a
Compare
tamilmani1989
left a comment
There was a problem hiding this 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 | |||
There was a problem hiding this comment.
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.
a73662f to
240ea0f
Compare
240ea0f to
c887c70
Compare
configuring CNS to listen localhost is going to be configured with the deployment
* Configure CNI to use CNS IPAM
Reason for Change:
Using the CNS IPAM found in #584
Issue Fixed:
Requirements:
Notes: