-
Notifications
You must be signed in to change notification settings - Fork 260
feat: CNS RequestIPAddress branching for MT/V2 #2300
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
Conversation
Signed-off-by: Quang Nguyen <nddangquang@gmail.com>
Signed-off-by: Quang Nguyen <nddangquang@gmail.com>
| ErrNoNCs = errors.New("No NCs found in the CNS internal state") | ||
| ) | ||
|
|
||
| // requestIPConfigHandlerHelper validates the request, assigns IPs, and returns a response |
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 keep or enhance the comments?
| assert.False(t, podIPInfo[2].SkipDefaultRoutes) | ||
| } | ||
|
|
||
| func TestIPAMGetSWIFTv2IPFailure(t *testing.T) { |
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.
Not sure what we are asserting here and what is failing, can you please explain with some comments at the beginning?
isaac-dasan
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.
What is the ongoing pipelines issue that we are trying to circumvent?
cns/middlewares/swiftV2.go
Outdated
| mtpnc := v1alpha1.MultitenantPodNetworkConfig{} | ||
| mtpncNamespacedName := k8stypes.NamespacedName{Namespace: podInfo.Namespace(), Name: podInfo.Name()} | ||
| if err := m.Cli.Get(ctx, mtpncNamespacedName, &mtpnc); err != nil { | ||
| return cns.PodIpInfo{}, fmt.Errorf("failed to get pod's mtpnc from cache : %w", err) |
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.
we should use errors.Wrap/Wrapf everywhere, never fmt.Errorf
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.
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.
we are still using it.
cns/middlewares/swiftV2.go
Outdated
| return nil | ||
| } | ||
|
|
||
| // parseCIDRs parses the semicolons separated CIDRs string and returns the IPv4 and IPv6 CIDRs. |
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.
semicolons
comment needs update
cns/azure-cns-swiftv2.yaml
Outdated
| effect: NoSchedule | ||
| containers: | ||
| - name: cns-container | ||
| image: mcr.microsoft.com/containernetworking/azure-cns:v1.4.7 |
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 we need this file at all?
| @@ -1,32 +1,4 @@ | |||
| apiVersion: v1 | |||
| kind: ServiceAccount | |||
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.
revert this file, why did you change it?
cns/restserver/internalapi_test.go
Outdated
| SWIFTv2IP = "192.168.0.1" | ||
| SWIFTv2MAC = "00:00:00:00:00:00" | ||
| SWIFTv2GatewayIP = "10.0.0.1" | ||
| SWIFTv2NCID = "testncid" |
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.
the linter will not warn you about unused Exported fields, only private ones. because they could be used by another package which the linter is not scanning
| SetRoutes(*PodIpInfo) error | ||
| } | ||
|
|
||
| type IPConfigsRequestValidator func(context.Context, *IPConfigsRequest) (types.ResponseCode, 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.
does this func need to return (types.ResponseCode, string)? If it is just a validator, returning err or nil should be plenty?
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 see from the impl that this is not actually a pure function, as -Validator implies.
It also isn't really middleware/decorator - that would require the input to the middleware func to the next func to call in the chain...this is just a dependent object.
Since it mutates the input *IPConfigsRequest, the field in the "Middleware" object should be renamed to something like SetHasSecondaryInterface. I don't have a good idea for what the interface def should be renamed to, but validator it is not.
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.
fyi @miguelgoms, we had a discussion regarding this offline. Currently the way I implement the logic behind SWIFTv2Middleware cherry-picked middleware behaviors, but it is not "true middleware". It is a design review so it is not blocking, we can still go ahead with this since everything is working now, but I can go back to this after we got everything merged to revise the design.
We can't trigger build from forks anymore, so I had to make a PR from a branch directly from the main ACN repo. |
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
rbtr
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.
there's some missed usages of fmt.Error, and util packages are generally discouraged. not blocking
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.
| LabelPodSwiftV2 = "kubernetes.azure.com/pod-network" | ||
| EnvPodCIDRs = "POD_CIDRs" | ||
| EnvServiceCIDRs = "SERVICE_CIDRs" | ||
| EnvNodeCIDRs = "NODE_CIDRs" |
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 will change to infraVnet CIDR in future PR
Reason for Change:
Same as 2114 but from a branch on the main repo to circumvent ongoing pipeline issues.
ipam.go->requestConfigHandlerHelperreleases default ipconfig immediately on failure + more UTsswiftv2.go-> Add routes for node CIDRs + parse MTPNC Primary IP as a CIDR + toggleSkipDefaultRoutesforInfraNICto trueIssue Fixed:
Requirements:
Notes: