diff --git a/docs/tutorials/rfc2136.md b/docs/tutorials/rfc2136.md index 6a9d9f219..7442881f4 100644 --- a/docs/tutorials/rfc2136.md +++ b/docs/tutorials/rfc2136.md @@ -134,7 +134,7 @@ tutorial and are covered in the main documentation. ### Generate reverse DNS records -If you want to generate reverse DNS records for your services, you have to enable the functionality using the `--rfc2136-manageptr` +If you want to generate reverse DNS records for your services, you have to enable the functionality using the `--rfc2136-create-ptr` flag. You have also to add the zone to the list of zones managed by ExternalDNS via the `--rfc2136-zone` and `--domain-filter` flags. An example of a valid configuration is the following: diff --git a/main.go b/main.go index b12207a70..d914dbf43 100644 --- a/main.go +++ b/main.go @@ -371,7 +371,7 @@ func main() { p, err = oci.NewOCIProvider(*config, domainFilter, zoneIDFilter, cfg.OCIZoneScope, cfg.DryRun) } case "rfc2136": - p, err = rfc2136.NewRfc2136Provider(cfg.RFC2136Host, cfg.RFC2136Port, cfg.RFC2136Zone, cfg.RFC2136Insecure, cfg.RFC2136TSIGKeyName, cfg.RFC2136TSIGSecret, cfg.RFC2136TSIGSecretAlg, cfg.RFC2136TAXFR, domainFilter, cfg.DryRun, cfg.RFC2136MinTTL, cfg.RFC2136ManagePTR, cfg.RFC2136GSSTSIG, cfg.RFC2136KerberosUsername, cfg.RFC2136KerberosPassword, cfg.RFC2136KerberosRealm, cfg.RFC2136BatchChangeSize, nil) + p, err = rfc2136.NewRfc2136Provider(cfg.RFC2136Host, cfg.RFC2136Port, cfg.RFC2136Zone, cfg.RFC2136Insecure, cfg.RFC2136TSIGKeyName, cfg.RFC2136TSIGSecret, cfg.RFC2136TSIGSecretAlg, cfg.RFC2136TAXFR, domainFilter, cfg.DryRun, cfg.RFC2136MinTTL, cfg.RFC2136CreatePTR, cfg.RFC2136GSSTSIG, cfg.RFC2136KerberosUsername, cfg.RFC2136KerberosPassword, cfg.RFC2136KerberosRealm, cfg.RFC2136BatchChangeSize, nil) case "ns1": p, err = ns1.NewNS1Provider( ns1.NS1Config{ diff --git a/pkg/apis/externaldns/types.go b/pkg/apis/externaldns/types.go index 5656e0ef9..759f97def 100644 --- a/pkg/apis/externaldns/types.go +++ b/pkg/apis/externaldns/types.go @@ -183,7 +183,7 @@ type Config struct { RFC2136Zone []string RFC2136Insecure bool RFC2136GSSTSIG bool - RFC2136ManagePTR bool + RFC2136CreatePTR bool RFC2136KerberosRealm string RFC2136KerberosUsername string RFC2136KerberosPassword string `secure:"yes"` @@ -580,7 +580,7 @@ func (cfg *Config) ParseFlags(args []string) error { app.Flag("rfc2136-host", "When using the RFC2136 provider, specify the host of the DNS server").Default(defaultConfig.RFC2136Host).StringVar(&cfg.RFC2136Host) app.Flag("rfc2136-port", "When using the RFC2136 provider, specify the port of the DNS server").Default(strconv.Itoa(defaultConfig.RFC2136Port)).IntVar(&cfg.RFC2136Port) app.Flag("rfc2136-zone", "When using the RFC2136 provider, specify zone entries of the DNS server to use").StringsVar(&cfg.RFC2136Zone) - app.Flag("rfc2136-manageptr", "When using the RFC2136 provider, enable PTR management").Default(strconv.FormatBool(defaultConfig.RFC2136ManagePTR)).BoolVar(&cfg.RFC2136ManagePTR) + app.Flag("rfc2136-create-ptr", "When using the RFC2136 provider, enable PTR management").Default(strconv.FormatBool(defaultConfig.RFC2136CreatePTR)).BoolVar(&cfg.RFC2136CreatePTR) app.Flag("rfc2136-insecure", "When using the RFC2136 provider, specify whether to attach TSIG or not (default: false, requires --rfc2136-tsig-keyname and rfc2136-tsig-secret)").Default(strconv.FormatBool(defaultConfig.RFC2136Insecure)).BoolVar(&cfg.RFC2136Insecure) app.Flag("rfc2136-tsig-keyname", "When using the RFC2136 provider, specify the TSIG key to attached to DNS messages (required when --rfc2136-insecure=false)").Default(defaultConfig.RFC2136TSIGKeyName).StringVar(&cfg.RFC2136TSIGKeyName) app.Flag("rfc2136-tsig-secret", "When using the RFC2136 provider, specify the TSIG (base64) value to attached to DNS messages (required when --rfc2136-insecure=false)").Default(defaultConfig.RFC2136TSIGSecret).StringVar(&cfg.RFC2136TSIGSecret) diff --git a/pkg/apis/externaldns/validation/validation_test.go b/pkg/apis/externaldns/validation/validation_test.go index 1209afd2c..b91746863 100644 --- a/pkg/apis/externaldns/validation/validation_test.go +++ b/pkg/apis/externaldns/validation/validation_test.go @@ -132,7 +132,7 @@ func TestValidateBadRfc2136Config(t *testing.T) { cfg.Sources = []string{"test-source"} cfg.Provider = "rfc2136" cfg.RFC2136MinTTL = -1 - cfg.ManagePTR = false + cfg.CreatePTR = false cfg.RFC2136BatchChangeSize = 50 err := ValidateConfig(cfg) diff --git a/provider/rfc2136/rfc2136.go b/provider/rfc2136/rfc2136.go index 3e89d33bd..9692c9152 100644 --- a/provider/rfc2136/rfc2136.go +++ b/provider/rfc2136/rfc2136.go @@ -54,7 +54,7 @@ type rfc2136Provider struct { axfr bool minTTL time.Duration batchChangeSize int - managePTR bool + createPTR bool // options specific to rfc3645 gss-tsig support gssTsig bool @@ -83,7 +83,7 @@ type rfc2136Actions interface { } // NewRfc2136Provider is a factory function for OpenStack rfc2136 providers -func NewRfc2136Provider(host string, port int, zoneNames []string, insecure bool, keyName string, secret string, secretAlg string, axfr bool, domainFilter endpoint.DomainFilter, dryRun bool, minTTL time.Duration, managePTR bool, gssTsig bool, krb5Username string, krb5Password string, krb5Realm string, batchChangeSize int, actions rfc2136Actions) (provider.Provider, error) { +func NewRfc2136Provider(host string, port int, zoneNames []string, insecure bool, keyName string, secret string, secretAlg string, axfr bool, domainFilter endpoint.DomainFilter, dryRun bool, minTTL time.Duration, createPTR bool, gssTsig bool, krb5Username string, krb5Password string, krb5Realm string, batchChangeSize int, actions rfc2136Actions) (provider.Provider, error) { secretAlgChecked, ok := tsigAlgs[secretAlg] if !ok && !insecure && !gssTsig { return nil, errors.Errorf("%s is not supported TSIG algorithm", secretAlg) @@ -104,7 +104,7 @@ func NewRfc2136Provider(host string, port int, zoneNames []string, insecure bool zoneNames: zoneNames, insecure: insecure, gssTsig: gssTsig, - managePTR: managePTR, + createPTR: createPTR, krb5Username: krb5Username, krb5Password: krb5Password, krb5Realm: strings.ToUpper(krb5Realm), @@ -308,7 +308,7 @@ func (r rfc2136Provider) ApplyChanges(ctx context.Context, changes *plan.Changes m[zone].SetUpdate(zone) r.AddRecord(m[zone], ep) - if r.managePTR && (ep.RecordType == "A" || ep.RecordType == "AAAA") { + if r.createPTR && (ep.RecordType == "A" || ep.RecordType == "AAAA") { r.AddReverseRecord(ep.Targets[0], ep.DNSName) } } @@ -380,7 +380,7 @@ func (r rfc2136Provider) ApplyChanges(ctx context.Context, changes *plan.Changes m[zone].SetUpdate(zone) r.RemoveRecord(m[zone], ep) - if r.managePTR && (ep.RecordType == "A" || ep.RecordType == "AAAA") { + if r.createPTR && (ep.RecordType == "A" || ep.RecordType == "AAAA") { r.RemoveReverseRecord(ep.Targets[0], ep.DNSName) } }