Merge pull request #1266 from munnerz/fix-dns01-zone-lookup

Respect recursive nameservers flag when finding zone for fqdn
This commit is contained in:
jetstack-bot 2019-01-28 11:18:50 +00:00 committed by GitHub
commit f27036cc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -45,7 +45,7 @@ type DNSProvider struct {
auth *EdgeGridAuth
transport http.RoundTripper
findHostedDomainByFqdn func(string) (string, error)
findHostedDomainByFqdn func(string, []string) (string, error)
}
// NewDNSProvider returns a DNSProvider instance configured for Akamai.
@ -59,8 +59,8 @@ func NewDNSProvider(serviceConsumerDomain, clientToken, clientSecret, accessToke
}, nil
}
func findHostedDomainByFqdn(fqdn string) (string, error) {
zone, err := util.FindZoneByFqdn(fqdn, util.RecursiveNameservers)
func findHostedDomainByFqdn(fqdn string, ns []string) (string, error) {
zone, err := util.FindZoneByFqdn(fqdn, ns)
if err != nil {
return "", err
}
@ -84,7 +84,7 @@ type dns01Record struct {
}
func (a *DNSProvider) setTxtRecord(fqdn string, dns01Record *dns01Record) error {
hostedDomain, err := a.findHostedDomainByFqdn(fqdn)
hostedDomain, err := a.findHostedDomainByFqdn(fqdn, a.dns01Nameservers)
if err != nil {
return errors.Wrapf(err, "failed to determine hosted domain for %q", fqdn)
}

View File

@ -171,7 +171,7 @@ func mockTransport(t *testing.T, akamai *DNSProvider, domain, data string, respo
t.Fatalf("unexpected method: %v", req.Method)
return nil, nil
})
akamai.findHostedDomainByFqdn = func(fqdn string) (string, error) {
akamai.findHostedDomainByFqdn = func(fqdn string, _ []string) (string, error) {
if !strings.HasSuffix(fqdn, domain+".") {
t.Fatalf("unexpected fqdn: %s", fqdn)
}

View File

@ -136,7 +136,7 @@ func (c *DNSProvider) getHostedZoneName(fqdn string) (string, error) {
if c.zoneName != "" {
return c.zoneName, nil
}
z, err := util.FindZoneByFqdn(fqdn, util.RecursiveNameservers)
z, err := util.FindZoneByFqdn(fqdn, c.dns01Nameservers)
if err != nil {
return "", err
}

View File

@ -200,7 +200,7 @@ func (c *DNSProvider) CleanUp(domain, fqdn, value string) error {
// getHostedZone returns the managed-zone
func (c *DNSProvider) getHostedZone(domain string) (string, error) {
authZone, err := util.FindZoneByFqdn(util.ToFqdn(domain), util.RecursiveNameservers)
authZone, err := util.FindZoneByFqdn(util.ToFqdn(domain), c.dns01Nameservers)
if err != nil {
return "", err
}

View File

@ -128,7 +128,7 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
Name string `json:"name"`
}
authZone, err := util.FindZoneByFqdn(fqdn, util.RecursiveNameservers)
authZone, err := util.FindZoneByFqdn(fqdn, c.dns01Nameservers)
if err != nil {
return "", err
}

View File

@ -182,7 +182,7 @@ func (r *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
return r.hostedZoneID, nil
}
authZone, err := util.FindZoneByFqdn(fqdn, util.RecursiveNameservers)
authZone, err := util.FindZoneByFqdn(fqdn, r.dns01Nameservers)
if err != nil {
return "", fmt.Errorf("error finding zone from fqdn: %v", err)
}