external-dns/docs/project-structure.md
Justin Santa Barbara cb364cdbf7 Move config to apimachinery (#37)
Types that we want to work using apimachinery typically go into
pkg/apis/X, and the validation goes into pkg/apis/X/validation.  We then
add versions into e.g. pkg/apis/X/v1alpha1, but this feels premature at
the moment.

Changing this later is annoyingly difficult, especially in terms of
validation and dependencies.

We will want the apimachinery, so that we can configure from a
configuration file that is versioned.  Hopefully dns-controller won't
end up so complicated that we will require it, but I think there is also
value in following the "standard" patterns for controllers that are
emerging from e.g. ingress.

For a fairly simple example of an API, please consult
https://github.com/kubernetes/kubernetes/tree/master/pkg/apis/certificates
2017-03-01 11:49:02 +01:00

1.4 KiB

Development specifications

Proposal regarding the project structure and related tools

How to run

external-dns --in-cluster=false --dnsprovider=aws --source=ingress --source=service

Project structure

./main.go
./controller - main controlling loop
    controller.go 
./plan/
    plan.go - implements the logic for managing records
./kubernetes/
    manager.go - provides watching capabilities + clientset
./dnsprovider/ - dns providers
    aws.go
    google.go
    fake.go 
    dnsprovider.go - interface
./pkg/apis/externaldns - types that we will want to be subject to apimachinery (e.g. configuration)
./pkg/apis/externaldns/validation - validation for our types
./source/ - list of sources
    fake.go
    ingress.go
    service.go
    source.go - interface

Vendoring tool

  • glide - widely used in kubernetes projects for vendoring

Dependencies

Logging

  • logrus - simple logging library with supported formatter and log levels

Flags

  • spf13/pflag - simple flag library which should suit our needs. We are unlikely to have subcommands and binary will be invoked in a manner to similar shown above

Clients

  • k8s.io/client-go
  • aws-sdk-go
  • google.golang.org/api/dns/v1

Build

  • Makefile - build should be relatively simple process and Makefile should suit our needs

CI/CD