annotations

package
v2.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IngressClassKey = "kubernetes.io/ingress.class"

	AnnotationPrefix = "konghq.com"

	ConfigurationKey            = "/override"
	PluginsKey                  = "/plugins"
	ProtocolKey                 = "/protocol"
	ProtocolsKey                = "/protocols"
	ClientCertKey               = "/client-cert"
	StripPathKey                = "/strip-path"
	PathKey                     = "/path"
	HTTPSRedirectCodeKey        = "/https-redirect-status-code"
	PreserveHostKey             = "/preserve-host"
	RegexPriorityKey            = "/regex-priority"
	HostHeaderKey               = "/host-header"
	MethodsKey                  = "/methods"
	SNIsKey                     = "/snis"
	RequestBuffering            = "/request-buffering"
	ResponseBuffering           = "/response-buffering"
	HostAliasesKey              = "/host-aliases"
	RegexPrefixKey              = "/regex-prefix"
	ConnectTimeoutKey           = "/connect-timeout"
	WriteTimeoutKey             = "/write-timeout"
	ReadTimeoutKey              = "/read-timeout"
	RetriesKey                  = "/retries"
	HeadersKey                  = "/headers"
	HeadersSeparatorKey         = "/headers-separator"
	PathHandlingKey             = "/path-handling"
	UserTagKey                  = "/tags"
	RewriteURIKey               = "/rewrite"
	TLSVerifyKey                = "/tls-verify"
	TLSVerifyDepthKey           = "/tls-verify-depth"
	CACertificatesSecretsKey    = "/ca-certificates-secrets"
	CACertificatesConfigMapsKey = "/ca-certificates-configmaps"

	// GatewayClassUnmanagedKey is an annotation used on a Gateway resource to
	// indicate that the GatewayClass should be reconciled according to unmanaged
	// mode.
	//
	// NOTE: it's currently required that this annotation be present on all GatewayClass
	// resources: "unmanaged" mode is the only supported mode at this time.
	GatewayClassUnmanagedKey = "/gatewayclass-unmanaged"

	// GatewayPublishServiceKey is an annotation suffix used to indicate the Service(s) a Gateway's routes are
	// published to.
	GatewayPublishServiceKey = "/publish-service"

	// DefaultIngressClass defines the default class used
	// by Kong's ingress controller.
	DefaultIngressClass = "kong"

	// GatewayClassUnmanagedAnnotationValuePlaceholder is intended to be used as placeholder value for the
	// GatewayClassUnmanagedAnnotation annotation.
	GatewayClassUnmanagedAnnotationValuePlaceholder = "true"
)

Variables

View Source
var GatewayClassUnmanagedAnnotation = fmt.Sprintf("%s%s", AnnotationPrefix, GatewayClassUnmanagedKey)

GatewayClassUnmanagedAnnotation is the complete annotations for unmanaged mode made by the konhq.com prefix followed by the gatewayclass-unmanaged GatewayClass suffix.

Functions

func ExtractCACertificateConfigMapNames

func ExtractCACertificateConfigMapNames(anns map[string]string) []string

func ExtractCACertificateSecretNames

func ExtractCACertificateSecretNames(anns map[string]string) []string

ExtractCACertificateSecretNames extracts the ca-certificates secret names from the `ca-certificates-secret` annotation. It expects a comma-separated list of secret names containing CA certificates.

func ExtractClientCertificate

func ExtractClientCertificate(anns map[string]string) string

ExtractClientCertificate extracts the secret name containing the client-certificate to use.

func ExtractConfigurationName

func ExtractConfigurationName(anns map[string]string) string

ExtractConfigurationName extracts the konghq.com/override annotation value. This annotation was used to reference KongIngress objects, which are now deprecated. This function is retained for backward compatibility to detect deprecated usage.

func ExtractConnectTimeout

func ExtractConnectTimeout(anns map[string]string) (string, bool)

ExtractConnectTimeout extracts the connection timeout annotation value.

func ExtractGatewayPublishService

func ExtractGatewayPublishService(anns map[string]string) []string

ExtractGatewayPublishService extracts the value of the gateway publish service annotation.

func ExtractHTTPSRedirectStatusCode

func ExtractHTTPSRedirectStatusCode(anns map[string]string) string

ExtractHTTPSRedirectStatusCode extracts the https redirect status code annotation value.

func ExtractHeaders

func ExtractHeaders(anns map[string]string) (map[string][]string, bool)

ExtractHeaders extracts the parsed headers annotations values. It returns a map of header names to slices of values.

func ExtractHostAliases

func ExtractHostAliases(anns map[string]string) ([]string, bool)

ExtractHostAliases extracts the host-aliases annotation value.

func ExtractHostHeader

func ExtractHostHeader(anns map[string]string) string

ExtractHostHeader extracts the host-header annotation value.

func ExtractMethods

func ExtractMethods(anns map[string]string) []string

ExtractMethods extracts the methods annotation value.

func ExtractPath

func ExtractPath(anns map[string]string) string

ExtractPath extracts the path annotations containing the HTTP path.

func ExtractPathHandling

func ExtractPathHandling(anns map[string]string) (string, bool)

ExtractPathHandling extracts the path handling annotation value.

func ExtractPreserveHost

func ExtractPreserveHost(anns map[string]string) string

ExtractPreserveHost extracts the preserve-host annotation value.

func ExtractProtocolName

func ExtractProtocolName(anns map[string]string) string

