morvencao / kube-sidecar-injector

A Kubernetes mutating webhook server that implements sidecar injection
Apache License 2.0
628 stars 454 forks source link

init() function seems to have error #1

Closed eroteme closed 5 years ago

eroteme commented 6 years ago

When I try to compile kube-mutating-webhook-tutorial/webhook.go I get an error that
_ = v1.AddToScheme(runtimeScheme)

does not exist

./webhook.go:70:20: cannot use runtimeScheme (type "k8s.io/apimachinery/pkg/runtime".Scheme) as type "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime".Scheme in argument to "k8s.io/kubernetes/pkg/apis/core/v1".AddToScheme

When I comment out this line it seems to compile.

sedooe commented 5 years ago

You should dep ensure first.

chanehua commented 5 years ago

You should dep ensure first. I have the same issue; I had executed "go get -u github.com/golang/dep/cmd/dep";but also report : ./webhook.go:91:20: cannot use runtimeScheme (type "k8s.io/apimachinery/pkg/runtime".Scheme) as type "k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime".Scheme in argument to "k8s.io/kubernetes/pkg/apis/core/v1".AddToScheme. I cloud not find process issue method now.

chanehua commented 5 years ago

I execute "dep ensure" command after,go install well. thx!