From 734c123a618189daa8d0e6b2edb9ec16d3b6de40 Mon Sep 17 00:00:00 2001 From: "Luis E. P" Date: Fri, 17 Jan 2020 15:25:46 -0600 Subject: [PATCH] Initial review --- Dockerfile | 6 +----- argus.go | 2 +- compile.sh | 10 ++++------ conf.yaml | 2 +- main.go | 3 +-- server.go | 10 ++++------ watchers.go | 2 ++ 7 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb41523..b4c4ae9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,6 @@ RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-obje FROM alpine - - RUN apk update && apk upgrade WORKDIR /root @@ -22,6 +20,4 @@ WORKDIR /root COPY conf.yaml /root/config/conf.yaml COPY --from=build /go/bin/smarter-device-management /usr/bin/smarter-device-management - - -CMD ["smarter-device-management","-logtostderr=true","-v=0"] +CMD ["smarter-device-management","-logtostderr=true","-v=0"] \ No newline at end of file diff --git a/argus.go b/argus.go index a0077ff..75aabac 100644 --- a/argus.go +++ b/argus.go @@ -1,4 +1,4 @@ -// Copyright (c) 2019, ARM +// Copyright (c) 2019, Arm Ltd package main diff --git a/compile.sh b/compile.sh index 63c74c5..14262a0 100755 --- a/compile.sh +++ b/compile.sh @@ -19,7 +19,7 @@ function printHelp() { fi if [ ${FLAG_USESQUASH} -gt 0 ] then - echo " -S # Do not squash images - the default is squash the images" + echo " -S # Do not squash images - the default is to squash the images" else echo " -S # Squash images - the default is not to squash the images" fi @@ -36,14 +36,13 @@ DIRECTORY_TO_RUN=. ARCHS="linux/arm/v7" -# If the user does not change it the images will be uploaded to the registry +# Variable defaults FLAG_UPLOADIMAGES=1 FLAG_USESQUASH=0 FLAG_UPLOADMANIFEST=1 - -# No changes to the image names ADDITIONAL_TAG="" ADDITIONAL_IMAGE_NAME="" +PUSH_OPTION="" while getopts hA:B:MST:U name do @@ -78,7 +77,7 @@ do esac done -# We need docker to support manifest for multiarch, try so see if we have it +# We need docker client to support manifest for multiarch, try so see if we have it enabled if [ ${FLAG_UPLOADMANIFEST} -gt 0 ] then if [ -e ~/.docker/config.json ] @@ -94,7 +93,6 @@ EOF fi fi -PUSH_OPTION="" if [ $FLAG_UPLOADIMAGES -gt 0 ] then PUSH_OPTION="--push" diff --git a/conf.yaml b/conf.yaml index a4e0860..ea66e94 100644 --- a/conf.yaml +++ b/conf.yaml @@ -15,4 +15,4 @@ - devicematch: ^vchiq$ nummaxdevices: 20 - devicematch: ^vcsm.*$ - nummaxdevices: 20 + nummaxdevices: 20 \ No newline at end of file diff --git a/main.go b/main.go index 49785cf..6f23064 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// Copyright (c) 2019, ARM +// Copyright (c) 2019, Arm Ltd package main @@ -80,7 +80,6 @@ func main() { glog.V(0).Info("Loading smarter-device-manager") // Setting up the devices to check - var desiredDevices []DesiredDevice glog.V(0).Info("Reading configuration file ",confFileName) yamlFile, err := ioutil.ReadFile(confFileName) diff --git a/server.go b/server.go index ab110ef..7003b07 100644 --- a/server.go +++ b/server.go @@ -1,4 +1,4 @@ -// Copyright (c) 2019, ARM +// Copyright (c) 2019, Arm Ltd package main @@ -63,7 +63,7 @@ func dial(unixSocketPath string, timeout time.Duration) (*grpc.ClientConn, error return c, nil } -// Start starts the gRPC server of the device plugin +// Start the gRPC server of the device plugin func (m *SmarterDevicePlugin) Start() error { err := m.cleanup() if err != nil { @@ -92,7 +92,7 @@ func (m *SmarterDevicePlugin) Start() error { return nil } -// Stop stops the gRPC server +// Stop the gRPC server func (m *SmarterDevicePlugin) Stop() error { if m.server == nil { return nil @@ -105,7 +105,7 @@ func (m *SmarterDevicePlugin) Stop() error { return m.cleanup() } -// Register registers the device plugin for the given resourceName with Kubelet. +// Register the device plugin for the given resourceName with Kubelet. func (m *SmarterDevicePlugin) Register(kubeletEndpoint, resourceName string) error { conn, err := dial(kubeletEndpoint, 5*time.Second) if err != nil { @@ -192,13 +192,11 @@ func (m *SmarterDevicePlugin) healthcheck() { disableHealthChecks = allHealthChecks } - //ctx, cancel := context.WithCancel(context.Background()) _, cancel := context.WithCancel(context.Background()) var xids chan *pluginapi.Device if !strings.Contains(disableHealthChecks, "xids") { xids = make(chan *pluginapi.Device) - //go watchXIDs(ctx, m.devs, xids) } for { diff --git a/watchers.go b/watchers.go index 26c60af..8048995 100644 --- a/watchers.go +++ b/watchers.go @@ -1,3 +1,5 @@ +// Copyright (c) 2019, Arm Ltd + package main import (