model

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	// Name is the unique identity of endpoint
	Name string
	// Labels are key/value pairs that are attached to an endpoint.
	// Multiple values can be associated with the same key.
	Labels map[string][]string

	// The endpoint expect IP addr from the subnet
	ExpectSubnet string
	// Virtual network identifier, update VID not supported.
	// VID must between 0-4095 when network is vlan.
	VID int
	// Expose tcp port. TODO: support tcp-ports
	TCPPort int
	// Expose udp port. TODO: support udp-ports
	UDPPort int
	// protoco beyond tcp udp
	Proto string

	// Status of endpoint, should managed by the endpoint provider
	Status *EndpointStatus
}

Endpoint is a network communication entity. It's provided by the endpoint provider, it could be a virtual machine, a pod, an ovs port or other entities.

type EndpointExecutor

type EndpointExecutor interface {
	RunScript(ctx context.Context, name string, script []byte, arg ...string) (int, []byte, error)

	RunCommand(ctx context.Context, name string, cmd string, arg ...string) (int, []byte, error)
}

EndpointExecutor know how to execute command in the endpoint.

type EndpointLister

type EndpointLister interface {
	Get(ctx context.Context, name string) (*Endpoint, error)

	List(ctx context.Context) ([]*Endpoint, error)
}

EndpointLister know how to list and get endpoint from store.

type EndpointOperator

type EndpointOperator interface {
	Create(ctx context.Context, endpoint *Endpoint) (*Endpoint, error)

	Update(ctx context.Context, endpoint *Endpoint) (*Endpoint, error)

	Delete(ctx context.Context, name string) error

	RenewIP(ctx context.Context, name string) (*Endpoint, error)

	Migrate(ctx context.Context, name string) (*Endpoint, error)
}

EndpointOperator know how to create, delete or update state of endpoint.

type EndpointProvider

type EndpointProvider interface {
	Name() string
	EndpointLister
	EndpointOperator
	EndpointExecutor
}

EndpointProvider provides an interface to manage the lifecycle of the endpoint. It should be a stateless application, which means it should not keep any state in the instance.

type EndpointStatus

type EndpointStatus struct {
	// IPAddr of the endpoint, should include subnet mask
	IPAddr string
	// The name of the host where the endpoint is located
	Host string
	// LocalID is the endpoint unique identity on host
	LocalID string
}

func (*EndpointStatus) GetIP

func (es *EndpointStatus) GetIP() string

func (*EndpointStatus) String

func (es *EndpointStatus) String() string

type GlobalPolicyProvider

type GlobalPolicyProvider interface {
	Name() string
	SetDefaultAction(ctx context.Context, action securityv1alpha1.GlobalDefaultAction) error
}

GlobalPolicyProvider provides an interface to manage GlobalPolicy behavior

type TruthTable

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

TruthTable takes in n items and maintains an n x n table of booleans for each ordered pair This is forked from k8s.io/kubernetes/test/e2e/network/netpol.TruthTable

func NewTruthTable

func NewTruthTable(froms []string, tos []string, defaultValue *bool) *TruthTable

NewTruthTable creates a new truth table with froms and tos

func NewTruthTableFromItems

func NewTruthTableFromItems(items []string, defaultValue *bool) *TruthTable

NewTruthTableFromItems creates a new truth table with items

func (*TruthTable) Compare

func (tt *TruthTable) Compare(other *TruthTable) *TruthTable

Compare is used to check two truth tables for equality, returning its result in the form of a third truth table. Both tables are expected to have identical items.

func (*TruthTable) CompareResultBool

func (tt *TruthTable) CompareResultBool(other *TruthTable, ignoreLoopback bool) bool

CompareResultBool is used to check two truth tables for equality, return true when equality. IgnoreLoopback would ignore lookback equality.

func (*TruthTable) Get

func (tt *TruthTable) Get(from string, to string) bool

Get gets the specified value

func (*TruthTable) IsComplete

func (tt *TruthTable) IsComplete() bool

IsComplete returns true if there's a value set for every single pair of items, otherwise it returns false.

func (*TruthTable) PrettyPrint

func (tt *TruthTable) PrettyPrint(withColor bool) string

PrettyPrint produces a nice visual representation.

func (*TruthTable) Set

func (tt *TruthTable) Set(from string, to string, value bool)

Set sets the value for from->to

func (*TruthTable) SetAllFrom

func (tt *TruthTable) SetAllFrom(from string, value bool)

SetAllFrom sets all values where from = 'from'

func (*TruthTable) SetAllTo

func (tt *TruthTable) SetAllTo(to string, value bool)

SetAllTo sets all values where to = 'to'

Jump to

Keyboard shortcuts

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