Documentation
¶
Index ¶
- Constants
- Variables
- func ExtractPlugins(obj ObjectWithAnnotationsAndNamespace) []string
- func ExtractPluginsNamespacedNames(obj ObjectWithAnnotationsAndNamespace) []types.NamespacedName
- func ExtractPluginsWithNamespaces(obj ObjectWithAnnotationsAndNamespace) []string
- func ExtractTags(obj ObjectWithAnnotations) []string
- func IsReservedTag(tag string) bool
- func ReservedTags(tags []string) []string
- func WithoutReservedTags(tags []string) []string
- type ObjectWithAnnotations
- type ObjectWithAnnotationsAndNamespace
Constants ¶
const ( // AnnotationKeyTags is the annotation key used to set tags on resources. AnnotationKeyTags = annotationPrefix + "/tags" // AnnotationKeyPlugins is the annotation key used to attach KongPlugins to resources. AnnotationKeyPlugins = annotationPrefix + "/plugins" // AnnotationKeyKonnectCPLabels is the annotation key used to set Konnect labels on the // KonnectGatewayControlPlane created for a Gateway. AnnotationKeyKonnectCPLabels = annotationPrefix + "/konnect-cp-labels" // AnnotationKeyKonnectDPLabels is the annotation key used to set Konnect labels on the // KonnectExtension (and thus the Konnect DataPlane) created for a Gateway. AnnotationKeyKonnectDPLabels = annotationPrefix + "/konnect-dp-labels" )
Variables ¶
var ReservedTagPrefixes = []string{
"k8s-generation:",
"k8s-group:",
"k8s-kind:",
"k8s-name:",
"k8s-namespace:",
"k8s-uid:",
"k8s-version:",
"managed-by:",
}
ReservedTagPrefixes are the prefixes of the tags the operator attaches to Konnect entities to carry the metadata of the source Kubernetes object (e.g. "k8s-uid:<uid>"). Users must not set tags with these prefixes as the operator relies on them, e.g. to find the Konnect entity owned by a Kubernetes object by its UID.
Functions ¶
func ExtractPlugins ¶
func ExtractPlugins(obj ObjectWithAnnotationsAndNamespace) []string
ExtractPlugins extracts plugin names from the given object's konghq.com/plugins annotation. This function trims the whitespace from the plugin names.
For example, for KongConsumer in namespace default, having the "konghq.com/plugins" annotation set to "p1,p2" this will return []string{"p1", "p2"}.
func ExtractPluginsNamespacedNames ¶
func ExtractPluginsNamespacedNames(obj ObjectWithAnnotationsAndNamespace) []types.NamespacedName
ExtractPluginsNamespacedNames extracts plugin namespaced names from the given object's konghq.com/plugins annotation. Plugins can optionally specify the namespace using the "<namespace>:<plugin-name>" format. This function trims the whitespace from the plugin names.
For example, for an object having the "konghq.com/plugins" annotation set to "default:p1,p2" this will return:
[]types.NamespacedName{
types.NamespacedName{Namespace: "default", Name: "p1"},
types.NamespacedName{Namespace: "", Name: "p2"},
}
func ExtractPluginsWithNamespaces ¶
func ExtractPluginsWithNamespaces(obj ObjectWithAnnotationsAndNamespace) []string
ExtractPluginsWithNamespaces extracts plugin namespaced names from the given object's konghq.com/plugins annotation. This function trims the whitespace from the plugin names.
For example, for KongConsumer in namespace default, having the "konghq.com/plugins" annotation set to "p1,p2" this will return []string{"default/p1", "default/p2"}.
func ExtractTags ¶
func ExtractTags(obj ObjectWithAnnotations) []string
ExtractTags extracts a set of tags from a comma-separated string. Copy pasted from https://github.com/Kong/kubernetes-ingress-controller/blob/eb80ec2c58f4d53f8c6d7c997bcfb1f334b801e1/internal/annotations/annotations.go#L407-L416
func IsReservedTag ¶ added in v2.4.0
IsReservedTag returns true if the given tag starts with one of the ReservedTagPrefixes.
func ReservedTags ¶ added in v2.4.0
ReservedTags returns the tags from the given list which start with one of the ReservedTagPrefixes.
func WithoutReservedTags ¶ added in v2.4.0
WithoutReservedTags returns the tags from the given list which do not start with any of the ReservedTagPrefixes. It returns nil if no tags are left.
Types ¶
type ObjectWithAnnotations ¶
ObjectWithAnnotations is an interface that provides a method to get annotations.
type ObjectWithAnnotationsAndNamespace ¶
type ObjectWithAnnotationsAndNamespace interface {
ObjectWithAnnotations
GetNamespace() string
}
ObjectWithAnnotationsAndNamespace is an interface that provides a method to get annotations and namespace.