flant / addon-operator

A system to manage additional components for Kubernetes cluster in a simple, consistent and automated way.
https://flant.github.io/addon-operator/
Apache License 2.0
483 stars 27 forks source link

Errors in main.go are not logged #445

Closed mbocharov-gpm closed 9 months ago

mbocharov-gpm commented 9 months ago

If you use the operator as is and do not add the /global-hooks directory to the image, the code exits with exit code 1 without any error messages

main.go

err := operator.Setup()
if err != nil {
    os.Exit(1)
}

err = operator.Start()
if err != nil {
    os.Exit(1)
}

It should be like this:

err := operator.Setup()
if err != nil {
    fmt.Printf("Error on setup: %s\n", err)
    os.Exit(1)
}

err = operator.Start()
if err != nil {
    fmt.Printf("Error on start: %s\n", err)
    os.Exit(1)
}

And error:

Error on setup: global hooks directory: path '/global-hooks' not exist

https://github.com/flant/addon-operator/blob/a7c885b5ec66bbacf21466dbc3044432202db361/cmd/addon-operator/main.go#L56C4-L56C13

nabokihms commented 9 months ago

@mbocharov-gpm good catch! Do you want to go ahead and make the change (open a PR)?

akaitux commented 9 months ago

@nabokihms https://github.com/flant/addon-operator/pull/446

nabokihms commented 9 months ago

Thanks! Really appreciate it. Closed in https://github.com/flant/addon-operator/pull/446