types

package
v1.6.2-rc Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationK8sPrefix = "k8s.volcengine.com/"

	AnnotationTrunkENI              = AnnotationK8sPrefix + "trunk-eni"
	AnnotationPodNetworksDefinition = AnnotationK8sPrefix + "pod-networks-definition"
	AnnotationVKEPodNetworks        = AnnotationK8sPrefix + "pod-networks"
)
View Source
const (
	PodNetworkModeENIShare     = "eni_shared"
	PodNetworkModeENIExclusive = "eni_exclusive"
)
View Source
const (
	NetResourceTypeEni   = "eni"
	NetResourceTypeEniIp = "eniIp"
)

NetResourceType

View Source
const (
	IPFamilyIPv4 = "ipv4"
	IPFamilyIPv6 = "ipv6"
	IPFamilyDual = "dual"
)
View Source
const (
	AnnotationVolcEnginePrefix = "vke.volcengine.com/"
	LabelNodeDynamicConfigKey  = AnnotationVolcEnginePrefix + "vpc-cni-config"
	EvictionPolicyAnnotation   = AnnotationVolcEnginePrefix + "cello-pod-evict-policy"
	AnnotationTrue             = "true"
	AllowEviction              = "allow"
)
View Source
const (
	// DefaultIfName is the default network interface for the pods
	DefaultIfName = "eth0"
)

Variables

This section is empty.

Functions

func GetNetResourceAllocatedFromPods

func GetNetResourceAllocatedFromPods(pods []*Pod) map[string]map[string]NetResourceAllocated

func PodKey

func PodKey(podNameSpace, podName string) string

Types

type ENI

type ENI struct {
	ID               string
	Mac              net.HardwareAddr
	PrimaryIP        IPSet
	Subnet           Subnet
	SecurityGroupIDs []string
	Trunk            bool // is trunk eni ?
}

ENI with all necessary information about ENI

func (*ENI) GetID

func (e *ENI) GetID() string

func (*ENI) GetType

func (e *ENI) GetType() string

func (*ENI) GetVPCResource

func (e *ENI) GetVPCResource() VPCResource

func (*ENI) String

func (e *ENI) String() string

func (*ENI) ToPb

func (e *ENI) ToPb() *pbrpc.ENI

type ENIIP

type ENIIP struct {
	ENI   *ENI
	IPSet IPSet
}

func (*ENIIP) GetID

func (e *ENIIP) GetID() string

func (*ENIIP) GetType

func (e *ENIIP) GetType() string

func (*ENIIP) GetVPCResource

func (e *ENIIP) GetVPCResource() VPCResource

type IPFamily

type IPFamily string

func (IPFamily) EnableIPv4

func (f IPFamily) EnableIPv4() bool

func (IPFamily) EnableIPv6

func (f IPFamily) EnableIPv6() bool

func (IPFamily) Support

func (f IPFamily) Support(s IPFamily) bool

type IPNetSet

type IPNetSet struct {
	IPv4 *net.IPNet
	IPv6 *net.IPNet
}

func (*IPNetSet) String

func (s *IPNetSet) String() string

func (*IPNetSet) ToPb

func (s *IPNetSet) ToPb() *pbrpc.IPSet

type IPSet

type IPSet struct {
	IPv4 net.IP
	IPv6 net.IP
}

func PairIPs

func PairIPs(ipv4s, ipv6s []net.IP) []IPSet

PairIPs pair ipv4s and ipv6s to IPSet slice

func (*IPSet) GetIPv4

func (s *IPSet) GetIPv4() string

func (*IPSet) GetIPv6

func (s *IPSet) GetIPv6() string

func (*IPSet) String

func (s *IPSet) String() string

func (*IPSet) ToPb

func (s *IPSet) ToPb() *pbrpc.IPSet

func (*IPSet) ToPbWithMask

func (s *IPSet) ToPbWithMask(cidr *IPNetSet) *pbrpc.IPSet

type MockNetResource

type MockNetResource struct {
	ID string
}

func (*MockNetResource) GetID

func (m *MockNetResource) GetID() string

func (*MockNetResource) GetType

func (m *MockNetResource) GetType() string

func (*MockNetResource) GetVPCResource

func (m *MockNetResource) GetVPCResource() VPCResource

type NetResource

type NetResource interface {
	GetID() string
	GetType() string
	GetVPCResource() VPCResource
}

type NetResourceAllocated

