diff --git a/sthome/dns.go b/_backup/dns.go similarity index 100% rename from sthome/dns.go rename to _backup/dns.go diff --git a/sthome/solver_sthome.go b/_backup/solver_sthome.go similarity index 100% rename from sthome/solver_sthome.go rename to _backup/solver_sthome.go diff --git a/sthome/sthome_test.go b/_backup/sthome_test.go similarity index 100% rename from sthome/sthome_test.go rename to _backup/sthome_test.go diff --git a/deploy/sthome-webhook/Chart.yaml b/deploy/sthome-webhook/Chart.yaml index 2ac97d2..d3b840d 100644 --- a/deploy/sthome-webhook/Chart.yaml +++ b/deploy/sthome-webhook/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: v0.0.4-alpha.100 +appVersion: v0.0.4-alpha.107 description: Cert-Manager webhook for sthome name: sthome-webhook -version: 0.0.4-alpha.100 +version: 0.0.4-alpha.107 diff --git a/deploy/sthome-webhook/values.yaml b/deploy/sthome-webhook/values.yaml index 0e94703..a6e4b70 100644 --- a/deploy/sthome-webhook/values.yaml +++ b/deploy/sthome-webhook/values.yaml @@ -31,7 +31,7 @@ clusterIssuer: image: repository: stuurmcp/cert-manager-webhook-sthome #repository: wstat.sthome.net:5000/cert-manager-webhook-sthome - tag: 0.0.4-alpha.100 + tag: 0.0.4-alpha.107 #pullPolicy should be IfNotPresent. Set to Always for testing purposes pullPolicy: IfNotPresent diff --git a/go.mod b/go.mod index 54a46ff..3059772 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,7 @@ toolchain go1.22.1 require ( github.com/cert-manager/cert-manager v1.14.4 - github.com/miekg/dns v1.1.58 - github.com/stretchr/testify v1.8.4 + github.com/miekg/dns v1.1.58 // indirect k8s.io/api v0.29.0 k8s.io/apiextensions-apiserver v0.29.0 k8s.io/client-go v0.29.0 @@ -59,7 +58,6 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect diff --git a/main.go b/main.go index 892df38..129bb0c 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/cert-manager/cert-manager/pkg/acme/webhook/cmd" - "github.com/stuurmcp/cert-manager-webhook-sthome/sthome" + sthome "github.com/stuurmcp/cert-manager-webhook-sthome/pkg/dns" ) var ( diff --git a/sthome/config.go b/pkg/dns/config.go similarity index 90% rename from sthome/config.go rename to pkg/dns/config.go index a58e44d..aa6d38e 100644 --- a/sthome/config.go +++ b/pkg/dns/config.go @@ -1,4 +1,4 @@ -package sthome +package dns import ( "strings" @@ -39,26 +39,26 @@ type LocalDNSProviderConfig struct { // secret which contains the sthome API Key. APIKeySecretRef v1.SecretKeySelector `json:"apiKeySecretRef"` // Host is the Base URL (e.g. https://dns.example.ca) of the sthome API. - Host string `json:"host"` + //Host string `json:"host"` // Scheme supports HTTP AuthSchemes // https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml // // +optional default "" - APIKeyScheme string `json:"apiKeyScheme"` + //APIKeyScheme string `json:"apiKeyScheme"` // APIKeyHeaderName is the header name where apiKey will be set // // +optional default "X-API-Key" - APIKeyHeaderName string `json:"apiKeyHeaderName"` + //APIKeyHeaderName string `json:"apiKeyHeaderName"` // ServerID is the server ID in the sthome API. // When unset, defaults to "localhost". - ServerID string `json:"serverID"` + //ServerID string `json:"serverID"` // Headers are additional headers added to requests to the // sthome API server. - Headers map[string]string `json:"headers"` + //Headers map[string]string `json:"headers"` // CABundle is a PEM encoded CA bundle which will be used in // certificate validation when connecting to the sthome server. @@ -66,18 +66,18 @@ type LocalDNSProviderConfig struct { // When left blank, the default system store will be used. // // +optional - CABundle []byte `json:"caBundle"` + //CABundle []byte `json:"caBundle"` // TTL is the time-to-live value of the inserted DNS records. // // +optional - TTL int `json:"ttl"` + //TTL int `json:"ttl"` // Timeout is the timeout value for requests to the sthome API. // The value is specified in seconds. // // +optional - Timeout int `json:"timeout"` + //Timeout int `json:"timeout"` // AllowedZones is the list of zones that may be edited. If the list is // empty, all zones are permitted. diff --git a/sthome/shell.go b/pkg/dns/shell.go similarity index 96% rename from sthome/shell.go rename to pkg/dns/shell.go index b162a15..f09bb08 100644 --- a/sthome/shell.go +++ b/pkg/dns/shell.go @@ -1,4 +1,4 @@ -package sthome +package dns import ( "bytes" diff --git a/sthome/solver_local.go b/pkg/dns/solver_local.go similarity index 94% rename from sthome/solver_local.go rename to pkg/dns/solver_local.go index 92a4188..2fd4d73 100644 --- a/sthome/solver_local.go +++ b/pkg/dns/solver_local.go @@ -1,4 +1,4 @@ -package sthome +package dns import ( "fmt" @@ -47,7 +47,7 @@ func (p *LocalDNSProviderSolver) Name() string { // cert-manager itself will later perform a self check to ensure that the // solver has correctly configured the DNS provider. func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error { - domainName := extractDomainName(ch.ResolvedZone) + //domainName := extractDomainName(ch.ResolvedZone) cfg, err := loadConfig(ch.Config) if err != nil { return err @@ -80,7 +80,17 @@ func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error */ // TODO: do something more useful with the decoded configuration klog.Infof("Decoded configuration %v\n", cfg) - klog.Infof("Presenting record for %s, ch: %s, domain: %s", ch.DNSName, ch.ResolvedFQDN, domainName) + klog.Infof("Presenting record for %s, type: %s, uid: %s, key: %s, ns: %s, fqdn: %s, zone: %s, allowambcred: %t, cfg: %s", + ch.DNSName, + ch.UID, + ch.Type, + ch.Key, + ch.ResourceNamespace, + ch.ResolvedFQDN, + ch.ResolvedZone, + ch.AllowAmbientCredentials, + ch.Config, + ) // TODO: convert shell script to golang localip := getOutboundIP(dnsserver_net) success, _ := Execute( diff --git a/sthome/utils.go b/pkg/dns/utils.go similarity index 99% rename from sthome/utils.go rename to pkg/dns/utils.go index 8f1c8ba..73ada57 100644 --- a/sthome/utils.go +++ b/pkg/dns/utils.go @@ -1,7 +1,7 @@ // private repo workaround // Will use this file and remove same content from main.go when github repo is made public -package sthome +package dns import ( "encoding/json" diff --git a/sthome/utils_test.go b/pkg/dns/utils_test.go similarity index 99% rename from sthome/utils_test.go rename to pkg/dns/utils_test.go index 113da77..95d2f5c 100644 --- a/sthome/utils_test.go +++ b/pkg/dns/utils_test.go @@ -1,4 +1,4 @@ -package sthome +package dns import ( "context" diff --git a/util/version.go b/pkg/util/version.go similarity index 100% rename from util/version.go rename to pkg/util/version.go diff --git a/version.txt b/version.txt index bff0165..ea62299 100644 --- a/version.txt +++ b/version.txt @@ -1,3 +1,3 @@ -0.0.4-alpha.100 -20240402-1118 -100 \ No newline at end of file +0.0.4-alpha.107 +20240405-1950 +107 \ No newline at end of file