Skip to content

Commit

Permalink
Merge pull request #1 from kim-sondrup/v0.13.5-tidydns
Browse files Browse the repository at this point in the history
V0.13.5 tidydns
  • Loading branch information
kimsondrup authored Aug 29, 2023
2 parents 1f6340a + bc6e56c commit 82d9f1f
Show file tree
Hide file tree
Showing 7 changed files with 564 additions and 6 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/neticdk/tidydns-go v0.0.3
github.com/nxadm/tail v1.4.8 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uY
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/nesv/go-dynect v0.6.0 h1:Ow/DiSm4LAISwnFku/FITSQHnU6pBvhQMsUE5Gu6Oq4=
github.com/nesv/go-dynect v0.6.0/go.mod h1:GHRBRKzTwjAMhosHJQq/KrZaFkXIFyJ5zRE7thGXXrs=
github.com/neticdk/tidydns-go v0.0.3 h1:S/fBb3qzSF1vjhSDdXRo+fFE/7XPZKBUJr1bPVarB5c=
github.com/neticdk/tidydns-go v0.0.3/go.mod h1:EGd1iL3+g67y4zxEybaEV0ZK/LwcVubBhePAx+WLK1E=
github.com/nic-at/rc0go v1.1.1 h1:bf2gTwYecJEh7qmnOEuarXKueZn4A8N08U1Uop3K8+s=
github.com/nic-at/rc0go v1.1.1/go.mod h1:KEa3H5fmDNXCaXSqOeAZxkKnG/8ggr1OHIG25Ve7fjU=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import (
"sigs.k8s.io/external-dns/provider/safedns"
"sigs.k8s.io/external-dns/provider/scaleway"
"sigs.k8s.io/external-dns/provider/tencentcloud"
"sigs.k8s.io/external-dns/provider/tidydns"
"sigs.k8s.io/external-dns/provider/transip"
"sigs.k8s.io/external-dns/provider/ultradns"
"sigs.k8s.io/external-dns/provider/vinyldns"
Expand Down Expand Up @@ -182,6 +183,8 @@ func main() {

var p provider.Provider
switch cfg.Provider {
case "tidydns":
p, err = tidydns.NewTidyDNSProvider(domainFilter, zoneIDFilter, cfg.TidyDNSEndpoint, cfg.DryRun)
case "akamai":
p, err = akamai.NewAkamaiProvider(
akamai.AkamaiConfig{
Expand Down
6 changes: 4 additions & 2 deletions pkg/apis/externaldns/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ type Config struct {
PiholeTLSInsecureSkipVerify bool
PluralCluster string
PluralProvider string
TidyDNSEndpoint string
}

var defaultConfig = &Config{
Expand Down Expand Up @@ -350,7 +351,7 @@ var defaultConfig = &Config{
PiholeTLSInsecureSkipVerify: false,
PluralCluster: "",
PluralProvider: "",
}
TidyDNSEndpoint: ""}

// NewConfig returns new Config object
func NewConfig() *Config {
Expand Down Expand Up @@ -392,6 +393,7 @@ func (cfg *Config) ParseFlags(args []string) error {
app := kingpin.New("external-dns", "ExternalDNS synchronizes exposed Kubernetes Services and Ingresses with DNS providers.\n\nNote that all flags may be replaced with env vars - `--flag` -> `EXTERNAL_DNS_FLAG=1` or `--flag value` -> `EXTERNAL_DNS_FLAG=value`")
app.Version(Version)
app.DefaultEnvars()
app.Flag("tidydns-endpoint", "Provide the endpoint for the TidyDNS service").Default(defaultConfig.TidyDNSEndpoint).StringVar(&cfg.TidyDNSEndpoint)

// Flags related to Kubernetes
app.Flag("server", "The Kubernetes API server to connect to (default: auto-detect)").Default(defaultConfig.APIServerURL).StringVar(&cfg.APIServerURL)
Expand Down Expand Up @@ -441,7 +443,7 @@ func (cfg *Config) ParseFlags(args []string) error {
app.Flag("exclude-target-net", "Exclude target nets (optional)").StringsVar(&cfg.ExcludeTargetNets)

// Flags related to providers
providers := []string{"akamai", "alibabacloud", "aws", "aws-sd", "azure", "azure-dns", "azure-private-dns", "bluecat", "civo", "cloudflare", "coredns", "designate", "digitalocean", "dnsimple", "dyn", "exoscale", "gandi", "godaddy", "google", "ibmcloud", "infoblox", "inmemory", "linode", "ns1", "oci", "ovh", "pdns", "pihole", "plural", "rcodezero", "rdns", "rfc2136", "safedns", "scaleway", "skydns", "tencentcloud", "transip", "ultradns", "vinyldns", "vultr"}
providers := []string{"akamai", "alibabacloud", "aws", "aws-sd", "azure", "azure-dns", "azure-private-dns", "bluecat", "civo", "cloudflare", "coredns", "designate", "digitalocean", "dnsimple", "dyn", "exoscale", "gandi", "godaddy", "google", "ibmcloud", "infoblox", "inmemory", "linode", "ns1", "oci", "ovh", "pdns", "pihole", "plural", "rcodezero", "rdns", "rfc2136", "safedns", "scaleway", "skydns", "tencentcloud", "transip", "ultradns", "vinyldns", "vultr", "tidydns"}
app.Flag("provider", "The DNS provider where the DNS records will be created (required, options: "+strings.Join(providers, ", ")+")").Required().PlaceHolder("provider").EnumVar(&cfg.Provider, providers...)
app.Flag("domain-filter", "Limit possible target zones by a domain suffix; specify multiple times for multiple domains (optional)").Default("").StringsVar(&cfg.DomainFilter)
app.Flag("exclude-domains", "Exclude subdomains (optional)").Default("").StringsVar(&cfg.ExcludeDomains)
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/externaldns/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

var (
minimalConfig = &Config{
APIServerURL: "",
APIServerURL: "", TidyDNSEndpoint: "",
KubeConfig: "",
RequestTimeout: time.Second * 30,
ContourLoadBalancerService: "heptio-contour/contour",
Expand Down Expand Up @@ -132,7 +132,7 @@ var (
}

overriddenConfig = &Config{
APIServerURL: "http://127.0.0.1:8080",
APIServerURL: "http://127.0.0.1:8080", TidyDNSEndpoint: "https://tidy.example.com/index.cgi",
KubeConfig: "/some/path",
RequestTimeout: time.Second * 77,
ContourLoadBalancerService: "heptio-contour-other/contour-other",
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestParseFlags(t *testing.T) {
{
title: "override everything via flags",
args: []string{
"--server=http://127.0.0.1:8080",
"--server=http://127.0.0.1:8080", "--tidydns-endpoint=https://tidy.example.com/index.cgi",
"--kubeconfig=/some/path",
"--request-timeout=77s",
"--contour-load-balancer=heptio-contour-other/contour-other",
Expand Down Expand Up @@ -388,7 +388,7 @@ func TestParseFlags(t *testing.T) {
title: "override everything via environment variables",
args: []string{},
envVars: map[string]string{
"EXTERNAL_DNS_SERVER": "http://127.0.0.1:8080",
"EXTERNAL_DNS_SERVER": "http://127.0.0.1:8080", "EXTERNAL_DNS_TIDYDNS_ENDPOINT": "https://tidy.example.com/index.cgi",
"EXTERNAL_DNS_KUBECONFIG": "/some/path",
"EXTERNAL_DNS_REQUEST_TIMEOUT": "77s",
"EXTERNAL_DNS_CONTOUR_LOAD_BALANCER": "heptio-contour-other/contour-other",
Expand Down
Loading

0 comments on commit 82d9f1f

Please sign in to comment.