operator-sdk up local creates an ERRO[0000] that cannot be resolved by the user

Created on 6 Sep 2018  路  6Comments  路  Source: operator-framework/operator-sdk

As far as I understand, the following error:

$ user@host on master > operator-sdk up local
INFO[0000] Go Version: go1.11
INFO[0000] Go OS/Arch: darwin/amd64
INFO[0000] operator-sdk Version: 0.0.5+git
ERRO[0000] failed to initialize service object for operator metrics: OPERATOR_NAME must be set

screen shot 2018-09-06 at 4 43 45 pm

Cannot be resolved by the user who is running the sdk locally. My preference would be not to see it, unless there is a way that I can do something meaningful to resolve the message properly.

@fanminshi @robszumski @hasbro17 fyi, thanks!

Most helpful comment

hi, meanwhile, a note in the user-guide would be nice. Because going through the guide you hit this right away

All 6 comments

Setting OPERATOR_NAME in your shell or removing sdk.ExposeMetricsPort() from file cmd/${your_operator}/main.go should resolve this issue.

@estroz yeah, your approach works. However, we should prevent this warning from happening if the user is running the operator locally.

I would suggest we set the environment variable OPEATOR_NAME as part of up local process, we have the operator name as we parse the config file which contains ProjectName https://github.com/operator-framework/operator-sdk/blob/280ebfaef7d43ff6712fe7358480c69e750a29cc/pkg/generator/gen_config.go#L30

That would fix the error msg and also generate the metrics service file, but maybe the best solution would be come up with a different way on how to get the operator name in general.

@LiliC Reopening this since it got closed when #564 got merged. We decided not to fix it in #564 and instead go with the approach you've suggested above, to pass in the env var to operator-sdk up local. We'll have to do that in another PR.

hi, meanwhile, a note in the user-guide would be nice. Because going through the guide you hit this right away

Think this should actually be fixed now, both leader election and metrics do not fail when running locally, just log the errors. Feel free to reopen if it's still an issue.

Was this page helpful?
0 / 5 - 0 ratings