Docker oc-schedulerd

This commit is contained in:
mr 2025-02-17 16:55:01 +01:00
parent 7246dea2b2
commit b753523c35
6 changed files with 29 additions and 7 deletions

View File

@ -19,6 +19,8 @@ COPY --from=builder /app/oc-schedulerd /usr/bin/oc-schedulerd
COPY docker_schedulerd.json /etc/oc/schedulerd.json
COPY argo_workflows .
EXPOSE 8080
ENTRYPOINT ["oc-schedulerd"]

View File

@ -15,6 +15,11 @@ type Config struct {
LokiUrl string
NatsUrl string
Mode string
KubeHost string
KubePort string
KubeCA string
KubeCert string
KubeData string
}
var instance *Config

View File

@ -31,7 +31,13 @@ func (lm *LocalMonitor) LaunchLocalMonitor() {
}
func (lm *LocalMonitor) execLocalKube() {
args := []string{"-e", lm.ExecutionID, "-p", lm.PeerID, "-u", lm.LokiURL, "-m", conf.GetConfig().MongoUrl, "-d", conf.GetConfig().DBName, "-M", conf.GetConfig().Mode}
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))
}

View File

@ -1,9 +1,12 @@
{
"LOKI_URL" : "loki://loki:3100",
"LOKI_URL" : "http://loki:3100",
"MONGO_URL":"mongodb://mongo:27017/",
"NATS_URL":"nats://nats:4222",
"MONGO_DATABASE":"DC_myDC",
"KUBERNETES_SERVICE_HOST" : "193.50.43.14",
"KUBE_CA" : "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJWUxWNkFPQkdrU1F3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF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BFb1dhd1NKUzJlRW5oWmlYMk5VZlY1ZlhKV2krSVNnV09TNFE5VTlvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFVUozblJZN0tCNEtUWUx0WnFUMS96VS84a0Z2Sk1lUGhYMm1Vc25pczBiR3FZblkyaVZEeApYVzR2SVhTYjNqcm9iZ1YwSUtDT0twUWs2OHJEbE03ckRBPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo="
}

10
main.go
View File

@ -9,9 +9,9 @@ import (
)
func main() {
oclib.InitDaemon("oc-schedulerd")
o := oclib.GetConfLoader()
oclib.InitDaemon("oc-schedulerd")
oclib.SetConfig(
conf.GetConfig().MongoUrl,
conf.GetConfig().DBName,
@ -19,7 +19,13 @@ func main() {
conf.GetConfig().LokiUrl,
conf.GetConfig().Logs,
)
conf.GetConfig().Mode = o.GetStringDefault("MODE", "kubernetes")
conf.GetConfig().Mode = o.GetStringDefault("MODE", "")
conf.GetConfig().KubeHost = o.GetStringDefault("KUBERNETES_SERVICE_HOST", "")
conf.GetConfig().KubePort = o.GetStringDefault("KUBERNETES_SERVICE_PORT", "6443")
conf.GetConfig().KubeCA = o.GetStringDefault("KUBE_CA", "")
conf.GetConfig().KubeCert = o.GetStringDefault("KUBE_CERT", "")
conf.GetConfig().KubeData = o.GetStringDefault("KUBE_DATA", "")
sch_mngr := daemons.ScheduleManager{Logger: oclib.GetLogger()}
exe_mngr := daemons.ExecutionManager{}

Binary file not shown.