policyengine

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

policyengine package handles policies that govern ClusterLink behavior

Index

Constants

View Source
const (
	LbType     = "lb"     // Type for load-balancing policies
	AccessType = "access" // Type for access policies

	ServiceNameLabel = "clusterlink/metadata.serviceName"
	GatewayNameLabel = "clusterlink/metadata.gatewayName"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LBPolicy

type LBPolicy struct {
	ServiceSrc  string
	ServiceDst  string
	Scheme      LBScheme
	DefaultPeer string
}

LBPolicy is being used by the CRUD interface, and is now deprecated.

type LBScheme

type LBScheme string
const (
	Random     LBScheme = "random"
	RoundRobin LBScheme = "round-robin"
	Static     LBScheme = "static"
)

type LoadBalancer

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

func NewLoadBalancer

func NewLoadBalancer() *LoadBalancer

NewLoadBalancer returns a new instance of a LoadBalancer object.

func (*LoadBalancer) AddImport added in v0.1.0

func (lb *LoadBalancer) AddImport(imp *crds.Import)

AddImport adds a new remote service for the load balancer to take decisions on.

func (*LoadBalancer) DeleteImport added in v0.1.0

func (lb *LoadBalancer) DeleteImport(impName types.NamespacedName)

DeleteImport removes a remote service from the list of services the load balancer reasons about.

func (*LoadBalancer) DeletePolicy

func (lb *LoadBalancer) DeletePolicy(lbPolicy *LBPolicy) error

DeletePolicy is being used by the CRUD interface and is now deprecated.

func (*LoadBalancer) GetSvcSources added in v0.1.0

func (lb *LoadBalancer) GetSvcSources(svc types.NamespacedName) ([]crds.ImportSource, error)

GetSvcSources returns all known sources for a given service in a slice of ImportSource objects.

func (*LoadBalancer) LookupWith

func (lb *LoadBalancer) LookupWith(svc types.NamespacedName, svcSrcs []crds.ImportSource) (*crds.ImportSource, error)

LookupWith decides which service-source to use for a given outgoing-connection request. The decision is based on the policy set for the service, and on its locally stored state.

func (*LoadBalancer) SetPolicy

func (lb *LoadBalancer) SetPolicy(lbPolicy *LBPolicy) error

SetPolicy is being used by the CRUD interface and is now deprecated.

type PolicyDecider

type PolicyDecider interface {
	AddLBPolicy(policy *api.Policy) error
	DeleteLBPolicy(policy *api.Policy) error

	AddAccessPolicy(policy *api.Policy) error
	DeleteAccessPolicy(policy *api.Policy) error

	AuthorizeAndRouteConnection(connReq *connectivitypdp.ConnectionRequest) (connectivitypdp.ConnectionResponse, error)

	AddPeer(name string)
	DeletePeer(name string)

	AddImport(imp *crds.Import)
	DeleteImport(name types.NamespacedName)

	AddExport(exp *crds.Export) ([]string, error) // Returns a list of peers to which export is allowed
	DeleteExport(name string)
}

PolicyDecider is an interface for entities that make policy-based decisions on various ClusterLink operations.

func NewPolicyHandler

func NewPolicyHandler() PolicyDecider

type PolicyHandler

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

PolicyHandler implements PolicyDecider using Connectivity Policies and Load-Balancing Policies.

func (*PolicyHandler) AddAccessPolicy

func (pH *PolicyHandler) AddAccessPolicy(policy *api.Policy) error

func (*PolicyHandler) AddExport

func (pH *PolicyHandler) AddExport(_ *crds.Export) ([]string, error)

func (*PolicyHandler) AddImport

func (pH *PolicyHandler) AddImport(imp *crds.Import)

func (*PolicyHandler) AddLBPolicy

func (pH *PolicyHandler) AddLBPolicy(policy *api.Policy) error

func (*PolicyHandler) AddPeer

func (pH *PolicyHandler) AddPeer(name string)

func (*PolicyHandler) AuthorizeAndRouteConnection

func (pH *PolicyHandler) AuthorizeAndRouteConnection(req *connectivitypdp.ConnectionRequest) (
	connectivitypdp.ConnectionResponse,
	error,
)

func (*PolicyHandler) DeleteAccessPolicy

func (pH *PolicyHandler) DeleteAccessPolicy(policy *api.Policy) error

func (*PolicyHandler) DeleteExport

func (pH *PolicyHandler) DeleteExport(_ string)

func (*PolicyHandler) DeleteImport

func (pH *PolicyHandler) DeleteImport(name types.NamespacedName)

func (*PolicyHandler) DeleteLBPolicy

func (pH *PolicyHandler) DeleteLBPolicy(policy *api.Policy) error

func (*PolicyHandler) DeletePeer

func (pH *PolicyHandler) DeletePeer(name string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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