Documentation ¶
Index ¶
- Constants
- func CheckCondition(conditions []metav1.Condition, typ ConditionType, reason ConditionReason, ...) bool
- func ExtractKongCredentialType(secret *corev1.Secret) (string, error)
- func GenerateTagsForObject(obj client.Object, additionalTags ...KongTag) []*string
- func GetNodeIPOrName(ctx context.Context, kubeClient clientset.Interface, name string) string
- func GetPodNN() (k8stypes.NamespacedName, error)
- func HostnamesIntersect[H1, H2 gatewayapi.HostnameT](hostnameA H1, hostnameB H2) bool
- func HostnamesMatch(hostnameA, hostnameB string) bool
- func IsBackendRefGroupKindSupported(gatewayAPIGroup *gatewayapi.Group, gatewayAPIKind *gatewayapi.Kind) bool
- func ParseNameNS(input string) (string, string, error)
- func PopulateTypeMeta(obj runtime.Object, s *runtime.Scheme) error
- func StringToGatewayAPIHostname(hostname string) gatewayapi.Hostname
- func StringToGatewayAPIHostnamePtr(hostname string) *gatewayapi.Hostname
- func StringToGatewayAPIHostnameV1Beta1Ptr(hostname string) *gatewayapi.Hostname
- func StringToGatewayAPIKindPtr(kind string) *gatewayapi.Kind
- func StringToGatewayAPIKindV1Alpha2Ptr(kind string) *gatewayapi.Kind
- func TypeMetaFromGVK(gvk schema.GroupVersionKind) metav1.TypeMeta
- func ValidateProtocol(protocol string) bool
- type ConditionReason
- type ConditionType
- type DefaultUUIDGenerator
- type Endpoint
- type FR
- type ForeignRelations
- type K8sObjectInfo
- type KongTag
- type PluginSchemaStore
- type PodInfo
- type Rel
- type UUIDGenerator
Constants ¶
const ( K8sNamespaceTagPrefix = "k8s-namespace:" K8sNameTagPrefix = "k8s-name:" K8sUIDTagPrefix = "k8s-uid:" K8sKindTagPrefix = "k8s-kind:" K8sGroupTagPrefix = "k8s-group:" K8sVersionTagPrefix = "k8s-version:" K8sNamedRouteRuleTagPrefix = "k8s-named-route-rule:" )
Variables ¶
This section is empty.
Functions ¶
func CheckCondition ¶
func CheckCondition( conditions []metav1.Condition, typ ConditionType, reason ConditionReason, status metav1.ConditionStatus, resourceGeneration int64, ) bool
CheckCondition tells if there's a condition matching the given type, reason, and status in conditions. It also makes sure that the condition's observed generation is no older than the resource's actual generation.
func ExtractKongCredentialType ¶
ExtractKongCredentialType returns the credential type of a Secret or an error if no credential type is present.
func GenerateTagsForObject ¶
GenerateTagsForObject returns a subset of an object's metadata as a slice of prefixed string pointers.
func GetNodeIPOrName ¶
GetNodeIPOrName returns the IP address or the name of a node in the cluster.
func GetPodNN ¶
func GetPodNN() (k8stypes.NamespacedName, error)
GetPodNN returns NamespacedName of pod that this process is running in.
func HostnamesIntersect ¶
func HostnamesIntersect[H1, H2 gatewayapi.HostnameT](hostnameA H1, hostnameB H2) bool
HostnamesIntersect checks if the hostnameA and hostnameB have an intersection. To perform this check, the function HostnamesMatch is called twice swapping the parameters and using first hostnameA as a mask, then hostnameB. If there is at least one match, the hostnames intersect.
func HostnamesMatch ¶
HostnamesMatch checks that the hostnameB matches the hostnameA. HostnameA is treated as mask to be checked against the hostnameB.
func IsBackendRefGroupKindSupported ¶
func IsBackendRefGroupKindSupported(gatewayAPIGroup *gatewayapi.Group, gatewayAPIKind *gatewayapi.Kind) bool
IsBackendRefGroupKindSupported checks if the GroupKind of the object used as BackendRef for the HTTPRoute is supported.
func ParseNameNS ¶
ParseNameNS parses a string searching a namespace and name.
func PopulateTypeMeta ¶
PopulateTypeMeta adds GVK information to a runtime.Object that may not have it available in the object TypeMeta.
func StringToGatewayAPIHostname ¶
func StringToGatewayAPIHostname(hostname string) gatewayapi.Hostname
StringToGatewayAPIHostname converts a string to a gatewayapi.Hostname.
func StringToGatewayAPIHostnamePtr ¶
func StringToGatewayAPIHostnamePtr(hostname string) *gatewayapi.Hostname
StringToGatewayAPIHostnamePtr converts a string to a *gatewayapi.Hostname.
func StringToGatewayAPIHostnameV1Beta1Ptr ¶
func StringToGatewayAPIHostnameV1Beta1Ptr(hostname string) *gatewayapi.Hostname
StringToGatewayAPIHostnameV1Beta1Ptr converts a string to a *gatewayapi.Hostname.
func StringToGatewayAPIKindPtr ¶
func StringToGatewayAPIKindPtr(kind string) *gatewayapi.Kind
StringToGatewayAPIKindPtr converts a string to a *gatewayapi.Kind.
func StringToGatewayAPIKindV1Alpha2Ptr ¶
func StringToGatewayAPIKindV1Alpha2Ptr(kind string) *gatewayapi.Kind
StringToGatewayAPIKindV1Alpha2Ptr converts a string to a *gatewayapi.Kind.
func TypeMetaFromGVK ¶ added in v3.2.3
func TypeMetaFromGVK(gvk schema.GroupVersionKind) metav1.TypeMeta
TypeMetaFromGVK returns typemeta from groupversionkind of a k8s object.
func ValidateProtocol ¶
ValidateProtocol returns true if the provided protocol is valid.
Types ¶
type ConditionReason ¶
type ConditionReason string
ConditionReason can be any condition reason, e.g. `gatewayapi.GatewayReasonProgrammed`.
type ConditionType ¶
type ConditionType string
ConditionType can be any condition type, e.g. `gatewayapi.GatewayConditionProgrammed`.
type DefaultUUIDGenerator ¶ added in v3.1.5
type DefaultUUIDGenerator struct{}
DefaultUUIDGenerator is the default implementation of UUIDGenerator.
func (DefaultUUIDGenerator) NewString ¶ added in v3.1.5
func (DefaultUUIDGenerator) NewString() string
type Endpoint ¶
type Endpoint struct { // Address IP address of the endpoint Address string `json:"address"` // Port number of the TCP port Port string `json:"port"` }
Endpoint describes a kubernetes endpoint, same as a target in Kong.
type FR ¶ added in v3.4.0
type FR struct { Identifier string // Referer represents K8s object that references a Plugin. Referer client.Object }
FR represents a foreign relation.
type ForeignRelations ¶
type ForeignRelations struct {
Consumer, ConsumerGroup, Route, Service []FR
}
func (*ForeignRelations) GetCombinations ¶
func (relations *ForeignRelations) GetCombinations() []Rel
type K8sObjectInfo ¶
type K8sObjectInfo struct { Name string Namespace string Annotations map[string]string GroupVersionKind schema.GroupVersionKind }
K8sObjectInfo describes a Kubernetes object.
func FromK8sObject ¶
func FromK8sObject(obj client.Object) K8sObjectInfo
FromK8sObject extracts information from a Kubernetes object. It performs a shallow copy of object annotations so any modifications after calling FromK8sObject will have an effect on the original object.
func (K8sObjectInfo) GetAnnotations ¶ added in v3.4.0
func (k K8sObjectInfo) GetAnnotations() map[string]string
func (K8sObjectInfo) GetNamespace ¶ added in v3.4.0
func (k K8sObjectInfo) GetNamespace() string
type KongTag ¶ added in v3.4.0
func AdditionalTagsK8sNamedRouteRule ¶ added in v3.4.0
AdditionalTagsK8sNamedRouteRule returns a slice of KongTag with the given named route rules. It filters out empty strings.
type PluginSchemaStore ¶
type PluginSchemaStore struct {
// contains filtered or unexported fields
}
PluginSchemaStore retrives a schema of a Plugin from Kong.
func NewPluginSchemaStore ¶
func NewPluginSchemaStore(client *kong.Client) *PluginSchemaStore
NewPluginSchemaStore creates a PluginSchemaStore.
type PodInfo ¶
type PodInfo struct { Name string Namespace string NodeIP string // Labels selectors of the running pod // This is used to search for other Ingress controller pods Labels map[string]string }
PodInfo contains runtime information about the pod running the Ingres controller.
type UUIDGenerator ¶ added in v3.1.5
type UUIDGenerator interface {
NewString() string
}
UUIDGenerator is an interface to generate UUIDs.