mirror of
https://gitlab.com/arm-research/smarter/smarter-device-manager.git
synced 2024-11-23 11:12:11 +00:00
Bitten by go 1.16 mod changes and k8s kubelet changes of api (1.20 or 0.20).
This commit is contained in:
parent
e4f9d53a16
commit
841471d149
@ -5,11 +5,12 @@ RUN apk update && apk upgrade && apk add tar ca-certificates build-base
|
|||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
RUN go version
|
RUN go version
|
||||||
|
|
||||||
WORKDIR /go/src/smarter-device-management
|
WORKDIR /arm.com/smarter-device-management
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' && \
|
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
|
FROM alpine
|
||||||
|
|
||||||
@ -18,6 +19,6 @@ RUN apk update && apk upgrade
|
|||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
COPY conf.yaml /root/config/conf.yaml
|
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"]
|
CMD ["smarter-device-management","-logtostderr=true","-v=0"]
|
2
argus.go
2
argus.go
@ -4,7 +4,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/golang/glog"
|
"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) {
|
func check(err error) {
|
||||||
|
2
main.go
2
main.go
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/fsnotify/fsnotify"
|
"github.com/fsnotify/fsnotify"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
|
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var confFileName string
|
var confFileName string
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"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()")
|
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
|
return &pluginapi.PreStartContainerResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *NvidiaDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) {
|
||||||
|
return &pluginapi.PreferredAllocationResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *NvidiaDevicePlugin) cleanup() error {
|
func (m *NvidiaDevicePlugin) cleanup() error {
|
||||||
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
|
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
|
||||||
return err
|
return err
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
pluginapi "k8s.io/kubernetes/pkg/kubelet/apis/deviceplugin/v1beta1"
|
pluginapi "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -180,6 +180,10 @@ func (m *SmarterDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreS
|
|||||||
return &pluginapi.PreStartContainerResponse{}, nil
|
return &pluginapi.PreStartContainerResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *SmarterDevicePlugin) GetPreferredAllocation(context.Context, *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) {
|
||||||
|
return &pluginapi.PreferredAllocationResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *SmarterDevicePlugin) cleanup() error {
|
func (m *SmarterDevicePlugin) cleanup() error {
|
||||||
glog.V(0).Info("Removing file ",m.socket)
|
glog.V(0).Info("Removing file ",m.socket)
|
||||||
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
|
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user