debug
This commit is contained in:
parent
feca395039
commit
696493fe5a
@ -2,13 +2,11 @@ FROM golang:alpine AS builder
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN apt install tar/stable
|
|
||||||
RUN go build .
|
RUN go build .
|
||||||
|
|
||||||
FROM argoproj/argocd:latest
|
FROM argoproj/argocd:latest
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /bin/tar /bin/tar
|
|
||||||
COPY conf/docker_ocmonitord_conf.json /app/conf/
|
COPY conf/docker_ocmonitord_conf.json /app/conf/
|
||||||
COPY --from=builder /app/oc-monitord .
|
COPY --from=builder /app/oc-monitord .
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"oc-catalog": "https://oc-catalog:8087"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"oc-catalog": "https://localhost:8087"
|
|
||||||
}
|
|
15
main.go
15
main.go
@ -115,6 +115,7 @@ func executeWorkflow(argo_file_path string) {
|
|||||||
// var stderr io.ReadCloser
|
// var stderr io.ReadCloser
|
||||||
var err error
|
var err error
|
||||||
cmd := exec.Command("argo", "submit", "--watch", "./argo_workflows/"+argo_file_path, "--serviceaccount=argo", "-n", "argo")
|
cmd := exec.Command("argo", "submit", "--watch", "./argo_workflows/"+argo_file_path, "--serviceaccount=argo", "-n", "argo")
|
||||||
|
fmt.Println(cmd)
|
||||||
if stdout, err = cmd.StdoutPipe(); err != nil {
|
if stdout, err = cmd.StdoutPipe(); err != nil {
|
||||||
wf_logger.Error().Msg("Could not retrieve stdoutpipe " + err.Error())
|
wf_logger.Error().Msg("Could not retrieve stdoutpipe " + err.Error())
|
||||||
return
|
return
|
||||||
@ -199,18 +200,17 @@ func loadConfig(is_k8s bool, parser *argparse.Parser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setConf(is_k8s bool, o *onion.Onion, parser *argparse.Parser) {
|
func setConf(is_k8s bool, o *onion.Onion, parser *argparse.Parser) {
|
||||||
mongo := ""
|
|
||||||
db := ""
|
|
||||||
if is_k8s {
|
if is_k8s {
|
||||||
conf.GetConfig().LokiURL = o.GetStringDefault("lokiurl", "http://127.0.0.1:3100")
|
conf.GetConfig().LokiURL = o.GetStringDefault("lokiurl", "http://127.0.0.1:3100")
|
||||||
conf.GetConfig().ExecutionID = o.GetString("workflow")
|
conf.GetConfig().ExecutionID = o.GetString("workflow")
|
||||||
mongo = o.GetStringDefault("mongourl", "mongodb://127.0.0.1:27017")
|
mongo := o.GetStringDefault("mongourl", "mongodb://127.0.0.1:27017")
|
||||||
db = o.GetStringDefault("database", "DC_myDC")
|
db := o.GetStringDefault("database", "DC_myDC")
|
||||||
|
oclib.SetConfig(mongo, db)
|
||||||
} else {
|
} else {
|
||||||
url := parser.String("u", "url", &argparse.Options{Required: true, Default: "http://127.0.0.1:3100", Help: "Url to the Loki database logs will be sent to"})
|
url := parser.String("u", "url", &argparse.Options{Required: true, Default: "http://127.0.0.1:3100", Help: "Url to the Loki database logs will be sent to"})
|
||||||
workflow := parser.String("w", "workflow", &argparse.Options{Required: true, Help: "Execution ID of the workflow to request from oc-catalog API"})
|
workflow := parser.String("w", "workflow", &argparse.Options{Required: true, Help: "Execution ID of the workflow to request from oc-catalog API"})
|
||||||
mongo = *parser.String("m", "mongo", &argparse.Options{Required: true, Help: "URL to reach the MongoDB"})
|
mongo := parser.String("m", "mongo", &argparse.Options{Required: true, Default: "mongodb://127.0.0.1:27017", Help: "URL to reach the MongoDB"})
|
||||||
db = *parser.String("d", "database", &argparse.Options{Required: true, Help: "Name of the database to query in MongoDB"})
|
db := parser.String("d", "database", &argparse.Options{Required: true, Default: "DC_myDC", Help: "Name of the database to query in MongoDB"})
|
||||||
err := parser.Parse(os.Args)
|
err := parser.Parse(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(parser.Usage(err))
|
fmt.Println(parser.Usage(err))
|
||||||
@ -218,8 +218,9 @@ func setConf(is_k8s bool, o *onion.Onion, parser *argparse.Parser) {
|
|||||||
}
|
}
|
||||||
conf.GetConfig().LokiURL = *url
|
conf.GetConfig().LokiURL = *url
|
||||||
conf.GetConfig().ExecutionID = *workflow
|
conf.GetConfig().ExecutionID = *workflow
|
||||||
|
oclib.SetConfig(*mongo, *db)
|
||||||
}
|
}
|
||||||
oclib.SetConfig(mongo, db)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initOnion(o *onion.Onion) *onion.Onion {
|
func initOnion(o *onion.Onion) *onion.Onion {
|
||||||
|
BIN
oc-monitord
BIN
oc-monitord
Binary file not shown.
@ -26,7 +26,7 @@ type Workflow struct {
|
|||||||
ApiVersion string `yaml:"apiVersion"`
|
ApiVersion string `yaml:"apiVersion"`
|
||||||
Kind string `yaml:"kind"`
|
Kind string `yaml:"kind"`
|
||||||
Metadata struct {
|
Metadata struct {
|
||||||
Name string `yaml:"Name"`
|
Name string `yaml:"name"`
|
||||||
} `yaml:"metadata"`
|
} `yaml:"metadata"`
|
||||||
Spec Spec `yaml:"spec,omitempty"`
|
Spec Spec `yaml:"spec,omitempty"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user