Skip to content

Commit

Permalink
fix domain zone name (#10)
Browse files Browse the repository at this point in the history
Co-authored-by: anton.voskresensky <[email protected]>
  • Loading branch information
perhamm and anton.voskresensky authored Sep 5, 2023
1 parent 5e37f8c commit 4e9b5eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package main

import (
"fmt"
"os"
"strings"

"github.com/cert-manager/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1"
"github.com/cert-manager/cert-manager/pkg/acme/webhook/cmd"
cmmeta "github.com/cert-manager/cert-manager/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"os"
)

const providerName = "regru-dns"
Expand Down Expand Up @@ -104,7 +106,9 @@ func (c *regruDNSProviderSolver) Initialize(kubeClientConfig *rest.Config, _ <-c
// return cfg, nil
//}

// getDomainFromZone returns domain name from ResolvedZone without last dot.
// getDomainFromZone returns second-level domain name from ResolvedZone without last dot.
// reg.ru api requires to specify the second-level domain in the request
func getDomainFromZone(zone string) string {
return zone[0 : len(zone)-1]
parts := strings.Split(zone[0:len(zone)-1], ".")
return parts[len(parts)-2] + "." + parts[len(parts)-1]
}

0 comments on commit 4e9b5eb

Please sign in to comment.