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 image from non-Linux local OS #982

Closed
jacobborella opened this issue Oct 4, 2019 · 7 comments · Fixed by #987
Closed

Build operator image from non-Linux local OS #982

jacobborella opened this issue Oct 4, 2019 · 7 comments · Fixed by #987
Assignees
Milestone

Comments

@jacobborella
Copy link

Hi.

I would like to contribute to this awesome project, so as a first thing, I set out to build the project as adviced in the contributing guide.

I'm using minikube (v1.3.1) on a mac and after setting up the environment, I run
make install-minikube

The build is going through fine, but the operator fails:

$ kubectl get pod
NAME READY STATUS RESTARTS AGE
camel-k-operator-5f8644979d-5wb6l 0/1 Error 6 5m58s

$ kubectl logs pod/camel-k-operator-5f8644979d-5wb6l
standard_init_linux.go:211: exec user process caused "exec format error"

I tried reverting to latest release 1.0.0-M1 and then everything works just fine. Can you please advice?

@astefanutti
Copy link
Member

The exec user process caused "exec format error" happens when you've built the operator binary on another platform than the Linux one, which is the target platform when running in Minikube.

I assume you're on another platform than Linux, so you can do:

$ GOOS=linux make images

@nicolaferraro
Copy link
Member

Yeah, maybe we can embed that in the scripts for only when doing make mages.

@jacobborella
Copy link
Author

jacobborella commented Oct 4, 2019

Thx for the quick reply. It makes sense - and yes, I'm on a mac.

If I execute

GOOS=linux make images

the build fails though. I'm reading through the cross compilation section of the go manual and I see that I also have to provide GOARCH=amd64. The build still fails though
env GOOS=linux GOARCH=amd64 make images
give

$ env GOOS=linux GOARCH=amd64 make images
go build -ldflags "-X github.com/apache/camel-k/pkg/cmd/operator.GitCommit=6f0da195533b1b848388493a0529d11db54855ad" -gcflags=-trimpath=/Users/jacobborella/go -asmflags=-trimpath=/Users/jacobborella/go -o kamel ./cmd/kamel/*.go
go test -c -tags="integration knative" ./e2e/*.go
go test ./...
?   	github.com/apache/camel-k/cmd/kamel	[no test files]
?   	github.com/apache/camel-k/cmd/util/json-schema-gen	[no test files]
?   	github.com/apache/camel-k/deploy	[no test files]
?   	github.com/apache/camel-k/pkg/apis	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b718/v1alpha1.test: exec format error
FAIL	github.com/apache/camel-k/pkg/apis/camel/v1alpha1	0.007s
?   	github.com/apache/camel-k/pkg/apis/camel/v1alpha1/knative	[no test files]
?   	github.com/apache/camel-k/pkg/apis/knative08compat	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b722/builder.test: exec format error
FAIL	github.com/apache/camel-k/pkg/builder	0.010s
?   	github.com/apache/camel-k/pkg/builder/kaniko	[no test files]
?   	github.com/apache/camel-k/pkg/builder/s2i	[no test files]
?   	github.com/apache/camel-k/pkg/client	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b725/cmd.test: exec format error
FAIL	github.com/apache/camel-k/pkg/cmd	0.015s
?   	github.com/apache/camel-k/pkg/cmd/builder	[no test files]
?   	github.com/apache/camel-k/pkg/cmd/operator	[no test files]
?   	github.com/apache/camel-k/pkg/controller	[no test files]
?   	github.com/apache/camel-k/pkg/controller/build	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b728/integration.test: exec format error
FAIL	github.com/apache/camel-k/pkg/controller/integration	0.009s
?   	github.com/apache/camel-k/pkg/controller/integrationkit	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b731/integrationplatform.test: exec format error
FAIL	github.com/apache/camel-k/pkg/controller/integrationplatform	0.026s
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b734/gzip.test: exec format error
FAIL	github.com/apache/camel-k/pkg/gzip	0.006s
?   	github.com/apache/camel-k/pkg/install	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b737/metadata.test: exec format error
FAIL	github.com/apache/camel-k/pkg/metadata	0.006s
?   	github.com/apache/camel-k/pkg/platform	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b740/trait.test: exec format error
FAIL	github.com/apache/camel-k/pkg/trait	0.005s
?   	github.com/apache/camel-k/pkg/util	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b743/camel.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/camel	0.011s
?   	github.com/apache/camel-k/pkg/util/cancellable	[no test files]
?   	github.com/apache/camel-k/pkg/util/defaults	[no test files]
?   	github.com/apache/camel-k/pkg/util/digest	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b746/envvar.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/envvar	0.007s
?   	github.com/apache/camel-k/pkg/util/finalizer	[no test files]
?   	github.com/apache/camel-k/pkg/util/indentedwriter	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b749/knative.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/knative	0.005s
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b752/kubernetes.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/kubernetes	0.005s
?   	github.com/apache/camel-k/pkg/util/kubernetes/customclient	[no test files]
?   	github.com/apache/camel-k/pkg/util/kubernetes/log	[no test files]
?   	github.com/apache/camel-k/pkg/util/log	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b755/maven.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/maven	0.012s
?   	github.com/apache/camel-k/pkg/util/minishift	[no test files]
?   	github.com/apache/camel-k/pkg/util/monitoring	[no test files]
?   	github.com/apache/camel-k/pkg/util/openshift	[no test files]
?   	github.com/apache/camel-k/pkg/util/source	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b758/sync.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/sync	0.008s
?   	github.com/apache/camel-k/pkg/util/tar	[no test files]
fork/exec /var/folders/p3/lt9l79r51cz7d43q98xp1kv00000gn/T/go-build838360257/b761/test.test: exec format error
FAIL	github.com/apache/camel-k/pkg/util/test	0.005s
?   	github.com/apache/camel-k/pkg/util/watch	[no test files]
FAIL
make: *** [test] Error 1

@astefanutti
Copy link
Member

Ah, it's too wide so the test binaries target the Linux OS too. We're going to fix it as suggested by @nicolaferraro. In the meatime, you can do:

GOOS=linux make build-kamel
cp kamel build/_output/bin/
operator-sdk build docker.io/apache/camel-k:1.0.0-M2-SNAPSHOT

To build the image locally for Linux.

@astefanutti astefanutti changed the title Operator fails on minikube Build operator image from non-Linux local OS Oct 4, 2019
@astefanutti astefanutti added this to the 1.0.0-M3 milestone Oct 4, 2019
@astefanutti
Copy link
Member

Ideally, the kamel binary produced for the Linux OS and added to the image should not override the local OS binary.

@jacobborella
Copy link
Author

jacobborella commented Oct 4, 2019

I did the following
make clean
make
cp kamel /usr/local/bin/kamel
make images
env GOOS=linux GOARCH=amd64 make build-kamel
cp kamel build/_output/bin/
operator-sdk build docker.io/apache/camel-k:1.0.0-M2-SNAPSHOT
kamel install

and then it worked. Thanks a lot for your help. I'll now get started getting more acquainted with the project. Let me know if there's anything specific you would like me to look at. Otherwise I'll probably look if I can fix any of the open issues.

@astefanutti
Copy link
Member

@jacobborella happy to have you on the project. You can start with the issues labelled as easy fix. Otherwise, I think #751 or #665 could be interesting candidates to get hands-on into the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants