-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Bug Report
What did you do?
I generated an operator with --cluster-scoped
Then in my code I called the function
metrics.ExposeMetricsPort()
This does not work. Service creation fails:
{"level":"error","ts":1544610953.1499157,"logger":"metrics","caller":"metrics/metrics.go:54","msg":"failed to create service for operator metrics","error":"an empty namespace may not be set during creation","stacktrace":"github.com/amadeusitgroup/---/go-logr/zapr.(*zapLogger).Error\n\t/home/dbenque/---/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/amadeusitgroup/---/vendor/github.com/operator-framework/operator-sdk/pkg/metrics.ExposeMetricsPort\n\t/home/dbenque/---/vendor/github.com/operator-framework/operator-sdk/pkg/metrics/metrics.go:54\nmain.main\n\t/home/dbenque/---/cmd/manager/main.go:74\nruntime.main\n\t/home/dbenque/code/goroot/src/runtime/proc.go:201"}
What did you expect to see?
Service creation to expose metrics inside the namespace where the operator is running.
What did you see instead? Under which circumstances?
Error in logs (See above) + No service creation
Environment
- operator-sdk version:
operator-sdk version v0.1.1+git
[[projects]]
branch = "master"
digest = "1:dddee56f7208e9df866e44e8a14749e1048395af27d72b498a35f543ac8b3465"
name = "github.com/operator-framework/operator-sdk"
packages = [
"pkg/k8sutil",
"pkg/metrics",
"version",
]
pruneopts = "NT"
revision = "9ae4ed9972e0296799a60ab9341c6a9138a77509"
- Kubernetes version information:
> kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2017-12-15T21:07:38Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2018-01-26T19:04:38Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
-
Kubernetes cluster kind:
Minikube -
Are you writing your operator in ansible or go?
Go
Possible Solution
In case of cluster scope operator, the service should be created inside the namespace of the operator and not inside the WATCHNAMESPACE that is empty in that case.
I will try to propose a PR for that.
Additional context
None
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.