Merge branch 'feature/order' into main
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"oc-schedulerd/conf"
|
||||
"os/exec"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@@ -13,6 +12,7 @@ type LocalMonitor struct {
|
||||
LokiURL string
|
||||
KubeURL string
|
||||
ExecutionID string
|
||||
PeerID string
|
||||
Duration int
|
||||
Logger zerolog.Logger
|
||||
}
|
||||
@@ -21,17 +21,17 @@ func (lm *LocalMonitor) LaunchLocalMonitor() {
|
||||
if lm.LokiURL == "" || lm.KubeURL == "" || lm.ExecutionID == "" {
|
||||
lm.Logger.Error().Msg("Missing parameter in LocalMonitor")
|
||||
}
|
||||
|
||||
// For dev purposes, in prod KubeURL must be a kube API's URL
|
||||
if lm.KubeURL != "localhost" {
|
||||
lm.execRemoteKube()
|
||||
} else {
|
||||
lm.execLocalKube()
|
||||
}
|
||||
lm.execKube()
|
||||
}
|
||||
|
||||
func (lm *LocalMonitor) execLocalKube() {
|
||||
args := []string{"-e", lm.ExecutionID, "-u", lm.LokiURL, "-m", oclib.GetConfig().MongoUrl, "-d", oclib.GetConfig().MongoDatabase}
|
||||
func (lm *LocalMonitor) execKube() {
|
||||
args := []string{"-e", lm.ExecutionID, "-p", lm.PeerID, "-u", lm.LokiURL, "-m", conf.GetConfig().MongoUrl,
|
||||
"-d", conf.GetConfig().DBName}
|
||||
|
||||
if conf.GetConfig().Mode == "kubernetes" {
|
||||
args = append(args, []string{"-M", conf.GetConfig().Mode, "-H", conf.GetConfig().KubeHost, "-P", conf.GetConfig().KubePort,
|
||||
"-C", conf.GetConfig().KubeCert, "-D", conf.GetConfig().KubeData, "-c", conf.GetConfig().KubeCA}...)
|
||||
}
|
||||
if lm.Duration > 0 {
|
||||
args = append(args, "-t", fmt.Sprintf("%d", lm.Duration))
|
||||
}
|
||||
@@ -42,6 +42,3 @@ func (lm *LocalMonitor) execLocalKube() {
|
||||
lm.Logger.Error().Msg("Could not start oc-monitor for " + lm.ExecutionID + " : " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : implement this
|
||||
func (lm *LocalMonitor) execRemoteKube() {}
|
||||
|
||||
Reference in New Issue
Block a user