mirror of
https://gitlab.com/arm-research/smarter/smarter-device-manager.git
synced 2024-11-24 11:41:31 +00:00
Initial review
This commit is contained in:
parent
d6a5a36b3b
commit
734c123a61
@ -13,8 +13,6 @@ RUN echo $PATH;export CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-obje
|
|||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RUN apk update && apk upgrade
|
RUN apk update && apk upgrade
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
@ -22,6 +20,4 @@ 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 /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"]
|
2
argus.go
2
argus.go
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2019, ARM
|
// Copyright (c) 2019, Arm Ltd
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
10
compile.sh
10
compile.sh
@ -19,7 +19,7 @@ function printHelp() {
|
|||||||
fi
|
fi
|
||||||
if [ ${FLAG_USESQUASH} -gt 0 ]
|
if [ ${FLAG_USESQUASH} -gt 0 ]
|
||||||
then
|
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
|
else
|
||||||
echo " -S # Squash images - the default is not to squash the images"
|
echo " -S # Squash images - the default is not to squash the images"
|
||||||
fi
|
fi
|
||||||
@ -36,14 +36,13 @@ DIRECTORY_TO_RUN=.
|
|||||||
|
|
||||||
ARCHS="linux/arm/v7"
|
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_UPLOADIMAGES=1
|
||||||
FLAG_USESQUASH=0
|
FLAG_USESQUASH=0
|
||||||
FLAG_UPLOADMANIFEST=1
|
FLAG_UPLOADMANIFEST=1
|
||||||
|
|
||||||
# No changes to the image names
|
|
||||||
ADDITIONAL_TAG=""
|
ADDITIONAL_TAG=""
|
||||||
ADDITIONAL_IMAGE_NAME=""
|
ADDITIONAL_IMAGE_NAME=""
|
||||||
|
PUSH_OPTION=""
|
||||||
|
|
||||||
while getopts hA:B:MST:U name
|
while getopts hA:B:MST:U name
|
||||||
do
|
do
|
||||||
@ -78,7 +77,7 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
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 ]
|
if [ ${FLAG_UPLOADMANIFEST} -gt 0 ]
|
||||||
then
|
then
|
||||||
if [ -e ~/.docker/config.json ]
|
if [ -e ~/.docker/config.json ]
|
||||||
@ -94,7 +93,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PUSH_OPTION=""
|
|
||||||
if [ $FLAG_UPLOADIMAGES -gt 0 ]
|
if [ $FLAG_UPLOADIMAGES -gt 0 ]
|
||||||
then
|
then
|
||||||
PUSH_OPTION="--push"
|
PUSH_OPTION="--push"
|
||||||
|
3
main.go
3
main.go
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2019, ARM
|
// Copyright (c) 2019, Arm Ltd
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -80,7 +80,6 @@ func main() {
|
|||||||
glog.V(0).Info("Loading smarter-device-manager")
|
glog.V(0).Info("Loading smarter-device-manager")
|
||||||
|
|
||||||
// Setting up the devices to check
|
// Setting up the devices to check
|
||||||
|
|
||||||
var desiredDevices []DesiredDevice
|
var desiredDevices []DesiredDevice
|
||||||
glog.V(0).Info("Reading configuration file ",confFileName)
|
glog.V(0).Info("Reading configuration file ",confFileName)
|
||||||
yamlFile, err := ioutil.ReadFile(confFileName)
|
yamlFile, err := ioutil.ReadFile(confFileName)
|
||||||
|
10
server.go
10
server.go
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2019, ARM
|
// Copyright (c) 2019, Arm Ltd
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ func dial(unixSocketPath string, timeout time.Duration) (*grpc.ClientConn, error
|
|||||||
return c, nil
|
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 {
|
func (m *SmarterDevicePlugin) Start() error {
|
||||||
err := m.cleanup()
|
err := m.cleanup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -92,7 +92,7 @@ func (m *SmarterDevicePlugin) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop stops the gRPC server
|
// Stop the gRPC server
|
||||||
func (m *SmarterDevicePlugin) Stop() error {
|
func (m *SmarterDevicePlugin) Stop() error {
|
||||||
if m.server == nil {
|
if m.server == nil {
|
||||||
return nil
|
return nil
|
||||||
@ -105,7 +105,7 @@ func (m *SmarterDevicePlugin) Stop() error {
|
|||||||
return m.cleanup()
|
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 {
|
func (m *SmarterDevicePlugin) Register(kubeletEndpoint, resourceName string) error {
|
||||||
conn, err := dial(kubeletEndpoint, 5*time.Second)
|
conn, err := dial(kubeletEndpoint, 5*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -192,13 +192,11 @@ func (m *SmarterDevicePlugin) healthcheck() {
|
|||||||
disableHealthChecks = allHealthChecks
|
disableHealthChecks = allHealthChecks
|
||||||
}
|
}
|
||||||
|
|
||||||
//ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
_, cancel := context.WithCancel(context.Background())
|
_, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
var xids chan *pluginapi.Device
|
var xids chan *pluginapi.Device
|
||||||
if !strings.Contains(disableHealthChecks, "xids") {
|
if !strings.Contains(disableHealthChecks, "xids") {
|
||||||
xids = make(chan *pluginapi.Device)
|
xids = make(chan *pluginapi.Device)
|
||||||
//go watchXIDs(ctx, m.devs, xids)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// Copyright (c) 2019, Arm Ltd
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
Loading…
Reference in New Issue
Block a user