Added more debug msg in solver

This commit is contained in:
Chris Stuurman 2024-04-05 23:36:09 +02:00
parent 5b51498b5b
commit 6c4d067b06
4 changed files with 14 additions and 16 deletions

View File

@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: v1
appVersion: v0.0.4-alpha.107 appVersion: v0.0.4-alpha.109
description: Cert-Manager webhook for sthome description: Cert-Manager webhook for sthome
name: sthome-webhook name: sthome-webhook
version: 0.0.4-alpha.107 version: 0.0.4-alpha.109

View File

@ -31,7 +31,7 @@ clusterIssuer:
image: image:
repository: stuurmcp/cert-manager-webhook-sthome repository: stuurmcp/cert-manager-webhook-sthome
#repository: wstat.sthome.net:5000/cert-manager-webhook-sthome #repository: wstat.sthome.net:5000/cert-manager-webhook-sthome
tag: 0.0.4-alpha.107 tag: 0.0.4-alpha.109
#pullPolicy should be IfNotPresent. Set to Always for testing purposes #pullPolicy should be IfNotPresent. Set to Always for testing purposes
pullPolicy: IfNotPresent pullPolicy: IfNotPresent

View File

@ -3,6 +3,7 @@ package dns
import ( import (
"fmt" "fmt"
"net" "net"
"strings"
"k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
@ -53,18 +54,14 @@ func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error
return err return err
} }
klog.InfoS("CZ: Presenting challenge", "dnsName", ch.DNSName, "resolvedZone", ch.ResolvedZone, "resolvedFQDN", ch.ResolvedFQDN)
/* /*
provider, cfg, err := loc.init(ch.Config, ch.ResourceNamespace) provider, cfg, err := loc.init(ch.Config, ch.ResourceNamespace)
if err != nil { if err != nil {
return fmt.Errorf("failed initializing sthome provider: %v", err) return fmt.Errorf("failed initializing sthome provider: %v", err)
} }
*/ if !cfg.IsAllowedZone(ch.ResolvedZone) {
if !cfg.IsAllowedZone(ch.ResolvedZone) { return fmt.Errorf("zone %s may not be edited per config (allowed zones are %v)", ch.ResolvedZone, cfg.AllowedZones)
return fmt.Errorf("zone %s may not be edited per config (allowed zones are %v)", ch.ResolvedZone, cfg.AllowedZones) }
}
/*
ctx := context.Background() ctx := context.Background()
records, err := loc.getExistingRecords(ctx, provider, ch.ResolvedZone, ch.ResolvedFQDN) records, err := loc.getExistingRecords(ctx, provider, ch.ResolvedZone, ch.ResolvedFQDN)
if err != nil { if err != nil {
@ -79,8 +76,7 @@ func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error
} }
*/ */
// TODO: do something more useful with the decoded configuration // TODO: do something more useful with the decoded configuration
klog.Infof("Decoded configuration %v\n", cfg) klog.Infof("CZ: Presenting record for %s, type: %s, uid: %s, key: %s, ns: %s, fqdn: %s, zone: %s, allowambcred: %t, cfg.secret: %s, cfg.email: %s, cfg.allowz: %s",
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.DNSName,
ch.UID, ch.UID,
ch.Type, ch.Type,
@ -89,7 +85,9 @@ func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error
ch.ResolvedFQDN, ch.ResolvedFQDN,
ch.ResolvedZone, ch.ResolvedZone,
ch.AllowAmbientCredentials, ch.AllowAmbientCredentials,
ch.Config, cfg.APIKeySecretRef.Name,
cfg.Email,
strings.Join(cfg.AllowedZones, ","),
) )
// TODO: convert shell script to golang // TODO: convert shell script to golang
localip := getOutboundIP(dnsserver_net) localip := getOutboundIP(dnsserver_net)

View File

@ -1,3 +1,3 @@
0.0.4-alpha.107 0.0.4-alpha.109
20240405-1950 20240405-2325
107 109