feat: use common annotation prefix to simplify filtering in informer transformers (#5621)

In order to filter annotations in informer transformers, this PR makes it more explicit that a common prefix is used.
New prefixes can be added later-on if need be, but all annotations should be anchored in a known prefix.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
This commit is contained in:
Valerian Roche 2025-07-09 04:05:41 -04:00 committed by GitHub
parent 5d8d424bcb
commit ad653a63b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,37 +18,41 @@ import (
) )
const ( const (
// AnnotationKeyPrefix is set on all annotations consumed by external-dns (outside of user templates)
// to provide easy filtering.
AnnotationKeyPrefix = "external-dns.alpha.kubernetes.io/"
// CloudflareProxiedKey The annotation used for determining if traffic will go through Cloudflare // CloudflareProxiedKey The annotation used for determining if traffic will go through Cloudflare
CloudflareProxiedKey = "external-dns.alpha.kubernetes.io/cloudflare-proxied" CloudflareProxiedKey = AnnotationKeyPrefix + "cloudflare-proxied"
CloudflareCustomHostnameKey = "external-dns.alpha.kubernetes.io/cloudflare-custom-hostname" CloudflareCustomHostnameKey = AnnotationKeyPrefix + "cloudflare-custom-hostname"
CloudflareRegionKey = "external-dns.alpha.kubernetes.io/cloudflare-region-key" CloudflareRegionKey = AnnotationKeyPrefix + "cloudflare-region-key"
CloudflareRecordCommentKey = "external-dns.alpha.kubernetes.io/cloudflare-record-comment" CloudflareRecordCommentKey = AnnotationKeyPrefix + "cloudflare-record-comment"
AWSPrefix = "external-dns.alpha.kubernetes.io/aws-" AWSPrefix = AnnotationKeyPrefix + "aws-"
SCWPrefix = "external-dns.alpha.kubernetes.io/scw-" SCWPrefix = AnnotationKeyPrefix + "scw-"
WebhookPrefix = "external-dns.alpha.kubernetes.io/webhook-" WebhookPrefix = AnnotationKeyPrefix + "webhook-"
CloudflarePrefix = "external-dns.alpha.kubernetes.io/cloudflare-" CloudflarePrefix = AnnotationKeyPrefix + "cloudflare-"
TtlKey = "external-dns.alpha.kubernetes.io/ttl" TtlKey = AnnotationKeyPrefix + "ttl"
ttlMinimum = 1 ttlMinimum = 1
ttlMaximum = math.MaxInt32 ttlMaximum = math.MaxInt32
SetIdentifierKey = "external-dns.alpha.kubernetes.io/set-identifier" SetIdentifierKey = AnnotationKeyPrefix + "set-identifier"
AliasKey = "external-dns.alpha.kubernetes.io/alias" AliasKey = AnnotationKeyPrefix + "alias"
TargetKey = "external-dns.alpha.kubernetes.io/target" TargetKey = AnnotationKeyPrefix + "target"
// The annotation used for figuring out which controller is responsible // The annotation used for figuring out which controller is responsible
ControllerKey = "external-dns.alpha.kubernetes.io/controller" ControllerKey = AnnotationKeyPrefix + "controller"
// The annotation used for defining the desired hostname // The annotation used for defining the desired hostname
HostnameKey = "external-dns.alpha.kubernetes.io/hostname" HostnameKey = AnnotationKeyPrefix + "hostname"
// The annotation used for specifying whether the public or private interface address is used // The annotation used for specifying whether the public or private interface address is used
AccessKey = "external-dns.alpha.kubernetes.io/access" AccessKey = AnnotationKeyPrefix + "access"
// The annotation used for specifying the type of endpoints to use for headless services // The annotation used for specifying the type of endpoints to use for headless services
EndpointsTypeKey = "external-dns.alpha.kubernetes.io/endpoints-type" EndpointsTypeKey = AnnotationKeyPrefix + "endpoints-type"
// The annotation used to determine the source of hostnames for ingresses. This is an optional field - all // The annotation used to determine the source of hostnames for ingresses. This is an optional field - all
// available hostname sources are used if not specified. // available hostname sources are used if not specified.
IngressHostnameSourceKey = "external-dns.alpha.kubernetes.io/ingress-hostname-source" IngressHostnameSourceKey = AnnotationKeyPrefix + "ingress-hostname-source"
// The value of the controller annotation so that we feel responsible // The value of the controller annotation so that we feel responsible
ControllerValue = "dns-controller" ControllerValue = "dns-controller"
// The annotation used for defining the desired hostname // The annotation used for defining the desired hostname
InternalHostnameKey = "external-dns.alpha.kubernetes.io/internal-hostname" InternalHostnameKey = AnnotationKeyPrefix + "internal-hostname"
) )