feat: implement run and run:detached

This utilizes a Kubernetes Job to start a pod in order to take advantage of completed Job cleanup in Kubernetes. It also properly handles interactivity by ensuring the container has a TTY.

Note that there is currently no provision for parsing docker arguments and translating them into their Kubernetes equivalents.
This commit is contained in:
Jose Diaz-Gonzalez committed 2024-01-23 03:00:27 -05:00
1 parent 6b85374857
commit 8b8444fb1f
10 files changed
+833 -115

No files matched your search

+20 -1
View File
@@ -53,7 +53,10 @@ func main() {
appName := flag.Arg(1)
containerType := flag.Arg(2)
args := flag.Args()
if len(args) > 3 {
if len(args) == 2 {
_, args = common.ShiftString(args)
_, args = common.ShiftString(args)
} else if len(args) >= 3 {
_, args = common.ShiftString(args)
_, args = common.ShiftString(args)
_, args = common.ShiftString(args)
@@ -86,6 +89,22 @@ func main() {
scheduler := flag.Arg(0)
appName := flag.Arg(1)
err = scheduler_k3s.TriggerSchedulerStop(scheduler, appName)
case "scheduler-run":
var envCount int
scheduler := flag.Arg(0)
appName := flag.Arg(1)
envCount, err = strconv.Atoi(flag.Arg(2))
if err != nil {
envCount = 0
}
args := flag.Args()
if len(args) >= 3 {
_, args = common.ShiftString(args)
_, args = common.ShiftString(args)
_, args = common.ShiftString(args)
}
err = scheduler_k3s.TriggerSchedulerRun(scheduler, appName, envCount, args)
default:
err = fmt.Errorf("Invalid plugin trigger call: %s", trigger)
}