Skip to content

Commit 7fc8768

Browse files
fix cni issue (#1039)
1 parent f595b53 commit 7fc8768

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cni/network/multitenancy.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ func (m *Multitenancy) DetermineSnatFeatureOnHost(snatFile, nmAgentSupportedApis
9797
// If we weren't able to retrieve snatConfiguration, query NMAgent
9898
if retrieveSnatConfigErr != nil {
9999
var resp *http.Response
100-
req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, nmAgentSnatAndDnsSupportAPI, nil)
100+
req, err := http.NewRequestWithContext(context.TODO(), http.MethodGet, nmAgentSupportedApisURL, nil)
101101
if err != nil {
102102
log.Errorf("failed creating http request:%+v", err)
103103
return false, false, fmt.Errorf("%w", err)
104104
}
105+
log.Printf("Query nma for dns snat support: %s", nmAgentSupportedApisURL)
105106
resp, retrieveSnatConfigErr = httpClient.Do(req)
106107
if retrieveSnatConfigErr == nil {
107108
defer resp.Body.Close()

cni/network/network.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
430430
plugin.report.Context = "AzureCNIMultitenancy"
431431
// Temporary if block to determining whether we disable SNAT on host (for multi-tenant scenario only)
432432
if enableSnatForDns, nwCfg.EnableSnatOnHost, err = plugin.multitenancyClient.DetermineSnatFeatureOnHost(
433-
snatConfigFileName, nmAgentSnatAndDnsSupportAPI); err != nil {
433+
snatConfigFileName, nmAgentSupportedApisURL); err != nil {
434434
return fmt.Errorf("%w", err)
435435
}
436436

@@ -473,13 +473,15 @@ func (plugin *NetPlugin) Add(args *cniSkel.CmdArgs) error {
473473
nwInfo.IPAMType = nwCfg.Ipam.Type
474474
options = nwInfo.Options
475475

476-
result, err = plugin.handleConsecutiveAdd(args, endpointId, networkID, &nwInfo, nwCfg)
476+
var resultSecondAdd *cniTypesCurr.Result
477+
resultSecondAdd, err = plugin.handleConsecutiveAdd(args, endpointId, networkID, &nwInfo, nwCfg)
477478
if err != nil {
478479
log.Printf("handleConsecutiveAdd failed with error %v", err)
479480
return err
480481
}
481482

482-
if result != nil {
483+
if resultSecondAdd != nil {
484+
result = resultSecondAdd
483485
return nil
484486
}
485487
}

0 commit comments

Comments
 (0)