Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d40c276
changes for adding swiftv2 SF config
kmurudi Dec 12, 2023
1bcce57
refactor: getSecondaryInterfaceInfo
kmurudi Dec 15, 2023
be6bf9d
checks for sf orch
kmurudi Dec 15, 2023
e41c827
Add hnsclient new mode & NCID in PodIpInfo
kmurudi Dec 18, 2023
78d60b3
undoing cni part changes
kmurudi Dec 19, 2023
d9dde58
undoing cni part changes
kmurudi Dec 19, 2023
a9cb9fa
fix: reordering code
kmurudi Jan 3, 2024
5426ed3
fix: golint errors
kmurudi Jan 3, 2024
d485ebc
fix: add new macaddressEqualCheck func
kmurudi Jan 4, 2024
d0edcb2
feat: adding swiftv2-SF middleware, refactor
kmurudi Jan 23, 2024
91bc874
review: address comments
kmurudi Jan 25, 2024
8776afe
review: address comments-2
kmurudi Jan 25, 2024
f457f6a
feat: change middleware initialization at right cns channel mode
kmurudi Jan 25, 2024
a027e77
test:UTs to validate IP configs request, refactor cnsclient import, a…
kmurudi Jan 30, 2024
f2a2405
fix: updatepodinfowithinterfaces & linters fix
kmurudi Feb 1, 2024
91638bf
fix: linter errors
kmurudi Feb 2, 2024
d8e2e72
fix: linter errors context check & govet
kmurudi Feb 5, 2024
c44f71d
removed validateIpConfigs, removed failureHandler, removed swiftv2sf_…
kmurudi Feb 6, 2024
9038e8d
test: move out UTs to restserver package, avoid import cycle
kmurudi Feb 6, 2024
1df0fa8
test: modify tests
kmurudi Feb 7, 2024
5092728
test: fix constant values used in UT
kmurudi Feb 7, 2024
b13f1e2
test: fix linter errors
kmurudi Feb 7, 2024
ebf6640
remove enableswiftv2, add new field in podipinfo, remove ipconfigsreq…
kmurudi Feb 8, 2024
6513227
fix: address comment
kmurudi Feb 8, 2024
dc8d51b
Merge branch 'master' into enableSwiftV2_SF_CNSRequestIPs
kmurudi Feb 8, 2024
a0c9666
fix: remove enableswiftv2, replace by swiftv2mode
kmurudi Feb 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions cns/NetworkContainerContract.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ type PodIpInfo struct {
PodIPConfig IPSubnet
NetworkContainerPrimaryIPConfig IPConfiguration
HostPrimaryIPInfo HostIPInfo
HostSecondaryIPInfo HostIPInfo
// NICType defines whether NIC is InfraNIC or DelegatedVMNIC or BackendNIC
NICType NICType
InterfaceName string
Expand All @@ -466,12 +467,15 @@ type PodIpInfo struct {
SkipDefaultRoutes bool
// Routes to configure on interface
Routes []Route
// AddInterfacesDataToPodInfo is set to true for SF SwiftV2 scenario
AddInterfacesDataToPodInfo bool
}

type HostIPInfo struct {
Gateway string
PrimaryIP string
Subnet string
Gateway string
PrimaryIP string
SecondaryIP string
Subnet string
}

type IPConfigRequest struct {
Expand Down
33 changes: 33 additions & 0 deletions cns/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"time"

"github.com/Azure/azure-container-networking/cns/common"
Expand Down Expand Up @@ -364,3 +365,35 @@ type EndpointRequest struct {
HnsEndpointID string `json:"hnsEndpointID"`
HostVethName string `json:"hostVethName"`
}

// GetEndpointResponse describes response from the The GetEndpoint API.
type GetEndpointResponse struct {
Response Response `json:"response"`
EndpointInfo EndpointInfo `json:"endpointInfo"`
}

type EndpointInfo struct {
PodName string
PodNamespace string
IfnameToIPMap map[string]*IPInfo // key : interface name, value : IPInfo
HnsEndpointID string
HostVethName string
}
type IPInfo struct {
IPv4 []net.IPNet
IPv6 []net.IPNet
}

type GetHTTPServiceDataResponse struct {
HTTPRestServiceData HTTPRestServiceData `json:"HTTPRestServiceData"`
Response Response `json:"response"`
}

// HTTPRestServiceData represents in-memory CNS data in the debug API paths.
// PodInterfaceId is key and value is slice of Pod IP uuids in PodIPIDByPodInterfaceKey
// secondaryipid(uuid) is key for PodIPConfigState
type HTTPRestServiceData struct {
PodIPIDByPodInterfaceKey map[string][]string `json:"podIPIDByPodInterfaceKey"`
PodIPConfigState map[string]IPConfigurationStatus `json:"podIpConfigState"`
IPAMPoolMonitor IpamPoolMonitorStateSnapshot `json:"ipamPoolMonitor"`
}
9 changes: 4 additions & 5 deletions cns/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"time"

"github.com/Azure/azure-container-networking/cns"
"github.com/Azure/azure-container-networking/cns/restserver"
"github.com/Azure/azure-container-networking/cns/types"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -563,7 +562,7 @@ func (c *Client) GetPodOrchestratorContext(ctx context.Context) (map[string][]st
}

// GetHTTPServiceData gets all public in-memory struct details for debugging purpose
func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPServiceDataResponse, error) {
func (c *Client) GetHTTPServiceData(ctx context.Context) (*cns.GetHTTPServiceDataResponse, error) {
u := c.routes[cns.PathDebugRestData]
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
if err != nil {
Expand All @@ -583,7 +582,7 @@ func (c *Client) GetHTTPServiceData(ctx context.Context) (*restserver.GetHTTPSer
if res.StatusCode != http.StatusOK {
return nil, errors.Errorf("http response %d", res.StatusCode)
}
var resp restserver.GetHTTPServiceDataResponse
var resp cns.GetHTTPServiceDataResponse
err = json.NewDecoder(bytes.NewReader(b)).Decode(&resp)
if err != nil {
return nil, errors.Wrap(err, "failed to decode GetHTTPServiceDataResponse")
Expand Down Expand Up @@ -1024,7 +1023,7 @@ func (c *Client) GetHomeAz(ctx context.Context) (*cns.GetHomeAzResponse, error)
}

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

var response restserver.GetEndpointResponse
var response cns.GetEndpointResponse
err = json.NewDecoder(res.Body).Decode(&response)
if err != nil {
return nil, errors.Wrap(err, "failed to decode GetEndpointResponse")
Expand Down
Loading