mirror of
https://gitlab.com/arm-research/smarter/smarter-device-manager.git
synced 2024-11-21 10:13:35 +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
|
||||
|
||||
|
||||
|
||||
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"]
|
2
argus.go
2
argus.go
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019, ARM
|
||||
// Copyright (c) 2019, Arm Ltd
|
||||
|
||||
package main
|
||||
|
||||
|
10
compile.sh
10
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"
|
||||
|
@ -15,4 +15,4 @@
|
||||
- devicematch: ^vchiq$
|
||||
nummaxdevices: 20
|
||||
- devicematch: ^vcsm.*$
|
||||
nummaxdevices: 20
|
||||
nummaxdevices: 20
|
3
main.go
3
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)
|
||||
|
10
server.go
10
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 {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Copyright (c) 2019, Arm Ltd
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
Loading…
Reference in New Issue
Block a user