gatewayapi

package
v0.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterValidSubdomains

func FilterValidSubdomains(domains, subdomains []gatewayapiv1.Hostname) []gatewayapiv1.Hostname

FilterValidSubdomains returns every subdomain that is a subset of at least one of the (super) domains specified in the first argument.

func GatewayHostnames

func GatewayHostnames(gw *gatewayapiv1.Gateway) []gatewayapiv1.Hostname

func GetGatewayParentKeys added in v0.10.0

func GetGatewayParentKeys(route *gatewayapiv1.HTTPRoute) []client.ObjectKey

GetGatewayParentKeys returns the object keys of all parent gateways

func GetGatewayParentRefsFromRoute added in v0.10.0

func GetGatewayParentRefsFromRoute(route *gatewayapiv1.HTTPRoute) []gatewayapiv1.ParentReference

GetGatewayParentRefsFromRoute returns the list of parentRefs that are Gateway typed

func GetGatewayWorkloadSelector

func GetGatewayWorkloadSelector(ctx context.Context, cli client.Client, gateway *gatewayapiv1.Gateway) (map[string]string, error)

func GetRouteAcceptedGatewayParentKeys

func GetRouteAcceptedGatewayParentKeys(route *gatewayapiv1.HTTPRoute) []client.ObjectKey

GetRouteAcceptedGatewayParentKeys returns the object keys of all gateways that have accepted a given route

func GetRouteAcceptedParentRefs

func GetRouteAcceptedParentRefs(route *gatewayapiv1.HTTPRoute) []gatewayapiv1.ParentReference

GetRouteAcceptedParentRefs returns the list of parentRefs for which a given route has the Accepted status condition

func IsCRDInstalled added in v0.11.0

func IsCRDInstalled(restMapper meta.RESTMapper, group, kind, version string) (bool, error)

func IsCertManagerInstalled added in v0.10.0

func IsCertManagerInstalled(restMapper meta.RESTMapper, logger logr.Logger) (bool, error)

func IsGatewayAPIInstalled added in v0.7.1

func IsGatewayAPIInstalled(restMapper meta.RESTMapper) (bool, error)

func IsHTTPRouteAccepted

func IsHTTPRouteAccepted(httpRoute *gatewayapiv1.HTTPRoute) bool

IsHTTPRouteAccepted returns true if a given HTTPRoute has the Accepted status condition added by any of its parentRefs; otherwise, it returns false

func IsNotPolicyAccepted added in v0.7.1

func IsNotPolicyAccepted(policy Policy) bool

func IsParentGateway

func IsParentGateway(ref gatewayapiv1.ParentReference) bool

func IsPolicyAccepted added in v0.7.1

func IsPolicyAccepted(policy Policy) bool

func IsTargetRefGateway

func IsTargetRefGateway(targetRef gatewayapiv1alpha2.LocalPolicyTargetReference) bool

func IsTargetRefHTTPRoute

func IsTargetRefHTTPRoute(targetRef gatewayapiv1alpha2.LocalPolicyTargetReference) bool

func TargetHostnames

func TargetHostnames(targetNetworkObject client.Object) []string

TargetHostnames returns an array of hostnames coming from the network object (HTTPRoute, Gateway)

Types

type GatewayNode

type GatewayNode struct {
	// contains filtered or unexported fields
}

func (*GatewayNode) AttachedPolicies

func (g *GatewayNode) AttachedPolicies() []PolicyNode

func (*GatewayNode) GetGateway added in v0.10.0

func (g *GatewayNode) GetGateway() *gatewayapiv1.Gateway

func (*GatewayNode) GetGatewayNode added in v0.10.0

func (g *GatewayNode) GetGatewayNode() *GatewayNode

func (*GatewayNode) GetObject added in v0.11.0

func (g *GatewayNode) GetObject() client.Object

func (*GatewayNode) GetRouteNode added in v0.10.0

func (g *GatewayNode) GetRouteNode() *RouteNode

func (GatewayNode) ID added in v0.10.0

func (g GatewayNode) ID() dag.NodeID

func (*GatewayNode) ObjectKey

func (g *GatewayNode) ObjectKey() client.ObjectKey

func (*GatewayNode) Routes

func (g *GatewayNode) Routes() []RouteNode

type Policy

type Policy interface {
	client.Object
	PolicyClass() PolicyClass
	GetTargetRef() gatewayapiv1alpha2.LocalPolicyTargetReference
	GetStatus() PolicyStatus
}

type PolicyByCreationTimestamp

type PolicyByCreationTimestamp []Policy

func (PolicyByCreationTimestamp) Len

func (PolicyByCreationTimestamp) Less

func (a PolicyByCreationTimestamp) Less(i, j int) bool

func (PolicyByCreationTimestamp) Swap

func (a PolicyByCreationTimestamp) Swap(i, j int)

type PolicyByTargetRefKindAndAcceptedStatus added in v0.10.0

type PolicyByTargetRefKindAndAcceptedStatus []Policy

func (PolicyByTargetRefKindAndAcceptedStatus) Len added in v0.10.0

func (PolicyByTargetRefKindAndAcceptedStatus) Less added in v0.10.0

func (PolicyByTargetRefKindAndAcceptedStatus) Swap added in v0.10.0

type PolicyByTargetRefKindAndCreationTimeStamp

type PolicyByTargetRefKindAndCreationTimeStamp []Policy

func (PolicyByTargetRefKindAndCreationTimeStamp) Len

func (PolicyByTargetRefKindAndCreationTimeStamp) Less

func (PolicyByTargetRefKindAndCreationTimeStamp) Swap

type PolicyClass

type PolicyClass int
const (
	DirectPolicy PolicyClass = iota
	InheritedPolicy
)

type PolicyNode added in v0.10.0

