Skip to content

Commit

Permalink
fix: need to use FQDN when creating DNS entry
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Goldstein <[email protected]>
  • Loading branch information
cardoe committed Apr 24, 2024
1 parent ce7415e commit 7ed2f98
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"os"
"regexp"

extapi "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -124,10 +123,8 @@ func (c *rackspaceDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) erro
return fmt.Errorf("unable to find domain ID for domain `%s`: %v", cfg.DomainName, err)
}

name := recordName(ch.ResolvedFQDN, cfg.DomainName)

opts := records.CreateOpts{
Name: name,
Name: ch.ResolvedFQDN,
Type: "TXT",
Data: ch.Key,
TTL: 0,
Expand Down Expand Up @@ -287,13 +284,3 @@ func loadDomainId(service *gophercloud.ServiceClient, domainName string) (string

return domId, nil
}

func recordName(fqdn, domain string) string {
r := regexp.MustCompile("(.+)\\." + domain + "\\.")
name := r.FindStringSubmatch(fqdn)
if len(name) != 2 {
klog.Errorf("splitting domain name %s failed!", fqdn)
return ""
}
return name[1]
}

0 comments on commit 7ed2f98

Please sign in to comment.