Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 9 additions & 3 deletions cns/deviceplugin/pluginmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ func TestPluginManagerStartStop(t *testing.T) {
req := &v1beta1.AllocateRequest{
ContainerRequests: []*v1beta1.ContainerAllocateRequest{
{
DevicesIDs: []string{"device-0", "device-1"},
DevicesIds: []string{"device-0", "device-1"},
},
},
}
allocateResp := getAllocateResponse(t, vnetPluginEndpoint, req)

if len(allocateResp.ContainerResponses[0].Envs) != len(req.ContainerRequests[0].DevicesIDs) {
t.Fatalf("expected allocations %v but received allocations %v", len(req.ContainerRequests[0].DevicesIDs), len(allocateResp.ContainerResponses[0].Envs))
if len(allocateResp.GetContainerResponses()[0].GetEnvs()) != len(req.GetContainerRequests()[0].GetDevicesIds()) {
t.Fatalf("expected allocations %v but received allocations %v",
len(req.GetContainerRequests()[0].GetDevicesIds()),
len(allocateResp.GetContainerResponses()[0].GetEnvs()),
)
}

// call getDevicePluginOptions method
Expand Down Expand Up @@ -142,6 +145,9 @@ func TestPluginManagerStartStop(t *testing.T) {
}

type fakeKubelet struct {
// Required by newer protoc-gen-go-grpc to satisfy v1beta1.RegistrationServer
v1beta1.UnimplementedRegistrationServer

vnetPluginRegisterChan chan string
ibPluginRegisterChan chan string
pluginPrefix string
Expand Down
12 changes: 8 additions & 4 deletions cns/deviceplugin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type deviceCounter interface {
}

type Server struct {
// NEW: embed the unimplemented server to satisfy the interface in newer gRPC/proto
v1beta1.UnimplementedDevicePluginServer

address string
logger *zap.Logger
deviceCounter deviceCounter
Expand Down Expand Up @@ -89,13 +92,14 @@ func (s *Server) Ready(ctx context.Context) error {
// We are not using this functionality currently
func (s *Server) Allocate(_ context.Context, req *v1beta1.AllocateRequest) (*v1beta1.AllocateResponse, error) {
s.logger.Info("allocate request", zap.Any("req", *req))
resps := make([]*v1beta1.ContainerAllocateResponse, len(req.ContainerRequests))
for i, containerReq := range req.ContainerRequests {
crs := req.GetContainerRequests()
resps := make([]*v1beta1.ContainerAllocateResponse, len(crs))
for i, containerReq := range crs {
resp := &v1beta1.ContainerAllocateResponse{
Envs: make(map[string]string),
}
for j := range containerReq.DevicesIDs {
resp.Envs[fmt.Sprintf("%s%d", devicePrefix, j)] = containerReq.DevicesIDs[j]
for j, id := range containerReq.GetDevicesIds() {
resp.Envs[fmt.Sprintf("%s%d", devicePrefix, j)] = id
}
resps[i] = resp
}
Expand Down
56 changes: 28 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/Azure/azure-container-networking
go 1.24.1

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.11.0
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.0
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.12.0
github.com/Masterminds/semver v1.5.0
github.com/Microsoft/go-winio v0.6.2
Expand All @@ -28,18 +28,18 @@ require (
github.com/onsi/gomega v1.37.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.23.0
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_model v0.6.2
github.com/spf13/cobra v1.9.1
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.20.1
github.com/spf13/viper v1.21.0
github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/sys v0.35.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/grpc v1.75.0
google.golang.org/protobuf v1.36.8
golang.org/x/sys v0.36.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/grpc v1.76.0
google.golang.org/protobuf v1.36.10
gopkg.in/natefinch/lumberjack.v2 v2.2.1
k8s.io/api v0.34.1
k8s.io/apiextensions-apiserver v0.34.1
Expand All @@ -55,7 +55,7 @@ require (
code.cloudfoundry.org/clock v1.41.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coreos/go-iptables v0.8.0
Expand All @@ -75,43 +75,43 @@ require (
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/labstack/echo/v4 v4.13.4
github.com/labstack/gommon v0.4.2 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mailru/easyjson v0.9.1 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/common v0.65.0
github.com/prometheus/common v0.66.1
github.com/prometheus/procfs v0.16.1 // indirect
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vishvananda/netlink v1.3.1
github.com/vishvananda/netns v0.0.5
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.41.0
golang.org/x/net v0.43.0
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/time v0.12.0
golang.org/x/crypto v0.42.0
golang.org/x/net v0.45.0
golang.org/x/oauth2 v0.31.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.13.0
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
)

Expand All @@ -125,9 +125,9 @@ require (
github.com/cilium/cilium v1.15.16
github.com/cilium/ebpf v0.19.0
github.com/jsternberg/zap-logfmt v1.3.0
golang.org/x/sync v0.16.0
golang.org/x/sync v0.17.0
gotest.tools/v3 v3.5.2
k8s.io/kubectl v0.28.5
k8s.io/kubectl v0.34.1
sigs.k8s.io/yaml v1.6.0
)

Expand All @@ -147,7 +147,7 @@ require (
github.com/go-openapi/spec v0.20.11 // indirect
github.com/go-openapi/strfmt v0.21.9 // indirect
github.com/go-openapi/validate v0.22.3 // indirect
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
Expand Down Expand Up @@ -186,9 +186,9 @@ require (
github.com/containerd/errdefs v0.3.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
k8s.io/kubelet v0.30.14
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
k8s.io/kubelet v0.34.1
)

replace (
Expand Down
Loading
Loading