Skip to content

Commit 841471d

Browse files
committed
Bitten by go 1.16 mod changes and k8s kubelet changes of api (1.20 or 0.20).
1 parent e4f9d53 commit 841471d

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ RUN apk update && apk upgrade && apk add tar ca-certificates build-base
55
ENV GOPATH /go
66
RUN go version
77

8-
WORKDIR /go/src/smarter-device-management
8+
WORKDIR /arm.com/smarter-device-management
99
COPY . .
1010

1111
RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' && \
12-
go install -ldflags="-s -w" -v smarter-device-management
12+
go mod init arm.com/smarter-device-management && go mod tidy && go mod vendor && \
13+
go build -ldflags="-s -w" .
1314

1415
FROM alpine
1516

@@ -18,6 +19,6 @@ RUN apk update && apk upgrade
1819
WORKDIR /root
1920

2021
COPY conf.yaml /root/config/conf.yaml
21-
COPY --from=build /go/bin/smarter-device-management /usr/bin/smarter-device-management
22+
COPY --from=build /arm.com/smarter-device-management/smarter-device-management /usr/bin/smarter-device-management
2223

23-
CMD ["smarter-device-management","-logtostderr=true","-v=0"]
24+
CMD ["smarter-device-management","-logtostderr=true","-v=0"]

argus.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ package main
44

55
import (
66
"github.com/golang/glog"
7-
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
7+
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
88
)
99

1010
func check(err error) {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/fsnotify/fsnotify"
1515
"github.com/golang/glog"
1616
"gopkg.in/yaml.v2"
17-
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
17+
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
1818
)
1919

2020
var confFileName string

nvidia-server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/golang/glog"
1414
"golang.org/x/net/context"
1515
"google.golang.org/grpc"
16-
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
16+
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
1717
)
1818

1919
var passDeviceSpecs = flag.Bool("pass-device-specs", false, "pass the list of DeviceSpecs to the kubelet on Allocate()")
@@ -182,6 +182,10 @@ func (m *NvidiaDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreSt
182182
return &pluginapi.PreStartContainerResponse{}, nil
183183
}
184184

185+
func (m *NvidiaDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) {
186+
return &pluginapi.PreferredAllocationResponse{}, nil
187+
}
188+
185189
func (m *NvidiaDevicePlugin) cleanup() error {
186190
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
187191
return err

server.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/golang/glog"
1414
"golang.org/x/net/context"
1515
"google.golang.org/grpc"
16-
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
16+
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
1717
)
1818

1919
const (
@@ -180,6 +180,10 @@ func (m *SmarterDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreS
180180
return &pluginapi.PreStartContainerResponse{}, nil
181181
}
182182

183+
func (m *SmarterDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) {
184+
return &pluginapi.PreferredAllocationResponse{}, nil
185+
}
186+
183187
func (m *SmarterDevicePlugin) cleanup() error {
184188
glog.V(0).Info("Removing file ",m.socket)
185189
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {

0 commit comments

Comments
 (0)