external-dns/docs/contributing/getting-started.md
Martin Linkhorst 5ff801557b Elaborate the docs, add a faq section (#109)
* docs: elaborate the docs, add a faq section

* docs: fix a messed up command

* docs: update docs to reference v0.1 release

* docs(faq): fix stray whitespace

* docs: restructure docs for a leaner README

* docs: move first run section back to main readme

* docs: fix references to packages

* docs: fix reference to gke tutorial

* docs: fix missing source flag in examples

* docs: fix missing provider flag in examples

* docs: mention ingress support in main readme
2017-03-30 11:30:06 +02:00

26 lines
2.0 KiB
Markdown

# Project structure
### Building
You can build ExternalDNS for your platform with `make build`. The binary will land at `build/external-dns`.
### Design
ExternalDNS's sources of DNS records live in package [source](../../source). They implement the `Source` interface that has a single method `Endpoints` which returns the represented source's objects converted to `Endpoints`. Endpoints are just a tuple of DNS name and target where target can be an IP or another hostname.
For example, the `ServiceSource` returns all Services converted to `Endpoints` where the hostname is the value of the `external-dns.alpha.kubernetes.io/hostname` annotation and the target is the IP of the load balancer.
This list of endpoints is passed to the [Plan](../../plan) which determines the difference between the current DNS records and the desired list of `Endpoints`.
Once the difference has been figured out the list of intended changes is passed to a `Provider` which live in the [provider](../../provider) package. The provider is the adapter to the DNS provider, e.g. Google CloudDNS. It implements two methods: `ApplyChanges` to apply a set of changes and `Records` to retrieve the current list of records from the DNS provider.
The orchestration between the different components is controlled by the [controller](../../controller).
You can pick which `Source` and `Provider` to use at runtime via the `--source` and `--provider` flags, respectively.
### Adding a DNS provider
A typical way to start on, e.g. a CoreDNS provider, would be to add a `coredns.go` to the providers package and implement the interface methods. Then you would have to register your provider under a name in `main.go`, e.g. `coredns`, and would be able to trigger it's functions via setting `--provider=coredns`.
Note, how your provider doesn't need to know anything about where the DNS records come from, nor does it have to figure out the difference between the current and the desired state, it merely executes the actions calculated by the plan.