From 761d6551d391d12b21078ecb92fe1a7bb828c3e3 Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Sun, 28 Apr 2024 14:05:45 +0200 Subject: [PATCH] Initial support for forwarding wildcard annotations to webhook providers --- source/source.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/source.go b/source/source.go index c7d46c970..149892853 100644 --- a/source/source.go +++ b/source/source.go @@ -60,6 +60,8 @@ const ( controllerAnnotationValue = "dns-controller" // The annotation used for defining the desired hostname internalHostnameAnnotationKey = "external-dns.alpha.kubernetes.io/internal-hostname" + // New annotation to support wildcard annotations for webhook providers + webhookWildcardAnnotationKey = "external-dns.alpha.kubernetes.io/webhook-*" ) const ( @@ -224,6 +226,13 @@ func getProviderSpecificAnnotations(annotations map[string]string) (endpoint.Pro Name: fmt.Sprintf("ibmcloud-%s", attr), Value: v, }) + } else if strings.HasPrefix(k, webhookWildcardAnnotationKey) { + // Support for wildcard annotations for webhook providers + attr := strings.TrimPrefix(k, "external-dns.alpha.kubernetes.io/webhook-") + providerSpecificAnnotations = append(providerSpecificAnnotations, endpoint.ProviderSpecificProperty{ + Name: fmt.Sprintf("webhook/%s", attr), + Value: v, + }) } } return providerSpecificAnnotations, setIdentifier