storage

package
v3.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CniServerStateFileVersion = 8  // Used to ensure compatibility wen we reload data
	MaxApiTagLen              = 63 /* No more than 64 characters in API tags */
	VrfTagHashLen             = 8  /* how many hash charatecters (b64) of the name in tag prefix (useful when trucated) */
)

Variables

This section is empty.

Functions

func PersistCniServerState

func PersistCniServerState(podInterfaceMap map[string]LocalPodSpec, fname string) (err error)

func TruncateStr added in v3.25.1

func TruncateStr(text string, size int) string

Types

type HostPortBinding

type HostPortBinding struct {
	HostPort      uint16
	HostIP        net.IP `struc:"[16]byte"`
	ContainerPort uint16
	EntryID       uint32
	Protocol      types.IPProto
}

XXX: Increment CniServerStateFileVersion when changing this struct

func (*HostPortBinding) String

func (hp *HostPortBinding) String() string

type LocalIP

type LocalIP struct {
	IP net.IP `struc:"[16]byte"`
}

XXX: Increment CniServerStateFileVersion when changing this struct

func (*LocalIP) String

func (n *LocalIP) String() string

type LocalIPNet

type LocalIPNet struct {
	MaskSize int    `struc:"int8,sizeof=Mask"`
	IP       net.IP `struc:"[16]byte"`
	Mask     net.IPMask
}

XXX: Increment CniServerStateFileVersion when changing this struct

func (*LocalIPNet) String

func (n *LocalIPNet) String() string

func (*LocalIPNet) UpdateSizes

func (n *LocalIPNet) UpdateSizes()

type LocalIfPortConfigs

type LocalIfPortConfigs struct {
	Start uint16
	End   uint16
	Proto types.IPProto
}

XXX: Increment CniServerStateFileVersion when changing this struct

func (*LocalIfPortConfigs) String

func (pc *LocalIfPortConfigs) String() string

type LocalPodSpec

type LocalPodSpec struct {
	InterfaceNameSize int `struc:"int16,sizeof=InterfaceName"`
	InterfaceName     string
	NetnsNameSize     int `struc:"int16,sizeof=NetnsName"`
	NetnsName         string
	AllowIpForwarding bool
	RoutesSize        int `struc:"int16,sizeof=Routes"`
	Routes            []LocalIPNet
	ContainerIpsSize  int `struc:"int16,sizeof=ContainerIps"`
	ContainerIps      []LocalIP
	Mtu               int

	// Pod identifiers
	OrchestratorIDSize int `struc:"int16,sizeof=OrchestratorID"`
	OrchestratorID     string
	WorkloadIDSize     int `struc:"int16,sizeof=WorkloadID"`
	WorkloadID         string
	EndpointIDSize     int `struc:"int16,sizeof=EndpointID"`
	EndpointID         string
	// HostPort
	HostPortsSize int `struc:"int16,sizeof=HostPorts"`
	HostPorts     []HostPortBinding

	IfPortConfigsLen int `struc:"int16,sizeof=IfPortConfigs"`
	IfPortConfigs    []LocalIfPortConfigs
	/* This interface type will traffic MATCHING the portConfigs */
	PortFilteredIfType VppInterfaceType
	/* This interface type will traffic not matching portConfigs */
	DefaultIfType VppInterfaceType
	EnableVCL     bool
	EnableMemif   bool

	IfSpec       config.InterfaceSpec
	PBLMemifSpec config.InterfaceSpec

	/**
	 * Below are VPP internal ids, mutable fields in AddVppInterface
	 * We persist them on the disk to avoid rescanning when the agent is restarting.
	 *
	 * We should be careful during state-reconciliation as they might not be
	 * valid anymore. VRF tags should provide this guarantee
	 */
	MemifSocketId     uint32
	TunTapSwIfIndex   uint32
	MemifSwIfIndex    uint32
	LoopbackSwIfIndex uint32
	PblIndexesLen     int `struc:"int16,sizeof=PblIndexes"`
	PblIndexes        []uint32

	/**
	 * These fields are only a runtime cache, but we also store them
	 * on the disk for debugging purposes.
	 */
	V4VrfId   uint32
	V6VrfId   uint32
	NeedsSnat bool

	/* Multi net */
	NetworkNameSize int `struc:"int16,sizeof=NetworkName"`
	NetworkName     string

	/* rpf check */
	AllowedSpoofingPrefixesSize int `struc:"int16,sizeof=AllowedSpoofingPrefixes"`
	AllowedSpoofingPrefixes     string

	V4RPFVrfId uint32
	V6RPFVrfId uint32
}

XXX: Increment CniServerStateFileVersion when changing this struct

func LoadCniServerState

func LoadCniServerState(fname string) ([]LocalPodSpec, error)

func (*LocalPodSpec) Copy

func (ps *LocalPodSpec) Copy() LocalPodSpec

func (*LocalPodSpec) FullString

func (ps *LocalPodSpec) FullString() string

func (*LocalPodSpec) GetBuffersNeeded added in v3.25.1

func (ps *LocalPodSpec) GetBuffersNeeded() uint64

func (*LocalPodSpec) GetContainerIps

func (ps *LocalPodSpec) GetContainerIps() (containerIps []*net.IPNet)

func (*LocalPodSpec) GetInterfaceTag

func (ps *LocalPodSpec) GetInterfaceTag(prefix string) string

func (*LocalPodSpec) GetParamsForIfType

func (ps *LocalPodSpec) GetParamsForIfType(ifType VppInterfaceType) (swIfIndex uint32, isL3 bool)

func (*LocalPodSpec) GetRPFVrfId

func (ps *LocalPodSpec) GetRPFVrfId(ipFamily vpplink.IpFamily) uint32

func (*LocalPodSpec) GetRoutes

func (ps *LocalPodSpec) GetRoutes() (routes []*net.IPNet)

func (*LocalPodSpec) GetVrfId

func (ps *LocalPodSpec) GetVrfId(ipFamily vpplink.IpFamily) uint32

func (*LocalPodSpec) GetVrfTag

func (ps *LocalPodSpec) GetVrfTag(ipFamily vpplink.IpFamily, custom string) string

func (*LocalPodSpec) Hasv46

func (ps *LocalPodSpec) Hasv46() (hasv4 bool, hasv6 bool)

func (*LocalPodSpec) Key

func (ps *LocalPodSpec) Key() string

func (*LocalPodSpec) SetRPFVrfId

func (ps *LocalPodSpec) SetRPFVrfId(id uint32, ipFamily vpplink.IpFamily)

func (*LocalPodSpec) SetVrfId

func (ps *LocalPodSpec) SetVrfId(id uint32, ipFamily vpplink.IpFamily)

func (*LocalPodSpec) String

func (ps *LocalPodSpec) String() string

func (*LocalPodSpec) UpdateSizes

func (ps *LocalPodSpec) UpdateSizes()

type SavedState

type SavedState struct {
	Version    int `struc:"int32"`
	SpecsCount int `struc:"int32,sizeof=Specs"`
	Specs      []LocalPodSpec
}

type VppInterfaceType

type VppInterfaceType uint8
const (
	VppIfTypeUnknown VppInterfaceType = iota
	VppIfTypeTunTap
	VppIfTypeMemif
	VppIfTypeVCL
)

func (VppInterfaceType) String

func (ift VppInterfaceType) String() string

Jump to

Keyboard shortcuts

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