From e4f9d53a16631c59adab65400d27cd281be97f96 Mon Sep 17 00:00:00 2001 From: Alexandre Ferreira Date: Tue, 23 Feb 2021 13:01:56 -0600 Subject: [PATCH 1/2] Adding a formal way to contribute to the project --- CONTRIBUTING.md | 16 ++++++++++++++++ CONTRIBUTIONS | 4 ---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 CONTRIBUTIONS diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8e4b67f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing to SMARTER + +SMARTER is an open-source, software platform for the Edge. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor. + +# Project license, and developer certificate of origin + +The SMARTER codebase is licensed under the Apache 2.0 open source license, individual components may have their own licenses. +Please see the LICENSE file in the SMARTER documentation repository for the full text of this license, or the LICENSE file +in respective repositories. New contributions are expected to be lisensed under the Apache 2.0 license or something compatible +with that license. + +Please note that we expect contributors to the project to self-certify that they are authorized to contribute code +using the Linux Foundation's Developer Certificate of Origin. See http://developercertificate.org for more details. + +Contributors sign-off that they adhere to these requirements by adding a Signed-off-by line to commit messages. +Pull requests for contributions without a signed-off-by line will not be accepted. diff --git a/CONTRIBUTIONS b/CONTRIBUTIONS deleted file mode 100644 index aace679..0000000 --- a/CONTRIBUTIONS +++ /dev/null @@ -1,4 +0,0 @@ -We sincerely appreciate your interest of contributing to this project but for now -we are not able to accept contributions. We expect to change this policy soon and -provide a contribution procedure. We suggest that the project be maintained on a -different branch until the contribution policy is changed. From 841471d14933b265aac89ac1924fc5b63b7fd720 Mon Sep 17 00:00:00 2001 From: Alexandre Ferreira Date: Tue, 23 Feb 2021 14:11:15 -0600 Subject: [PATCH 2/2] Bitten by go 1.16 mod changes and k8s kubelet changes of api (1.20 or 0.20). --- Dockerfile | 9 +++++---- argus.go | 2 +- main.go | 2 +- nvidia-server.go | 6 +++++- server.go | 6 +++++- 5 files changed, 17 insertions(+), 8 deletions(-) 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) {