policy

package
v0.18.1-calicov3.21.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Apache-2.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FelixPluginSrcPath = "/bin/felix-api-proxy"
	FelixPluginDstPath = "/var/lib/calico/felix-plugins/felix-api-proxy"
)

Variables

This section is empty.

Functions

func InstallFelixPlugin

func InstallFelixPlugin() (err error)

Types

type HostEndpoint

type HostEndpoint struct {
	UplinkSwIfIndexes []uint32
	TapSwIfIndexes    []uint32
	TunnelSwIfIndexes []uint32
	Profiles          []string
	Tiers             []Tier
	ForwardTiers      []Tier

	InterfaceName string
	// contains filtered or unexported fields
}

func (*HostEndpoint) Create

func (h *HostEndpoint) Create(vpp *vpplink.VppLink, state *PolicyState) (err error)

func (*HostEndpoint) Delete

func (h *HostEndpoint) Delete(vpp *vpplink.VppLink) (err error)

func (*HostEndpoint) String

func (he *HostEndpoint) String() string

func (*HostEndpoint) Update

func (h *HostEndpoint) Update(vpp *vpplink.VppLink, new *HostEndpoint, state *PolicyState) (err error)

type HostEndpointID

type HostEndpointID struct {
	EndpointID string
}

type IPSet

type IPSet struct {
	VppID     uint32
	Type      types.IpsetType
	IPPorts   []types.IPPort
	Addresses []net.IP
	Networks  []*net.IPNet
}

func (*IPSet) AddMembers

func (i *IPSet) AddMembers(members []string, apply bool, vpp *vpplink.VppLink) (err error)

func (*IPSet) Create

func (i *IPSet) Create(vpp *vpplink.VppLink) (err error)

func (*IPSet) Delete

func (i *IPSet) Delete(vpp *vpplink.VppLink) (err error)

func (*IPSet) RemoveMembers

func (i *IPSet) RemoveMembers(members []string, apply bool, vpp *vpplink.VppLink) (err error)

type Policy

type Policy struct {
	*types.Policy
	VppID         uint32
	InboundRules  []*Rule
	OutboundRules []*Rule
}

Policy represents both Policies and Profiles in the calico API

func (*Policy) Create

func (p *Policy) Create(vpp *vpplink.VppLink, state *PolicyState) (err error)

func (*Policy) Delete

func (p *Policy) Delete(vpp *vpplink.VppLink, state *PolicyState) (err error)

func (*Policy) Update

func (p *Policy) Update(vpp *vpplink.VppLink, new *Policy, state *PolicyState) (err error)

Apply any changes to VPP and update this policy to new

type PolicyID

type PolicyID struct {
	Tier string
	Name string
}

type PolicyState

type PolicyState struct {
	IPSets            map[string]*IPSet
	Policies          map[PolicyID]*Policy
	Profiles          map[string]*Policy
	WorkloadEndpoints map[WorkloadEndpointID]*WorkloadEndpoint
	HostEndpoints     map[HostEndpointID]*HostEndpoint
}

func NewPolicyState

func NewPolicyState() *PolicyState

type Rule

type Rule struct {
	*types.Rule

	RuleID string
	VppID  uint32

	DstIPPortIPSetNames    []string
	DstNotIPPortIPSetNames []string
	SrcIPPortIPSetNames    []string
	SrcNotIPPortIPSetNames []string

	DstIPSetNames    []string
	DstNotIPSetNames []string
	SrcIPSetNames    []string
	SrcNotIPSetNames []string

	DstIPPortSetNames []string
}

func (*Rule) Create

func (r *Rule) Create(vpp *vpplink.VppLink, state *PolicyState) (err error)

func (*Rule) Delete

func (r *Rule) Delete(vpp *vpplink.VppLink) (err error)

type Server

type Server struct {
	*common.CalicoVppServerData
	// contains filtered or unexported fields
}

Server holds all the data required to configure the policies defined by felix in VPP

func NewPolicyServer

func NewPolicyServer(vpp *vpplink.VppLink, log *logrus.Entry) (*Server, error)

NewServer creates a policy server

func (*Server) HandlePolicyServerEvents

func (s *Server) HandlePolicyServerEvents() error

func (*Server) MessageReader

func (s *Server) MessageReader(conn net.Conn) <-chan interface{}

func (*Server) OnVppRestart

func (s *Server) OnVppRestart()

OnVppRestart notifies the policy server that vpp restarted

func (*Server) RecvMessage

func (s *Server) RecvMessage(conn net.Conn) (msg interface{}, err error)

func (*Server) SendMessage

func (s *Server) SendMessage(conn net.Conn, msg interface{}) (err error)

func (*Server) ServePolicy

func (s *Server) ServePolicy(t *tomb.Tomb) error

Serve runs the policy server

func (*Server) SetOurBGPSpec

func (s *Server) SetOurBGPSpec(nodeBGPSpec *oldv3.NodeBGPSpec)

func (*Server) SyncPolicy

func (s *Server) SyncPolicy(conn net.Conn)

SyncPolicy does the bulk of the policy sync job. It starts by reconciling the current configured state in VPP (empty at first) with what is sent by felix, and once both are in sync, it keeps processing felix updates. It also sends endpoint updates to felix when the CNI component adds or deletes container interfaces.

func (*Server) WorkloadRemoved

func (s *Server) WorkloadRemoved(id *WorkloadEndpointID, containerIPs []*net.IPNet)

WorkloadRemoved is called by the CNI server when the interface of a pod is deleted

type SyncState

type SyncState int
const (
	StateDisconnected SyncState = iota
	StateConnected
	StateSyncing
	StateInSync
)

type Tier

type Tier struct {
	Name            string
	IngressPolicies []string
	EgressPolicies  []string
}

type WorkloadEndpoint

type WorkloadEndpoint struct {
	SwIfIndex uint32
	Profiles  []string
	Tiers     []Tier
	// contains filtered or unexported fields
}

func (*WorkloadEndpoint) Create

func (w *WorkloadEndpoint) Create(vpp *vpplink.VppLink, swIfIndex uint32, state *PolicyState) (err error)

func (*WorkloadEndpoint) Delete

func (w *WorkloadEndpoint) Delete(vpp *vpplink.VppLink) (err error)

func (*WorkloadEndpoint) String

func (we *WorkloadEndpoint) String() string

func (*WorkloadEndpoint) Update

func (w *WorkloadEndpoint) Update(vpp *vpplink.VppLink, new *WorkloadEndpoint, state *PolicyState) (err error)

type WorkloadEndpointID

type WorkloadEndpointID struct {
	OrchestratorID string
	WorkloadID     string
	EndpointID     string
}

func (*WorkloadEndpointID) String

func (wi *WorkloadEndpointID) String() string

Jump to

Keyboard shortcuts

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