From 7ed2f9884154a45d1c4649211380afb54302af2f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 24 Apr 2024 16:30:12 -0500 Subject: [PATCH] fix: need to use FQDN when creating DNS entry Signed-off-by: Doug Goldstein --- cmd/webhook/main.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go index 5cbd22c..141f98d 100644 --- a/cmd/webhook/main.go +++ b/cmd/webhook/main.go @@ -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" @@ -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, @@ -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] -}