Skip to content

Commit

Permalink
Update deployment api group to v1 (#7)
Browse files Browse the repository at this point in the history
And better error handling
  • Loading branch information
m-yosefpor authored Jul 24, 2021
1 parent 6495a5c commit 90054dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/alidns-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "alidns-webhook.fullname" . }}
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type aliDNSProviderConfig struct {

AccessToken cmmetav1.SecretKeySelector `json:"accessTokenSecretRef"`
SecretToken cmmetav1.SecretKeySelector `json:"secretKeySecretRef"`
Regionid string `json:"regionId"`
Regionid string `json:"regionId"`
}

// Name is used as the name for this DNS solver when referencing it on the ACME
Expand Down Expand Up @@ -108,6 +108,9 @@ func (c *aliDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error {
fmt.Printf("Decoded configuration: %v\n", cfg)

accessToken, err := c.loadSecretData(cfg.AccessToken, ch.ResourceNamespace)
if err != nil {
return err
}
secretKey, err := c.loadSecretData(cfg.SecretToken, ch.ResourceNamespace)
if err != nil {
return err
Expand All @@ -117,6 +120,9 @@ func (c *aliDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error {
credential := credentials.NewAccessKeyCredential(string(accessToken), string(secretKey))

client, err := alidns.NewClientWithOptions(cfg.Regionid, conf, credential)
if err != nil {
return err
}
c.aliDNSClient = client

_, zoneName, err := c.getHostedZone(ch.ResolvedZone)
Expand Down

0 comments on commit 90054dc

Please sign in to comment.