type NetResourceAllocated struct {
	Owner    string
	Resource NetResource
}

type NetResourceSnapshot

type NetResourceSnapshot struct {
	VPCResource
	Status ResStatus `json:"status"`
	Owner  string    `json:"owner,omitempty"`
}

func (*NetResourceSnapshot) GetID

func (m *NetResourceSnapshot) GetID() string

func (*NetResourceSnapshot) GetOwner

func (m *NetResourceSnapshot) GetOwner() string

func (*NetResourceSnapshot) GetStatus

func (m *NetResourceSnapshot) GetStatus() ResStatus

func (*NetResourceSnapshot) GetType

func (m *NetResourceSnapshot) GetType() string

func (*NetResourceSnapshot) GetVPCResource

func (m *NetResourceSnapshot) GetVPCResource() VPCResource

type NetResourceStatus

type NetResourceStatus interface {
	NetResource
	GetStatus() ResStatus
	GetOwner() string
}

type Pod

type Pod struct {
	Namespace          string    `json:"nameSpace"`
	Name               string    `json:"name"`
	SandboxContainerId string    `json:"sandboxContainerId"`
	CreateTime         time.Time `json:"createTime,omitempty"`

	NetNs string `json:"netNs,omitempty"`

	AllowEviction bool `json:"allowEviction,omitempty"`
	VpcENI        bool `json:"vpcENI,omitempty"`

	MainInterface             *pbrpc.NetworkInterface   `json:"mainInterface,omitempty"`             // Deprecated
	IsMainInterfaceSharedMode bool                      `json:"isMainInterfaceSharedMode,omitempty"` // Deprecated
	ExtraInterfaces           []*pbrpc.NetworkInterface `json:"extraInterfaces,omitempty"`           // Deprecated
	PodNetworkMode            string                    `json:"podNetworkMode,omitempty"`

	Resources []VPCResource `json:"resources,omitempty"`
}

func (*Pod) GetVPCResourceByType

func (p *Pod) GetVPCResourceByType(rType string) []VPCResource

func (*Pod) String

func (p *Pod) String() string

type PodNetwork

type PodNetwork struct {
	Name       string       `json:"name,omitempty"`
	Namespace  string       `json:"namespace,omitempty"`
	IfName     string       `json:"ifName,omitempty"`
	PodIP      pbrpc.IPSet  `json:"podIP"`
	ExtraIPs   []IPSet      `json:"extraIPs,omitempty"`
	Mac        string       `json:"mac,omitempty"`
	Gateway    pbrpc.IPSet  `json:"gateway,omitempty"`
	Cidr       *pbrpc.IPSet `json:"cidr,omitempty"`
	Route      *Route       `json:"route,omitempty"`
	ENIId      string       `json:"eniId,omitempty"`
	TrunkENIId string       `json:"trunkENIId,omitempty"`
	VlanID     uint32       `json:"vlanID,omitempty"`
}

type ResStatus

type ResStatus string
const (
	ResStatusInUse     ResStatus = "InUse"
	ResStatusAvailable ResStatus = "Available"
	ResStatusInvalid   ResStatus = "Invalid"
	ResStatusNotAdded  ResStatus = "NotAdded"
	ResStatusNormal    ResStatus = "Normal"
	ResStatusLegacy    ResStatus = "Legacy"
)

type Route

type Route struct {
	// Dst means the destination address
	Dst string `json:"dst,omitempty"`
}

type Subnet

type Subnet struct {
	ID         string
	Gateway    *IPSet
	GatewayMac net.HardwareAddr
	CIDR       *IPNetSet
}

func (*Subnet) String

func (s *Subnet) String() string

type TrunkInfo

type TrunkInfo struct {
	EniID       string `json:"eniID"`
	Mac         string `json:"mac"`
	BranchLimit int    `json:"branchLimit"`
}

type VPCResource

type VPCResource struct {
	Type string `json:"type"`
	ID   string `json:"id"`

	ENIId  string `json:"ENIId"`
	ENIMac string `json:"ENIMac"`
	IPv4   string `json:"ipv4,omitempty"`
	IPv6   string `json:"ipv6,omitempty"`
}

VPCResource is network resource of vpc

func (*VPCResource) ToNetResource

func (r *VPCResource) ToNetResource() (res NetResource)

type VPCResourceAllocated

type VPCResourceAllocated struct {
	Owner    string
	Resource VPCResource
}

Jump to

Keyboard shortcuts

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