ExtractProtocolName extracts the protocol supplied in the annotation.

func ExtractProtocolNames

func ExtractProtocolNames(anns map[string]string) []string

ExtractProtocolNames extracts the protocols supplied in the annotation.

func ExtractReadTimeout

func ExtractReadTimeout(anns map[string]string) (string, bool)

ExtractReadTimeout extracts the read timeout annotation value.

func ExtractRegexPrefix

func ExtractRegexPrefix(anns map[string]string) string

func ExtractRegexPriority

func ExtractRegexPriority(anns map[string]string) string

ExtractRegexPriority extracts the regex-priority annotation value.

func ExtractRequestBuffering

func ExtractRequestBuffering(anns map[string]string) (string, bool)

ExtractRequestBuffering extracts the boolean annotation indicating whether or not a route should buffer requests.

func ExtractResponseBuffering

func ExtractResponseBuffering(anns map[string]string) (string, bool)

ExtractResponseBuffering extracts the boolean annotation indicating whether or not a route should buffer responses.

func ExtractRetries

func ExtractRetries(anns map[string]string) (string, bool)

ExtractRetries extracts the retries annotation value.

func ExtractRewriteURI

func ExtractRewriteURI(anns map[string]string) (string, bool)

ExtractRewriteURI extracts the rewrite annotation value.

func ExtractSNIs

func ExtractSNIs(anns map[string]string) ([]string, bool)

ExtractSNIs extracts the route SNI match criteria annotation value.

func ExtractStripPath

func ExtractStripPath(anns map[string]string) string

ExtractStripPath extracts the strip-path annotations containing the the boolean string "true" or "false".

func ExtractTLSVerify

func ExtractTLSVerify(anns map[string]string) (value bool, ok bool)

ExtractTLSVerify extracts the tls-verify annotation value.

func ExtractTLSVerifyDepth

func ExtractTLSVerifyDepth(anns map[string]string) (int, bool)

ExtractTLSVerifyDepth extracts the tls-verify-depth annotation value.

func ExtractUnmanagedGatewayClassMode

func ExtractUnmanagedGatewayClassMode(anns map[string]string) string

ExtractUnmanagedGatewayClassMode extracts the value of the unmanaged gateway mode annotation.

func ExtractUpstreamPolicy

func ExtractUpstreamPolicy(anns map[string]string) (string, bool)

ExtractUpstreamPolicy extracts the upstream policy annotation value.

func ExtractUserTags

func ExtractUserTags(anns map[string]string) []string

ExtractUserTags extracts a set of tags from a comma-separated string.

func ExtractWriteTimeout

func ExtractWriteTimeout(anns map[string]string) (string, bool)

ExtractWriteTimeout extracts the write timeout annotation value.

func HasForceSSLRedirectAnnotation

func HasForceSSLRedirectAnnotation(anns map[string]string) bool

HasForceSSLRedirectAnnotation returns true if the annotation ingress.kubernetes.io/force-ssl-redirect is set to "true" in anns.

func HasServiceUpstreamAnnotation

func HasServiceUpstreamAnnotation(anns map[string]string) bool

HasServiceUpstreamAnnotation returns true if the annotation ingress.kubernetes.io/service-upstream is set to "true" in anns.

func IngressClassValidatorFuncFromObjectMeta

func IngressClassValidatorFuncFromObjectMeta(
	ingressClass string,
) func(obj *metav1.ObjectMeta, annotation string, handling ClassMatching) bool

IngressClassValidatorFuncFromObjectMeta returns a function which can validate if an ObjectMeta belongs to an the ingressClass or not.

func IngressClassValidatorFuncFromV1Ingress

func IngressClassValidatorFuncFromV1Ingress(
	ingressClass string,
) func(ingress *netv1.Ingress, handling ClassMatching) bool

func SetConfigMapCACertificates

func SetConfigMapCACertificates(anns map[string]string, configMapCertificates []string)

SetConfigMapCACertificates merge the ca-certificates configmap names into the already existing CA certificates set via annotation.

func SetHostHeader

func SetHostHeader(anns map[string]string, value string)

SetHostHeader sets the host-header annotation value.

func SetProtocol

func SetProtocol(anns map[string]string, value string)

SetProtocol sets the protocol annotation value.

func SetSecretCACertificates

func SetSecretCACertificates(anns map[string]string, secretCertificates []string)

SetSecretCACertificates merge the ca-certificates secret names into the already existing CA certificates set via annotation.

func SetTLSVerify

func SetTLSVerify(anns map[string]string, value bool)

SetTLSVerify sets the tls-verify annotation value.

func SetTLSVerifyDepth

func SetTLSVerifyDepth(anns map[string]string, depth int)

SetTLSVerifyDepth sets the tls-verify-depth annotation value.

func UpdateGatewayPublishService

func UpdateGatewayPublishService(anns map[string]string, services []string)

UpdateGatewayPublishService updates the value of the annotation konghq.com/gatewayclass-unmanaged.

func UpdateUnmanagedAnnotation

func UpdateUnmanagedAnnotation(anns map[string]string, annotationValue string)

UpdateUnmanagedAnnotation updates the value of the annotation konghq.com/gatewayclass-unmanaged.

Types

type ClassMatching

type ClassMatching int
const (
	IgnoreClassMatch       ClassMatching = iota
	ExactOrEmptyClassMatch ClassMatching = iota
	ExactClassMatch        ClassMatching = iota
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL