kubernetes / sample-controller

Repository for sample controller. Complements sample-apiserver
Apache License 2.0
3.14k stars 1.08k forks source link

[Question] not enough arguments in call to watch.NewStreamWatcher #67

Closed StiviiK closed 4 years ago

StiviiK commented 4 years ago

Hi all, I am very new to K8s controller and tried to build my own controller based on this repo, but when I try to build the code I always receive the following error.

# k8s.io/client-go/rest
../../../../pkg/mod/k8s.io/client-go@v11.0.0+incompatible/rest/request.go:598:31: not enough arguments in call to watch.NewStreamWatcher
    have (*versioned.Decoder)
    want (watch.Decoder, watch.Reporter)

My project currently looks like this: https://github.com/StiviiK/wd-aep-k8s-controller (In the controller.go are still some other errors due to that I just copied the file from this repo and didn't fix all errors yet.)

StiviiK commented 4 years ago

Fixed the error by using the following go.mod:

go 1.14

require (
    k8s.io/api v0.0.0-20200214081623-ecbd4af0fc33
    k8s.io/apimachinery v0.0.0-20200214081019-7490b3ed6e92
    k8s.io/client-go v0.0.0-20200214082307-e38a84523341
    k8s.io/code-generator v0.0.0-20200214080538-dc8f3adce97c
    k8s.io/klog v1.0.0
)

replace (
    golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
    golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
    k8s.io/api => k8s.io/api v0.0.0-20200214081623-ecbd4af0fc33
    k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200214081019-7490b3ed6e92
    k8s.io/client-go => k8s.io/client-go v0.0.0-20200214082307-e38a84523341
    k8s.io/code-generator => k8s.io/code-generator v0.0.0-20200214080538-dc8f3adce97c
)
BlackKD commented 4 years ago

mark