Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build operator-sdk failed #827

Closed
jianzhangbjz opened this issue Dec 7, 2018 · 12 comments · Fixed by #830
Closed

Build operator-sdk failed #827

jianzhangbjz opened this issue Dec 7, 2018 · 12 comments · Fixed by #830
Labels
triage/support Indicates an issue that is a support question.

Comments

@jianzhangbjz
Copy link
Contributor

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/semver@v1.4.2: 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
@lilic
Copy link
Member

lilic commented Dec 7, 2018

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.

@lilic lilic added the triage/support Indicates an issue that is a support question. label Dec 7, 2018
@mareklibra
Copy link

mareklibra commented Dec 7, 2018

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?

@lilic
Copy link
Member

lilic commented Dec 7, 2018

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

@lilic
Copy link
Member

lilic commented Dec 7, 2018

@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!

@mareklibra
Copy link

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

jianzhangbjz added a commit to jianzhangbjz/operator-sdk that referenced this issue Dec 8, 2018
@jianzhangbjz
Copy link
Contributor Author

@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

@jianzhangbjz jianzhangbjz mentioned this issue Dec 8, 2018
jianzhangbjz added a commit to jianzhangbjz/operator-sdk that referenced this issue Dec 11, 2018
@mandaltu123
Copy link

mandaltu123 commented Jan 29, 2019

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

@jianzhangbjz
Copy link
Contributor Author

@mandaltu123 Have you tried the make dep-update?

@mandaltu123
Copy link

mandaltu123 commented Jan 29, 2019

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 ?

@mandaltu123
Copy link

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

@joelanford
Copy link
Member

joelanford commented Jan 29, 2019

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.

@mandaltu123
Copy link

mandaltu123 commented Jan 30, 2019

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/support Indicates an issue that is a support question.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants