common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GatewayGVK = schema.GroupVersionKind{
		Group:   "gateway.networking.k8s.io",
		Version: "v1",
		Kind:    "Gateway",
	}

	HTTPRouteGVK = schema.GroupVersionKind{
		Group:   "gateway.networking.k8s.io",
		Version: "v1",
		Kind:    "HTTPRoute",
	}

	TLSRouteGVK = schema.GroupVersionKind{
		Group:   "gateway.networking.k8s.io",
		Version: "v1alpha2",
		Kind:    "TLSRoute",
	}

	TCPRouteGVK = schema.GroupVersionKind{
		Group:   "gateway.networking.k8s.io",
		Version: "v1alpha2",
		Kind:    "TCPRoute",
	}

	ReferenceGrantGVK = schema.GroupVersionKind{
		Group:   "gateway.networking.k8s.io",
		Version: "v1alpha2",
		Kind:    "ReferenceGrant",
	}
)

Functions

func ExtractObjectsFromReader added in v0.2.0

func ExtractObjectsFromReader(reader io.Reader, namespace string) ([]*unstructured.Unstructured, error)

ExtractObjectsFromReader extracts all objects from a reader, which is created from YAML or JSON input files. It retrieves all objects, including nested ones if they are contained within a list. The function takes a namespace parameter to optionally return only namespaced resources.

func GetIngressClass

func GetIngressClass(ingress networkingv1.Ingress) string

func GetRuleGroups

func GetRuleGroups(ingresses []networkingv1.Ingress) map[string]IngressRuleGroup

func NameFromHost

func NameFromHost(host string) string

func PtrTo added in v0.2.0

func PtrTo[T any](a T) *T

func ReadIngressesFromCluster added in v0.2.0

func ReadIngressesFromCluster(ctx context.Context, client client.Client, ingressClass string) (map[types.NamespacedName]*networkingv1.Ingress, error)

func ReadIngressesFromFile added in v0.2.0

func ReadIngressesFromFile(filename, namespace, ingressClass string) (map[types.NamespacedName]*networkingv1.Ingress, error)

func RouteName added in v0.2.0

func RouteName(ingressName, host string) string

func ToGateway

ToGateway converts the received ingresses to i2gw.GatewayResources, without taking into consideration any provider specific logic.

Types

type IngressRuleGroup

type IngressRuleGroup struct {
	Namespace    string
	Name         string
	IngressClass string
	Host         string
	TLS          []networkingv1.IngressTLS
	Rules        []Rule
}

type Rule

type Rule struct {
	Ingress     networkingv1.Ingress
	IngressRule networkingv1.IngressRule
}

Jump to

Keyboard shortcuts

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