Initial support for forwarding wildcard annotations to webhook providers

This commit is contained in:
Raffaele Di Fazio 2024-04-28 14:05:45 +02:00
parent c506a20de6
commit 761d6551d3

View File

@ -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