Skip to content

Commit 683e7b4

Browse files
committed
fix comments
1 parent cd629a4 commit 683e7b4

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

cns/middlewares/k8sSwiftV2.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,7 @@ func (k *K8sSWIFTv2Middleware) AddRoutes(cidrs []string, gatewayIP string) []cns
239239
}
240240

241241
// Both Linux and Windows CNS gets infravnet and service CIDRs from configuration env
242-
func (k *K8sSWIFTv2Middleware) GetCidrs() ([]string, []string, error) {
243-
v4Cidrs := []string{}
244-
v6Cidrs := []string{}
245-
242+
func (k *K8sSWIFTv2Middleware) GetCidrs() (v4Cidrs, v6Cidrs []string, err error) {
246243
// Get and parse infraVNETCIDRs from env
247244
infraVNETCIDRs, err := configuration.InfraVNETCIDRs()
248245
if err != nil {

cns/middlewares/k8sSwiftV2_linux.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
3232
routes = append(routes, virtualGWRoute, route)
3333

3434
case cns.InfraNIC:
35-
// Linux CNS middleware sets the infra routes(infravnet/pod/service cidrs) to infraNIC interface for the podIPInfo used in SWIFT V2 Linux scenario
35+
// Linux CNS middleware sets the infra routes(pod, infravnet and service cidrs) to infraNIC interface for the podIPInfo used in SWIFT V2 Linux scenario
3636
infraRoutes, err := k.getInfraRoutes(podIPInfo)
3737
if err != nil {
3838
return errors.Wrap(err, "failed to get infra routes for infraNIC interface")
@@ -53,10 +53,7 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
5353
// Linux CNS gets pod CIDRs from configuration env
5454
// Containerd reassigns the IP to the adapter and kernel configures the pod cidr route by default on Windows VM
5555
// Hence the windows swiftv2 scenario does not require pod cidr
56-
func (k *K8sSWIFTv2Middleware) GetPodCidrs() ([]string, []string, error) {
57-
v4PodCidrs := []string{}
58-
v6PodCidrs := []string{}
59-
56+
func (k *K8sSWIFTv2Middleware) GetPodCidrs() (v4PodCidrs, v6PodCidrs []string, err error) {
6057
// Get and parse podCIDRs from env
6158
podCIDRs, err := configuration.PodCIDRs()
6259
if err != nil {
@@ -110,6 +107,7 @@ func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(_ *cns.PodIpInfo,
110107
return nil
111108
}
112109

110+
// add default route is done on setRoutes() for Linux swiftv2
113111
func (k *K8sSWIFTv2Middleware) addDefaultRoute(*cns.PodIpInfo, string) {}
114112

115113
// IPConfigsRequestHandlerWrapper is the middleware function for handling SWIFT v2 IP configs requests for AKS-SWIFT. This function wrapped the default SWIFT request

cns/middlewares/k8sSwiftV2_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (k *K8sSWIFTv2Middleware) setRoutes(podIPInfo *cns.PodIpInfo) error {
3636
}
3737
podIPInfo.Routes = append(podIPInfo.Routes, route)
3838

39-
// // Linux CNS middleware sets the infra routes(infravnet and service cidrs) to infraNIC interface for the podIPInfo used in SWIFT V2 Windows scenario
39+
// Windows CNS middleware sets the infra routes(infravnet and service cidrs) to infraNIC interface for the podIPInfo used in SWIFT V2 Windows scenario
4040
infraRoutes, err := k.getInfraRoutes(podIPInfo)
4141
if err != nil {
4242
return errors.Wrap(err, "failed to set routes for infraNIC interface")
@@ -72,7 +72,7 @@ func (k *K8sSWIFTv2Middleware) assignSubnetPrefixLengthFields(podIPInfo *cns.Pod
7272
return nil
7373
}
7474

75-
// add default route with gateway IP to podIPInfo
75+
// add default route with gateway IP to podIPInfo for delegatedNIC interface
7676
func (k *K8sSWIFTv2Middleware) addDefaultRoute(podIPInfo *cns.PodIpInfo, gwIP string) {
7777
route := cns.Route{
7878
IPAddress: "0.0.0.0/0",

0 commit comments

Comments
 (0)