diff --git a/Dockerfile b/Dockerfile index b4c4ae9..d9fafd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,12 @@ RUN apk update && apk upgrade && apk add tar ca-certificates build-base ENV GOPATH /go RUN go version -WORKDIR /go/src/smarter-device-management +WORKDIR /arm.com/smarter-device-management COPY . . RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' && \ - go install -ldflags="-s -w" -v smarter-device-management + go mod init arm.com/smarter-device-management && go mod tidy && go mod vendor && \ + go build -ldflags="-s -w" . FROM alpine @@ -18,6 +19,6 @@ RUN apk update && apk upgrade WORKDIR /root COPY conf.yaml /root/config/conf.yaml -COPY --from=build /go/bin/smarter-device-management /usr/bin/smarter-device-management +COPY --from=build /arm.com/smarter-device-management/smarter-device-management /usr/bin/smarter-device-management -CMD ["smarter-device-management","-logtostderr=true","-v=0"] \ No newline at end of file +CMD ["smarter-device-management","-logtostderr=true","-v=0"] diff --git a/argus.go b/argus.go index 75aabac..6f89fae 100644 --- a/argus.go +++ b/argus.go @@ -4,7 +4,7 @@ package main import ( "github.com/golang/glog" - pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) func check(err error) { diff --git a/main.go b/main.go index 3826ad2..578a396 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ import ( "github.com/fsnotify/fsnotify" "github.com/golang/glog" "gopkg.in/yaml.v2" - pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) var confFileName string diff --git a/nvidia-server.go b/nvidia-server.go index 4f0aa10..4c9ff98 100644 --- a/nvidia-server.go +++ b/nvidia-server.go @@ -13,7 +13,7 @@ import ( "github.com/golang/glog" "golang.org/x/net/context" "google.golang.org/grpc" - pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) 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 return &pluginapi.PreStartContainerResponse{}, nil } +func (m *NvidiaDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { + return &pluginapi.PreferredAllocationResponse{}, nil +} + func (m *NvidiaDevicePlugin) cleanup() error { if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) { return err diff --git a/server.go b/server.go index f637e0b..65c94d3 100644 --- a/server.go +++ b/server.go @@ -13,7 +13,7 @@ import ( "github.com/golang/glog" "golang.org/x/net/context" "google.golang.org/grpc" - pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1" + pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" ) const ( @@ -180,6 +180,10 @@ func (m *SmarterDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreS return &pluginapi.PreStartContainerResponse{}, nil } +func (m *SmarterDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) { + return &pluginapi.PreferredAllocationResponse{}, nil +} + func (m *SmarterDevicePlugin) cleanup() error { glog.V(0).Info("Removing file ",m.socket) if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {