Operator-sdk: Build operator-sdk failed

Created on 7 Dec 2018  路  12Comments  路  Source: operator-framework/operator-sdk

Bug Report

What did you do?
I build the operator-sdk per this quick-start, but got errors when running make dep:

mac:operator-sdk jianzhang$ pwd
/Users/jianzhang/goproject/src/github.com/operator-framework/operator-sdk
mac:operator-sdk jianzhang$ git branch
* master
mac:operator-sdk jianzhang$ make dep
# Bringing vendor into sync
(1/38) Wrote github.com/Masterminds/[email protected]: missing from vendor
grouped write of manifest, lock and vendor: failed to export google.golang.org/appengine: fatal: failed to unpack tree object 4a4468ece617fc8205e99368fa2200e9d1fad421
: exit status 128
make: *** [dep] Error 1

So, I tried to update the Golang packages, got errors:

mac:operator-sdk jianzhang$ go get -u ./...
package k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource: cannot find package "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" in any of:
    /usr/local/Cellar/go/1.11.1/libexec/src/k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource (from $GOROOT)
    /Users/jianzhang/goproject/src/k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource (from $GOPATH)

What did you expect to see?
Build the operator-sdk successfully.

What did you see instead? Under which circumstances?

Environment

  • operator-sdk version:
    master branch