type PolicyNode struct {
	// contains filtered or unexported fields
}

func (*PolicyNode) GetPolicy added in v0.10.0

func (p *PolicyNode) GetPolicy() Policy

func (PolicyNode) ID added in v0.10.0

func (p PolicyNode) ID() dag.NodeID

func (*PolicyNode) TargetRef added in v0.10.0

func (p *PolicyNode) TargetRef() PolicyTargetNode

type PolicyStatus

type PolicyStatus interface {
	GetConditions() []metav1.Condition
}

type PolicyTargetNode added in v0.10.0

type PolicyTargetNode interface {
	GetGatewayNode() *GatewayNode
	GetRouteNode() *RouteNode
	GetObject() client.Object
	AttachedPolicies() []PolicyNode
}

type PolicyType added in v0.10.0

type PolicyType interface {
	GetGVK() schema.GroupVersionKind
	GetInstance() client.Object
	GetList(context.Context, client.Client, ...client.ListOption) ([]Policy, error)
	BackReferenceAnnotationName() string
	DirectReferenceAnnotationName() string
}

type RouteNode

type RouteNode struct {
	// contains filtered or unexported fields
}

func (*RouteNode) AttachedPolicies

func (r *RouteNode) AttachedPolicies() []PolicyNode

func (*RouteNode) GetGatewayNode added in v0.10.0

func (r *RouteNode) GetGatewayNode() *GatewayNode

func (*RouteNode) GetObject added in v0.11.0

func (r *RouteNode) GetObject() client.Object

func (*RouteNode) GetRouteNode added in v0.10.0

func (r *RouteNode) GetRouteNode() *RouteNode

func (RouteNode) ID added in v0.10.0

func (h RouteNode) ID() dag.NodeID

func (*RouteNode) ObjectKey added in v0.10.0

func (r *RouteNode) ObjectKey() client.ObjectKey

func (*RouteNode) Route

func (r *RouteNode) Route() *gatewayapiv1.HTTPRoute

type Topology

type Topology struct {
	Logger logr.Logger
	// contains filtered or unexported fields
}

Topology defines a graph with Gateway API entities. Contains GatewayNodes (Gateway API gateways) Contains RouteNodes (Gateway API httproutes) Contains PolicyNodes (Gateway API policy attachment objects) Hierarchy is as follows. GatewayNode children can be either RouteNode or PolicyNode nodes RouteNode children are PolicyNode nodes PolicyNode parents can be either RouteNode or GatewayNode nodes

func NewTopology

func NewTopology(opts ...TopologyOpts) (*Topology, error)

func (*Topology) Gateways

func (g *Topology) Gateways() []GatewayNode

func (*Topology) GetPolicy added in v0.10.0

func (g *Topology) GetPolicy(policy Policy) (PolicyNode, bool)

func (*Topology) Policies added in v0.10.0

func (g *Topology) Policies() []PolicyNode

func (*Topology) Routes

func (g *Topology) Routes() []RouteNode

type TopologyIndexes

type TopologyIndexes struct {
	// contains filtered or unexported fields
}

func NewTopologyIndexes

func NewTopologyIndexes(t *Topology) *TopologyIndexes

func (*TopologyIndexes) GetPolicyHTTPRoute

func (k *TopologyIndexes) GetPolicyHTTPRoute(policy Policy) *gatewayapiv1.HTTPRoute

GetPolicyHTTPRoute returns the HTTPRoute being targeted by the policy. The method only returns existing and accepted (by parent gateways) HTTPRoutes Type: Policy -> HTTPRoute

func (*TopologyIndexes) GetPolicyTargetObject added in v0.11.0

func (k *TopologyIndexes) GetPolicyTargetObject(policy Policy) client.Object

GetPolicyTargetObject returns the client.Object targeted by the policy. Type: Policy -> client.Object

func (*TopologyIndexes) GetUntargetedRoutes

func (k *TopologyIndexes) GetUntargetedRoutes(gateway *gatewayapiv1.Gateway) []*gatewayapiv1.HTTPRoute

GetUntargetedRoutes returns the HTTPRoutes not targeted by any kuadrant policy having the gateway given as input as parent. Gateway -> []HTTPRoute

func (*TopologyIndexes) PoliciesFromGateway

func (k *TopologyIndexes) PoliciesFromGateway(gateway *gatewayapiv1.Gateway) []Policy

PoliciesFromGateway returns Kuadrant Policies which directly or indirectly are targeting the gateway given as input. Type: Gateway -> []Policy

func (*TopologyIndexes) String

func (k *TopologyIndexes) String() string

String representation of the topology This is not designed to be a serialization format that could be deserialized

type TopologyOpts

type TopologyOpts func(*topologyOptions)

TopologyOpts allows to manipulate topologyOptions.

func WithAcceptedRoutesLinkedOnly added in v0.10.0

func WithAcceptedRoutesLinkedOnly() TopologyOpts

func WithGateways

func WithGateways(gateways []*gatewayapiv1.Gateway) TopologyOpts

func WithLogger

func WithLogger(logger logr.Logger) TopologyOpts

func WithPolicies

func WithPolicies(policies []Policy) TopologyOpts

func WithProgrammedGatewaysOnly added in v0.10.0

func WithProgrammedGatewaysOnly() TopologyOpts

func WithRoutes

func WithRoutes(routes []*gatewayapiv1.HTTPRoute) TopologyOpts

type Type added in v0.10.0

type Type interface {
	GetGVK() schema.GroupVersionKind
	GetInstance() client.Object
}

func NewGatewayType added in v0.10.0

func NewGatewayType() Type

func NewHTTPRouteType added in v0.10.0

func NewHTTPRouteType() Type

Jump to

Keyboard shortcuts

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