Building a Go Container

external-dns is currently not supporting PowerDNS4.0 so I wanted to fix this on my own…but I still try to figure out how to compile https://github.com/rancher/external-dns this.

Anyone can help me here?

Hello! I have successfully modified that package to support Digital Ocean. If you have any specific questions, please ask, and if I can help I will!

Oh if you could tell me how to compile https://github.com/rancher/external-dns this would be great. I strugle somehow with the setup.

I do not have a huge amount of experience in Go, and most of what I’ve done has been scratching my own itch.

This tool was written for Go 1.5.2 and used Godeps. I ripped out all the Godeps stuff and bumped up the version to 1.6 and that was fine. What was really frustrating was the absolute imports — every time it referenced itself via “github.com/rancher/external-dns/something” I had to change that to my fork. I’m not completely sure that that import style is necessary, but my primary goal was to add functionality, not refactor. :slight_smile:

I did do a little refactoring because I couldn’t quite figure out how to make something work after I broke it. I made the provider settable via an environment variable which helped me move forward. It might have been related to the change in Go version.

If your goal is for personal use, feel free to fork mine at github.com/mathuin/external-dns and change all the references from mathuin to your Github name and you should be good to go!

I think there’s still a bug in my implementation with respect to deleting records, I can’t recall. I should look at that sometime!

Hmm my problem was that i didn’t figure out how to clone the project so that I can compile the project.

Ah, that’s a different issue.

The project is on Github as you know. You need to run git clone https://github.com/rancher/external-dns on your own computer (that command line is generic, it might be different if you’re not on Linux). That will check out the source code to your system in a directory named external-dns in the directory where you executed that command. You will have to rearrange things and rename things as I mention above because of how Go works.

Good luck!

Damn…though I could forget this…but now it seam I have to fix this errors on my own.

So I install godeps from google and then how can i compile external-dns then?

regards
Guido

I created a script called buildme.sh which I have in the top directory (~/go/src/github.com/rancher/external-dns here):

#!/bin/bash
./scripts/build
cd bin/
tar cf ../packaging/external-dns.tar external-dns
gzip -f9 ../packaging/external-dns.tar
docker build -t myregistry/mathuin/external-dns ../packaging
docker push myregistry/mathuin/external-dns

I had to change the packaging Dockerfile as well:

FROM alpine:3.2
MAINTAINER Rancher Labs, Inc.
RUN apk add --update ca-certificates

ENV EXT_DNS_RELEASE v0.6.1
#ADD https://github.com/rancher/external-dns/releases/download/${EXT_DNS_RELEASE}/external-dns.tar.gz /external-dns.tar.gz
COPY external-dns.tar.gz /external-dns.tar.gz
RUN tar -zxvf /external-dns.tar.gz -C /usr/bin

ENTRYPOINT ["/usr/bin/external-dns"]

The resulting artifact is a container which I run in my environment as part of an infrastructure stack.

Let me know if you have any questions!

Jack.