gatewayapi

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 16 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 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 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.PolicyTargetReference) bool

func IsTargetRefHTTPRoute

func IsTargetRefHTTPRoute(targetRef gatewayapiv1alpha2.PolicyTargetReference) 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 {
	*gatewayapiv1.Gateway
	// contains filtered or unexported fields
}

func (*GatewayNode) AttachedPolicies

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

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.PolicyTargetReference
	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 PolicyByTargetRefKindAndCreationTimeStamp

type PolicyByTargetRefKindAndCreationTimeStamp []Policy

func (PolicyByTargetRefKindAndCreationTimeStamp) Len

func (PolicyByTargetRefKindAndCreationTimeStamp) Less

func (PolicyByTargetRefKindAndCreationTimeStamp) Swap

type PolicyClass

type PolicyClass int
const (
	DirectPolicy PolicyClass = iota
	InheritedPolicy
)

type PolicyStatus

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

type RouteNode

type RouteNode struct {
	*gatewayapiv1.HTTPRoute
	// contains filtered or unexported fields
}

func (*RouteNode) AttachedPolicies

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

func (*RouteNode) Route

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

type Topology

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

func NewTopology

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

func (*Topology) Gateways

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

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) 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 WithGateways

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

func WithLogger

func WithLogger(logger logr.Logger) TopologyOpts

func WithPolicies

func WithPolicies(policies []Policy) TopologyOpts

func WithRoutes

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

Jump to

Keyboard shortcuts

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