Compare commits
7 Commits
feature/ev
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a76f2b9fb | |||
| 07ca18e347 | |||
| c3f769ccd5 | |||
| 26e5db4572 | |||
| 937c811e8d | |||
| a9c7bb66ee | |||
| 1fda2b1334 |
2
Makefile
2
Makefile
@@ -17,7 +17,7 @@ docker:
|
||||
docker tag oc-schedulerd:latest oc/oc-schedulerd:0.0.1
|
||||
|
||||
publish-kind:
|
||||
kind load docker-image oc/oc-schedulerd:0.0.1 --name opencloud | true
|
||||
kind load docker-image oc/oc-schedulerd:0.0.1 --name $(CLUSTER_NAME) | true
|
||||
|
||||
publish-registry:
|
||||
@echo "TODO"
|
||||
|
||||
@@ -9,11 +9,7 @@ import (
|
||||
|
||||
type Config struct {
|
||||
MonitorPath string
|
||||
MongoUrl string
|
||||
DBName string
|
||||
Logs string
|
||||
LokiUrl string
|
||||
NatsUrl string
|
||||
Mode string
|
||||
KubeHost string
|
||||
KubePort string
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"oc-schedulerd/conf"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@@ -20,15 +21,15 @@ type ContainerMonitor struct {
|
||||
KubePort string
|
||||
}
|
||||
|
||||
func NewContainerMonitor(UUID string, peerId string, duration int) (Executor){
|
||||
func NewContainerMonitor(UUID string, peerId string, duration int) Executor {
|
||||
return &ContainerMonitor{
|
||||
Monitor: LocalMonitor{
|
||||
ExecutionID: UUID,
|
||||
PeerID: peerId,
|
||||
Duration: duration,
|
||||
LokiUrl: conf.GetConfig().LokiUrl,
|
||||
MongoUrl: conf.GetConfig().MongoUrl,
|
||||
DBName: conf.GetConfig().DBName,
|
||||
LokiUrl: oclib.GetConfig().LokiUrl,
|
||||
MongoUrl: oclib.GetConfig().MongoUrl,
|
||||
DBName: oclib.GetConfig().MongoDatabase,
|
||||
},
|
||||
KubeCA: conf.GetConfig().KubeCA,
|
||||
KubeCert: conf.GetConfig().KubeCert,
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"oc-schedulerd/conf"
|
||||
"os/exec"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
@@ -15,17 +16,16 @@ type LocalMonitor struct {
|
||||
LokiUrl string
|
||||
MongoUrl string
|
||||
DBName string
|
||||
|
||||
}
|
||||
|
||||
func NewLocalMonitor(UUID string, peerId string, duration int) (Executor){
|
||||
func NewLocalMonitor(UUID string, peerId string, duration int) Executor {
|
||||
return &LocalMonitor{
|
||||
ExecutionID: UUID,
|
||||
PeerID: peerId,
|
||||
Duration: duration,
|
||||
LokiUrl: conf.GetConfig().LokiUrl,
|
||||
MongoUrl: conf.GetConfig().MongoUrl,
|
||||
DBName: conf.GetConfig().DBName,
|
||||
LokiUrl: oclib.GetConfig().LokiUrl,
|
||||
MongoUrl: oclib.GetConfig().MongoUrl,
|
||||
DBName: oclib.GetConfig().MongoDatabase,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ func (lm *LocalMonitor) PrepareMonitorExec() []string {
|
||||
"-d", lm.DBName,
|
||||
}
|
||||
|
||||
|
||||
if lm.Duration > 0 {
|
||||
args = append(args, "-t", fmt.Sprintf("%d", lm.Duration))
|
||||
}
|
||||
@@ -70,4 +69,3 @@ func (lm *LocalMonitor) LaunchMonitor(args []string, l zerolog.Logger) {
|
||||
|
||||
logExecution(stdoutMonitord, l)
|
||||
}
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -5,7 +5,7 @@ go 1.23.0
|
||||
toolchain go1.24.0
|
||||
|
||||
require (
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260129122033-186ba3e689c7
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995
|
||||
github.com/beego/beego v1.12.12
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/goraz/onion v0.1.3
|
||||
|
||||
6
go.sum
6
go.sum
@@ -14,6 +14,12 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20260127143728-3c052bf16572 h1:jrUHgs4DqNWLn
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260127143728-3c052bf16572/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260129122033-186ba3e689c7 h1:NRFGRqN+j5g3DrtXMYN5T5XSYICG+OU2DisjBdID3j8=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260129122033-186ba3e689c7/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203074447-30e6c9a6183c h1:c19lIseiUk5Hp+06EowfEbMWH1pK8AC/hvQ4ryWgJtY=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203074447-30e6c9a6183c/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203083753-4f28b9b589d6 h1:N+0xkioACl3PNo+MquCIIOL/kSICevg340IYOFGQeOw=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203083753-4f28b9b589d6/go.mod h1:vHWauJsS6ryf7UDqq8hRXoYD5RsONxcFTxeZPOztEuI=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995 h1:ZDRvnzTTNHgMm5hYmseHdEPqQ6rn/4v+P9f/JIxPaNw=
|
||||
cloud.o-forge.io/core/oc-lib v0.0.0-20260203150531-ef916fe2d995/go.mod h1:T0UCxRd8w+qCVVC0NEyDiWIGC5ADwEbQ7hFcvftd4Ks=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
|
||||
16
main.go
16
main.go
@@ -14,18 +14,6 @@ func main() {
|
||||
l := oclib.GetLogger()
|
||||
o := oclib.GetConfLoader()
|
||||
|
||||
c := oclib.SetConfig(
|
||||
o.GetStringDefault("MONGO_URL", "mongodb://127.0.0.1:27017"),
|
||||
o.GetStringDefault("MONGO_DATABASE", "DC_myDC"),
|
||||
o.GetStringDefault("NATS_URL", "nats://localhost:4222"),
|
||||
o.GetStringDefault("LOKI_URL", ""),
|
||||
o.GetStringDefault("LOG_LEVEL", "info"),
|
||||
)
|
||||
|
||||
conf.GetConfig().DBName = c.MongoDatabase
|
||||
conf.GetConfig().MongoUrl = c.MongoUrl
|
||||
conf.GetConfig().NatsUrl = c.NATSUrl
|
||||
conf.GetConfig().LokiUrl = c.LokiUrl
|
||||
conf.GetConfig().Mode = o.GetStringDefault("MODE", "")
|
||||
|
||||
if conf.GetConfig().Mode == "container" {
|
||||
@@ -57,9 +45,9 @@ func main() {
|
||||
exe_mngr := daemons.ExecutionManager{}
|
||||
|
||||
go tools.NewNATSCaller().ListenNats(map[tools.NATSMethod]func(tools.NATSResponse){
|
||||
tools.CREATE_EXECTUTION: sch_mngr.GetNextScheduledWorkflows,
|
||||
tools.CREATE_EXECTUTION: sch_mngr.GetNextScheduledWorkflows, // TODO: unused for now...
|
||||
tools.WORKFLOW_EVENT: sch_mngr.ExecuteWorkflow,
|
||||
tools.REMOVE_EXECUTION: daemons.Executions.DeleteSchedules,
|
||||
tools.REMOVE_EXECUTION: daemons.Executions.DeleteSchedules, // TODO: unused for now...
|
||||
})
|
||||
go sch_mngr.SchedulePolling()
|
||||
exe_mngr.RetrieveNextExecutions()
|
||||
|
||||
Reference in New Issue
Block a user