Skip to content

Commit

Permalink
fix: domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ataris Mio committed Nov 10, 2022
1 parent 43b20db commit 2c5a488
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/namecom-webhook/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.0.0"
description: Deploys namecom webhook for cert-manager.
name: namecom-webhook
version: 1.0.1
version: 1.0.2
2 changes: 1 addition & 1 deletion charts/namecom-webhook/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ certManager:

image:
repository: ghcr.io/atarismio/cert-manager-name-webhook
tag: 1.0.0
tag: 1.0.1
pullPolicy: IfNotPresent
privateRegistry:
enabled: false
Expand Down
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (c *namecomDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error
return err
}

return dnsClient.Present(ch.ResolvedZone, ch.ResolvedFQDN, ch.Key)
return dnsClient.Present(domainName, ch.ResolvedFQDN, ch.Key)
}

func (c *namecomDNSProviderSolver) dnsClient(domain string, cfg namecomDNSProviderConfig, ch *v1alpha1.ChallengeRequest) (*name.NameDotComClient, error) {
Expand Down Expand Up @@ -143,7 +143,13 @@ func (c *namecomDNSProviderSolver) CleanUp(ch *v1alpha1.ChallengeRequest) error
return err
}

return client.CleanUp(ch.ResolvedZone, ch.ResolvedFQDN, ch.Key)
zoneName, err := util.FindZoneByFqdn(ch.ResolvedFQDN, util.RecursiveNameservers)
if err != nil {
return err
}
domainName := util.UnFqdn(zoneName)

return client.CleanUp(domainName, ch.ResolvedFQDN, ch.Key)
}

// Initialize will be called when the webhook first starts.
Expand Down
4 changes: 2 additions & 2 deletions name/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewClient(userName string, token string) (*NameDotComClient, error) {
func (c *NameDotComClient) Present(ResolvedZone string, ResolvedFQDN string, Key string) error {
_, zoneName, err := c.getHostedZone(ResolvedZone)
if err != nil {
return fmt.Errorf("alicloud: error getting hosted zones: %v", err)
return fmt.Errorf("namecom: error getting hosted zones: %v", err)
}

recordAttributes := c.newTxtRecord(zoneName, ResolvedFQDN, Key)
Expand All @@ -39,7 +39,7 @@ func (c *NameDotComClient) Present(ResolvedZone string, ResolvedFQDN string, Key
func (c *NameDotComClient) CleanUp(resolvedZone string, resolvedFQDN string, delKey string) error {
records, err := c.findTxtRecords(resolvedZone, resolvedFQDN)
if err != nil {
return fmt.Errorf("cnamecom: error finding txt records: %v", err)
return fmt.Errorf("namecom: error finding txt records: %v", err)
}

_, zone, err := c.getHostedZone(resolvedZone)
Expand Down

0 comments on commit 2c5a488

Please sign in to comment.