orborus update
This commit is contained in:
@@ -9,7 +9,7 @@ require (
|
||||
github.com/mackerelio/go-osstat v0.2.3
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/shuffle/shuffle-shared v0.4.59
|
||||
github.com/shuffle/shuffle-shared v0.4.62
|
||||
k8s.io/api v0.28.1
|
||||
k8s.io/apimachinery v0.28.1
|
||||
k8s.io/client-go v0.28.1
|
||||
|
||||
@@ -270,6 +270,8 @@ github.com/shuffle/shuffle-shared v0.4.57 h1:o+mMPRY4ourkE3R0qdi80jg6RlCtvAJ/VVr
|
||||
github.com/shuffle/shuffle-shared v0.4.57/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
||||
github.com/shuffle/shuffle-shared v0.4.59 h1:5Sv8aorgQJFZr3cCKltfycdXzp9v5zlF2l3GZXjrTEo=
|
||||
github.com/shuffle/shuffle-shared v0.4.59/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
||||
github.com/shuffle/shuffle-shared v0.4.62 h1:L76zWCD/7gIBuhr3feWZwzT4I8VCiLRd8ZAub/3EiO0=
|
||||
github.com/shuffle/shuffle-shared v0.4.62/go.mod h1:X613gbo0dT3fnYvXDRwjQZyLC+T49T2nSQOrCV5QMlI=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
|
||||
@@ -30,6 +30,9 @@ import (
|
||||
"sync"
|
||||
"math"
|
||||
|
||||
//"os/signal"
|
||||
//"syscall"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
@@ -71,7 +74,7 @@ var newWorkerImage = os.Getenv("SHUFFLE_WORKER_IMAGE")
|
||||
var dockerSwarmBridgeMTU = os.Getenv("SHUFFLE_SWARM_BRIDGE_DEFAULT_MTU")
|
||||
var dockerSwarmBridgeInterface = os.Getenv("SHUFFLE_SWARM_BRIDGE_DEFAULT_INTERFACE")
|
||||
var isKubernetes = os.Getenv("IS_KUBERNETES")
|
||||
var maxCPUPercent = 85
|
||||
var maxCPUPercent = 95
|
||||
|
||||
// var baseimagename = "docker.pkg.github.com/shuffle/shuffle"
|
||||
// var baseimagename = "ghcr.io/frikky"
|
||||
@@ -1182,8 +1185,23 @@ func getKubernetesClient() (*kubernetes.Clientset, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func cleanup() {
|
||||
log.Printf("[INFO] Cleaning up during shutdown")
|
||||
ctx := context.Background()
|
||||
cleanupExistingNodes(ctx)
|
||||
zombiecheck(ctx, 600)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Initial loop etc
|
||||
func main() {
|
||||
//sigCh := make(chan os.Signal, 1)
|
||||
//signal.Notify(sigCh, os.Interrupt, syscall.SIGTERM)
|
||||
//defer cleanup()
|
||||
//sig := <-sigCh
|
||||
//log.Printf("[INFO] Received signal %s. Exiting.", sig)
|
||||
|
||||
// Block until a signal is received
|
||||
if isRunningInCluster() {
|
||||
log.Printf("[INFO] Running inside k8s cluster")
|
||||
}
|
||||
@@ -1373,7 +1391,7 @@ func main() {
|
||||
log.Printf("[ERROR] Failed marshalling. Maybe max 4 second timeout? %s", err)
|
||||
}
|
||||
|
||||
if orborusStats.CPUPercent > maxCPUPercent {
|
||||
if int(orborusStats.CPUPercent) > maxCPUPercent {
|
||||
log.Printf("[DEBUG] CPU usage is at %f%%. This is more than the max limit the machine should be running at (%d). Waiting before continue.", orborusStats.CPUPercent, maxCPUPercent)
|
||||
time.Sleep(time.Duration(sleepTime) * time.Second)
|
||||
continue
|
||||
@@ -1614,6 +1632,7 @@ func main() {
|
||||
|
||||
time.Sleep(time.Duration(sleepTime) * time.Second)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Is this ok to do with Docker? idk :)
|
||||
|
||||
Reference in New Issue
Block a user