Skip to content

Commit

Permalink
enhance log line
Browse files Browse the repository at this point in the history
  • Loading branch information
paulyufan2 committed Aug 21, 2024
1 parent 45023ef commit ddc172b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 5 additions & 6 deletions cni/network/network_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ func addSnatForDNS(gwIPString string, epInfo *network.EndpointInfo, result *netw
func setNetworkOptions(cnsNwConfig *cns.GetNetworkContainerResponse, nwInfo *network.EndpointInfo) {
if cnsNwConfig != nil && cnsNwConfig.MultiTenancyInfo.ID != 0 {
logger.Info("Setting Network Options")
vlanMap := make(map[string]interface{})
vlanMap[network.VlanIDKey] = strconv.Itoa(cnsNwConfig.MultiTenancyInfo.ID)
vlanMap[network.SnatBridgeIPKey] = cnsNwConfig.LocalIPConfiguration.GatewayIPAddress + "/" + strconv.Itoa(int(cnsNwConfig.LocalIPConfiguration.IPSubnet.PrefixLength))
logger.Info("Add vlanIDkey and SnatBridgeIPKey with vlanID to vlanMap", zap.String("vlanIDKey", network.VlanIDKey), zap.String("SnatBridgeIPKey", network.SnatBridgeIPKey),
zap.Int("vlanID", cnsNwConfig.MultiTenancyInfo.ID), zap.Any("vlanMap", vlanMap))
nwInfo.Options[dockerNetworkOption] = vlanMap
optionsMap := make(map[string]interface{})
optionsMap[network.VlanIDKey] = strconv.Itoa(cnsNwConfig.MultiTenancyInfo.ID)
optionsMap[network.SnatBridgeIPKey] = cnsNwConfig.LocalIPConfiguration.GatewayIPAddress + "/" + strconv.Itoa(int(cnsNwConfig.LocalIPConfiguration.IPSubnet.PrefixLength))
logger.Info("Add vlanIDkey and SnatBridgeIPKey to optionsMap", zap.String("vlanIDKey", network.VlanIDKey), zap.String("SnatBridgeIPKey", network.SnatBridgeIPKey))
nwInfo.Options[dockerNetworkOption] = optionsMap
}
}

Expand Down
8 changes: 4 additions & 4 deletions cni/network/network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func addSnatForDNS(_ string, _ *network.EndpointInfo, _ *network.InterfaceInfo)
func setNetworkOptions(cnsNwConfig *cns.GetNetworkContainerResponse, nwInfo *network.EndpointInfo) {
if cnsNwConfig != nil && cnsNwConfig.MultiTenancyInfo.ID != 0 {
logger.Info("Setting Network Options")
vlanMap := make(map[string]interface{})
vlanMap[network.VlanIDKey] = strconv.Itoa(cnsNwConfig.MultiTenancyInfo.ID)
logger.Info("Add vlanIDKey with vlanID to vlanMap", zap.String("vlanIDKey", network.VlanIDKey), zap.Int("vlanID", cnsNwConfig.MultiTenancyInfo.ID), zap.Any("vlanMap", vlanMap))
nwInfo.Options[dockerNetworkOption] = vlanMap
optionsMap := make(map[string]interface{})
optionsMap[network.VlanIDKey] = strconv.Itoa(cnsNwConfig.MultiTenancyInfo.ID)
logger.Info("Add vlanIDKey to optionsMap", zap.String("vlanIDKey", network.VlanIDKey))
nwInfo.Options[dockerNetworkOption] = optionsMap
}
}

Expand Down

0 comments on commit ddc172b

Please sign in to comment.