Skip to content

Commit d8de157

Browse files
authored
Revert "Enable CNS swiftv2 path for SF/Standalone scenario to program secondary nics" (#2608)
* Revert "Enable CNS swiftv2 path for SF/Standalone scenario to program seconda…" This reverts commit bc218ed. * fix linter errors-1 * fix linter errors-2 * fix linter errors-3 * fix linter errors-4 * address comment, add todo
1 parent 3aa7b20 commit d8de157

18 files changed

+425
-618
lines changed

Diff for: cns/NetworkContainerContract.go

+3-7
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ type PodIpInfo struct {
465465
PodIPConfig IPSubnet
466466
NetworkContainerPrimaryIPConfig IPConfiguration
467467
HostPrimaryIPInfo HostIPInfo
468-
HostSecondaryIPInfo HostIPInfo
469468
// NICType defines whether NIC is InfraNIC or DelegatedVMNIC or BackendNIC
470469
NICType NICType
471470
InterfaceName string
@@ -475,15 +474,12 @@ type PodIpInfo struct {
475474
SkipDefaultRoutes bool
476475
// Routes to configure on interface
477476
Routes []Route
478-
// AddInterfacesDataToPodInfo is set to true for SF SwiftV2 scenario
479-
AddInterfacesDataToPodInfo bool
480477
}
481478

482479
type HostIPInfo struct {
483-
Gateway string
484-
PrimaryIP string
485-
SecondaryIP string
486-
Subnet string
480+
Gateway string
481+
PrimaryIP string
482+
Subnet string
487483
}
488484

489485
type IPConfigRequest struct {

Diff for: cns/api.go

-33
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"context"
88
"encoding/json"
99
"fmt"
10-
"net"
1110
"time"
1211

1312
"github.com/Azure/azure-container-networking/cns/common"
@@ -365,35 +364,3 @@ type EndpointRequest struct {
365364
HnsEndpointID string `json:"hnsEndpointID"`
366365
HostVethName string `json:"hostVethName"`
367366
}
368-
369-
// GetEndpointResponse describes response from the The GetEndpoint API.
370-
type GetEndpointResponse struct {
371-
Response Response `json:"response"`
372-
EndpointInfo EndpointInfo `json:"endpointInfo"`
373-
}
374-
375-
type EndpointInfo struct {
376-
PodName string
377-
PodNamespace string
378-
IfnameToIPMap map[string]*IPInfo // key : interface name, value : IPInfo
379-
HnsEndpointID string
380-
HostVethName string
381-
}
382-
type IPInfo struct {
383-
IPv4 []net.IPNet
384-
IPv6 []net.IPNet
385-
}
386-
387-
type GetHTTPServiceDataResponse struct {
388-
HTTPRestServiceData HTTPRestServiceData `json:"HTTPRestServiceData"`
389-
Response Response `json:"response"`
390-
}
391-
392-
// HTTPRestServiceData represents in-memory CNS data in the debug API paths.
393-
// PodInterfaceId is key and value is slice of Pod IP uuids in PodIPIDByPodInterfaceKey
394-
// secondaryipid(uuid) is key for PodIPConfigState
395-
type HTTPRestServiceData struct {
396-
PodIPIDByPodInterfaceKey map[string][]string `json:"podIPIDByPodInterfaceKey"`
397-
PodIPConfigState map[string]IPConfigurationStatus `json:"podIpConfigState"`
398-
IPAMPoolMonitor IpamPoolMonitorStateSnapshot `json:"ipamPoolMonitor"`
399-
}

Diff for: cns/client/client.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/Azure/azure-container-networking/cns"
14+
"github.com/Azure/azure-container-networking/cns/restserver"
1415
"github.com/Azure/azure-container-networking/cns/types"
1516
"github.com/pkg/errors"
1617
)
@@ -562,7 +563,7 @@ func (c *Client) GetPodOrchestratorContext(ctx context.Context) (map[string][]st
562563
}
563564

564565
// GetHTTPServiceData gets all public in-memory struct details for debugging purpose
565-
func (c *Client) GetHTTPServiceData(ctx context.Context) (*cns.GetHTTPServiceDataResponse, error) {
566+
func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error) {
566567
u := c.routes[cns.PathDebugRestData]
567568
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
568569
if err != nil {
@@ -582,7 +583,7 @@ func (c *Client) GetHTTPServiceData(ctx context.Context) (*cns.GetHTTPServiceDat
582583
if res.StatusCode != http.StatusOK {
583584
return nil, errors.Errorf("http response %d", res.StatusCode)
584585
}
585-
var resp cns.GetHTTPServiceDataResponse
586+
var resp restserver.GetHTTPServiceDataResponse
586587
err = json.NewDecoder(bytes.NewReader(b)).Decode(&resp)
587588
if err != nil {
588589
return nil, errors.Wrap(err, "failed to decode GetHTTPServiceDataResponse")
@@ -1023,7 +1024,7 @@ func (c *Client) GetHomeAz(ctx context.Context) (*cns.GetHomeAzResponse, error)
10231024
}
10241025

10251026
// GetEndpoint calls the EndpointHandlerAPI in CNS to retrieve the state of a given EndpointID
1026-
func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*cns.GetEndpointResponse, error) {
1027+
func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*restserver.GetEndpointResponse, error) {
10271028
// build the request
10281029
u := c.routes[cns.EndpointAPI]
10291030
uString := u.String() + endpointID
@@ -1043,7 +1044,7 @@ func (c *Client) GetEndpoint(ctx context.Context, endpointID string) (*cns.GetEn
10431044
return nil, errors.Errorf("http response %d", res.StatusCode)
10441045
}
10451046

1046-
var response cns.GetEndpointResponse
1047+
var response restserver.GetEndpointResponse
10471048
err = json.NewDecoder(res.Body).Decode(&response)
10481049
if err != nil {
10491050
return nil, errors.Wrap(err, "failed to decode GetEndpointResponse")

0 commit comments

Comments
 (0)