mac:operator-sdk jianzhang$ git log
commit 3a20d44134fc248af7f41e700ba5232c264b1707 (HEAD -> master, origin/master, origin/HEAD)
Author: Matt Dorn <[email protected]>
Date:   Thu Dec 6 16:26:24 2018 -0600

    add cluster-scoped flag to v0.2.0 changelog (#822)

    add cluster-scoped flag to v0.2.0 changelog
  • Kubernetes version information:
    Using the oc instead.
    mac:operator-sdk jianzhang$ oc version
    oc v3.11.0+0cbc58b
    kubernetes v1.11.0+d4cacc0
    features: Basic-Auth

  • Kubernetes cluster kind:

  • Are you writing your operator in ansible or go?
    go

Possible Solution

Additional context

mac:operator-sdk jianzhang$ dep version
dep:
 version     : v0.5.0
 build date  : 2018-07-26
 git hash    : 224a564
 go version  : go1.10.3
 go compiler : gc
 platform    : darwin/amd64
 features    : ImportDuringSolve=false
mac:operator-sdk jianzhang$ echo $GOPATH
/Users/jianzhang/goproject
mac:operator-sdk jianzhang$ echo $GOROOT
/usr/local/Cellar/go/1.11.1/libexec
mac:operator-sdk jianzhang$ go version
go version go1.11.1 darwin/amd64
triagsupport

Most helpful comment

@LiliC , thank you very much for your quick response. It helped, the build is working!

All 12 comments

Thanks for your report and the detailed context! I tried to recreate this locally but with no success. make dep with current master works for me fine. I also have a mac, but the only difference is that my go version is go version go1.11.2 darwin/amd64. Maybe try upgrading your go version?

Also note: if dep fails it sometimes leaves behind a temp vendor directory, think it's called .vendor-new, so maybe clean that up before retrying.

I am able to build operator-sdk (just tried on recent master) but the operator build is failing for me.

cd $GOPATH/src/github.com/example-inc/
operator-sdk new app-operator
cd app-operator
operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=AppService
operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=AppService
operator-sdk build quay.io/example/app-operator

leads to:

# github.com/example-inc/app-operator/vendor/sigs.k8s.io/controller-runtime/pkg/client
vendor/sigs.k8s.io/controller-runtime/pkg/client/unstructured_client.go:49:24: undefined: v1.CreateOptions
vendor/sigs.k8s.io/controller-runtime/pkg/client/unstructured_client.go:67:24: undefined: v1.UpdateOptions
vendor/sigs.k8s.io/controller-runtime/pkg/client/unstructured_client.go:145:26: too many arguments in call to r.UpdateStatus
vendor/sigs.k8s.io/controller-runtime/pkg/client/unstructured_client.go:145:30: undefined: v1.UpdateOptions

My go version:

go version go1.11 linux/amd64

Any idea, please?

@mareklibra Thanks for your report, I could reproduce yours, looking into it right now. Although your issue differs from @jianzhangbjz.

@mareklibra Can you try the following:

In the example-inc Gopkg.toml file can you replace the "sigs.k8s.io/controller-runtime" constraint with the following:

[[override]]
  name = "sigs.k8s.io/controller-runtime"
  revision = "53fc44b56078cd095b11bd44cfa0288ee4cf718f"

and try building again. Thank you so much!

@LiliC , thank you very much for your quick response. It helped, the build is working!

@LiliC Thanks for your quick reply. I didn't update the go, but used dep ensure -update -v command to sync the Gopkg.toml to Gopkg.lock, and then it worked.

mac:operator-sdk jianzhang$ make install 
mac:operator-sdk jianzhang$ operator-sdk --version
operator-sdk version v0.2.0+git
mac:operator-sdk jianzhang$ go version
go version go1.11.1 darwin/amd64

I was trying to build operator-sdk as per guide, but ran into issue when I tried make install.

I got the following error:

github.com/operator-framework/operator-sdk/vendor/google.golang.org/grpc/resolver

compile: version "go1.11.4" does not match go tool version "go1.11.5"
make: * [install] Error 2

Here are the details:

go version go1.11.5 darwin/amd64
GitVersion:"v1.13.1"

$GOPATH/src/github.com/operator-framework/operator-sdk

@mandaltu123 Have you tried the make dep-update?

hey @jianzhangbjz thanks for your reply.
yeah I tried "dep ensure -update -v" and "make dep-update", but after that when i ran make install, I still got error
compile: version "go1.11.4" does not match go tool version "go1.11.5"

Here is my question:

  1. do I need to run "make install" after "make dep-update" ?

    as per your suggestion, I ran make dep-update and got following result:
    Solver wall times by segment:
    b-list-versions: 2m30.589227825s
    b-gmal: 23.946338738s
    b-source-exists: 2.425583008s
    satisfy: 809.635092ms
    select-atom: 672.009189ms
    b-list-pkgs: 626.408029ms
    unselect: 145.336477ms
    new-atom: 15.447257ms
    select-root: 7.686788ms
    backtrack: 4.49234ms
    b-deduce-proj-root: 3.752925ms
    other: 1.099135ms
    add-atom: 614.568碌s
    b-rev-present-in: 47.541碌s

    TOTAL: 2m59.247678912s

==========> after this do I need to run "make install" ? or I dont need to run make install and operator-sdk will get installed ?

  1. compile: version "go1.11.4" does not match go tool version "go1.11.5" :-> does this error [from make install] command mean I need to downgrade my go version to 11.4 from 11.5 ?

I am getting following error with make dep-update:
package github.com/docker/docker/api/types does not exist within project github.com/docker/docker
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/golang/dep/gps.(solver).findValidVersion(0xc42021e000, 0xc422e6cd20, 0xc4214ac000, 0xe, 0xe, 0x0, 0xc4214ac000)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/gps/solver.go:945 +0x4b9
github.com/golang/dep/gps.(
solver).backtrack(0xc42021e000, 0x15fc280, 0xc420022278, 0x0, 0x0, 0x0)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/gps/solver.go:1079 +0xc5e
github.com/golang/dep/gps.(solver).solve(0xc42021e000, 0x15fc280, 0xc420022278, 0x139a177, 0x1505a20, 0xc420066000)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/gps/solver.go:566 +0x43c
github.com/golang/dep/gps.(
solver).Solve(0xc42021e000, 0x15fc280, 0xc420022278, 0x1878f80, 0xc42002a028, 0x2a, 0xc42025ba10)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/gps/solver.go:440 +0xc8
main.(ensureCommand).runUpdate(0xc4201819f0, 0xc4200c0980, 0xc42001f4b0, 0x0, 0x0, 0xc4200e0120, 0x1600220, 0xc42028fa40, 0xc42002a004, 0x4e, ...)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/cmd/dep/ensure.go:356 +0x1c2
main.(
ensureCommand).Run(0xc4201819f0, 0xc4200c0980, 0xc42001f4b0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/cmd/dep/ensure.go:216 +0x7a9
main.(Config).Run(0xc420080fc0, 0x0)
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/cmd/dep/main.go:212 +0xfae
main.main()
/private/tmp/dep-20180726-75389-66ueij/src/github.com/golang/dep/cmd/dep/main.go:84 +0x54d
make: *
* [dep-update] Error 2

You should not need to run make dep-update.

Can you try deleting $GOPATH/src/github.com/operator-framework/operator-sdk and retrying the steps documented here: https://github.com/operator-framework/operator-sdk#quick-start

I was able to run those steps successfully on Linux with go1.11.5, but I will also try reproducing on my Mac.

EDIT: I was also able to successfully run those steps on Mac with go1.11.5.

@joelanford thanks for the replies.

I was able to set it up.
I guess there were couple of issues on my environment variables.
I installed golang from .pkg file on mac and I guess I was not supposed to add GOROOT on .zshrc, so commented that out.

That worked. However make install did not really automatically add entries for operator-sdk.

I had to add it manually to the PATH and created a softlink on /usr/local/bin.

Now I can run operator-sdk.

Thanks a lot for your time guys, appreciate it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flickerfly picture flickerfly  路  5Comments

joelanford picture joelanford  路  3Comments

lsalazar1 picture lsalazar1  路  4Comments

magescher picture magescher  路  3Comments

ffoysal picture ffoysal  路  3Comments