I'm really struggling with building external-dns on Ubuntu on Windows.
It seems dep is very strict in how it likes GOPATH etc to be set up and make again expects to find stuff in other places.
I have now found a very convoluted way of building external-dns:
To make dep not fail:
export GOPATH=/go/
cd $GOPATH/src/
Continouing with commands from docs:
git clone https://github.com/kubernetes-incubator/external-dns.git && cd external-dns
dep ensure -vendor-only
And then another workaround for make to work:
mkdir -p vendor/github.com/kubernetes-incubator/
cd vendor/github.com/kubernetes-incubator/
git clone https://github.com/kubernetes-incubator/external-dns.git
cd $GOPATH/src/external-dns
And at last make of course.
Without the last hack make fails with:
CGO_ENABLED=0 go build -o build/external-dns -v -ldflags "-X github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns.Version=v0.5.2-15-gf458b37 -w -s" .
main.go:30:2: cannot find package "github.com/kubernetes-incubator/external-dns/controller" in any of:
/go/src/external-dns/vendor/github.com/kubernetes-incubator/external-dns/controller (vendor tree)
/usr/lib/go-1.10/src/github.com/kubernetes-incubator/external-dns/controller (from $GOROOT)
/go/src/github.com/kubernetes-incubator/external-dns/controller (from $GOPATH)
...
and about 10-15 more
Also downloading 480MB of dependencies gave me some issues where I had to retry a few times, but that might just be the instability of github.com these days.
Anyway, it would be nice to have external-dns binaries for easy download. Maybe that can spare someone else from spending a few hours just getting the program started :-)
@StianOvrevage you can find the External DNS binary in the Docker image (amd64 arch), see https://github.com/kubernetes-incubator/external-dns/releases
You would usually run External DNS as a container anyway:
$ docker run -it registry.opensource.zalan.do/teapot/external-dns:v0.5.2 --help
If you really want the "pure" binary, you can extract it from the Docker image:
$ docker run -it --entrypoint /bin/sh -d --name external-dns registry.opensource.zalan.do/teapot/external-dns:v0.5.2
$ docker cp external-dns:/bin/external-dns ./
$ file external-dns
external-dns: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
Later edit: It turned out the vendor folder was messed up, I got it work by cleaning up the git repo to the pristine state.
I also needed to install the golang race detector runtime, which doesn't ship out of the box on Ubuntu
sudo apt-get install golang-1.10-race-detector-runtime
@StianOvrevage is this also failing in Docker for you?
I'm getting this error:
$ docker build .
Sending build context to Docker daemon 478.4MB
Step 1/10 : FROM golang as builder
---> 52057de6c8d0
Step 2/10 : WORKDIR /go/src/github.com/kubernetes-incubator/external-dns
---> Using cache
---> c9763fb5197b
Step 3/10 : COPY . .
---> Using cache
---> d8b4e837b4c7
Step 4/10 : RUN make dep
---> Using cache
---> 01a447728821
Step 5/10 : RUN make test
---> Running in 76610f5e3630
go test -v -race github.com/kubernetes-incubator/external-dns github.com/kubernetes-incubator/external-dns/controller github.com/kubernetes-incubator/external-dns/endpoint github.com/kubernetes-incubator/external-dns/internal/testutils github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns/validation github.com/kubernetes-incubator/external-dns/pkg/tlsutils github.com/kubernetes-incubator/external-dns/plan github.com/kubernetes-incubator/external-dns/provider github.com/kubernetes-incubator/external-dns/registry github.com/kubernetes-incubator/external-dns/source
# github.com/kubernetes-incubator/external-dns/controller
controller/controller_test.go:24:2: use of internal package not allowed
FAIL github.com/kubernetes-incubator/external-dns/controller [setup failed]
# github.com/kubernetes-incubator/external-dns/plan
plan/plan_test.go:23:2: use of internal package not allowed
FAIL github.com/kubernetes-incubator/external-dns/plan [setup failed]
# github.com/kubernetes-incubator/external-dns/provider
provider/aws_sd_test.go:29:2: use of internal package not allowed
FAIL github.com/kubernetes-incubator/external-dns/provider [setup failed]
# github.com/kubernetes-incubator/external-dns/registry
registry/aws_sd_registry_test.go:23:2: use of internal package not allowed
FAIL github.com/kubernetes-incubator/external-dns/registry [setup failed]
# github.com/kubernetes-incubator/external-dns/source
source/dedup_source_test.go:23:2: use of internal package not allowed
FAIL github.com/kubernetes-incubator/external-dns/source [setup failed]
? github.com/kubernetes-incubator/external-dns [no test files]
=== RUN TestNewEndpoint
--- PASS: TestNewEndpoint (0.00s)
=== RUN TestTargetsSame
--- PASS: TestTargetsSame (0.00s)
=== RUN TestSameFailures
--- PASS: TestSameFailures (0.00s)
=== RUN TestLabels
=== RUN TestDeserialize
--- PASS: TestDeserialize (0.00s)
=== RUN TestSerialize
--- PASS: TestSerialize (0.00s)
--- PASS: TestLabels (0.01s)
PASS
ok github.com/kubernetes-incubator/external-dns/endpoint 1.022s
=== RUN ExampleSameEndpoints
--- PASS: ExampleSameEndpoints (0.00s)
PASS
ok github.com/kubernetes-incubator/external-dns/internal/testutils 1.012s
=== RUN TestParseFlags
=== RUN TestParseFlags/default_config_with_minimal_flags_defined
=== RUN TestParseFlags/override_everything_via_flags
=== RUN TestParseFlags/override_everything_via_environment_variables
--- PASS: TestParseFlags (0.02s)
--- PASS: TestParseFlags/default_config_with_minimal_flags_defined (0.01s)
--- PASS: TestParseFlags/override_everything_via_flags (0.01s)
--- PASS: TestParseFlags/override_everything_via_environment_variables (0.01s)
=== RUN TestPasswordsNotLogged
--- PASS: TestPasswordsNotLogged (0.00s)
PASS
ok github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns 1.083s
=== RUN TestValidateFlags
--- PASS: TestValidateFlags (0.00s)
=== RUN TestValidateBadDynConfig
--- PASS: TestValidateBadDynConfig (0.00s)
=== RUN TestValidateGoodDynConfig
--- PASS: TestValidateGoodDynConfig (0.00s)
PASS
ok github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns/validation 1.019s
? github.com/kubernetes-incubator/external-dns/pkg/tlsutils [no test files]
make: *** [test] Error 1
Makefile:38: recipe for target 'test' failed
The command '/bin/sh -c make test' returned a non-zero code: 2
FAIL: 2
Yeah, the Docker worked. Reason I don't want to use the Docker version is that I need to use azure-config-file.json and volume mounts on Docker for Windows is currently a bit finicky.
Also, thanks for pointers to the binaries! I only checked the README and could not find any links so I assumed there were no binaries. Adding info about the binaries in the README would be nice :-)
@StianOvrevage the main point about docker is to ship such binaries inside containers images, I think documenting this explicitly is a bit redundant.
We can point to this issue so people can see how to quickly extract if needed
I'm not gonna argue a lot. But Docker is mainly a benefit for complex systems with lots of dependencies and platform variations. Golang apps compile to a single binary and includes all dependencies so that makes them pretty easy to distribute without Docker :-)
@StianOvrevage I see your point, but the target platform of External DNS is the container orchestration platform Kubernetes --- i.e. distributing External DNS as a container image (Docker being the de-facto standard) makes sense. I don't see why we should add (and maintain) additional binary releases for a very limited user base. Having said this, I'm OK with adding instructions on how to extract the binary to the docs.
Totally get that when actually deploying.
But, it's 10x easier to test locally that configuration, and in my case the Azure credentials stuff, is actually working before deploying to K8s.
Debugging integration issues like that are much harder when already deployed in the cluster.
I'd act as the GitHub bot and close this as there was no progress since June.
In case anyone was wondering why the build was not working, the solution to building is to clone to $GOPATH/src/github.com/kubernetes-incubator/external-dns.
Most helpful comment
In case anyone was wondering why the build was not working, the solution to building is to clone to
$GOPATH/src/github.com/kubernetes-incubator/external-dns.