types

package
v1.8.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TagKeyClusterID = "ack.aliyun.com"

	// NetworkInterfaceTagCreatorKey denotes the creator tag's key of network interface
	NetworkInterfaceTagCreatorKey = "creator"
	// NetworkInterfaceTagCreatorValue denotes the creator tag's value of network interface
	NetworkInterfaceTagCreatorValue = "terway"

	// TagTerwayController terway controller
	TagTerwayController = "terway-controller"

	TagENIAllocPolicy = "eni-alloc-policy"

	TagK8SNodeName = "node-name"

	TagKubernetesPodName      = "k8s_pod_name"
	TagKubernetesPodNamespace = "k8s_pod_namespace"
)

this keys is used in alibabacloud resource

View Source
const (
	// TrunkOn is the key for eni
	TrunkOn = AnnotationPrefix + "trunk-on"

	// PodENI whether pod is using podENI cr resource
	PodENI        = AnnotationPrefix + "pod-eni"
	PodNetworking = AnnotationPrefix + "pod-networking"

	// PodIPReservation whether pod's IP will be reserved for a reuse
	PodIPReservation = AnnotationPrefix + "pod-ip-reservation"

	// PodNetworks for additional net config
	PodNetworks = AnnotationPrefix + "pod-networks"

	// PodAllocType for additional net config
	PodAllocType = AnnotationPrefix + "pod-alloc-type"

	// PodENIAllocated pod annotation for allocated eni
	PodENIAllocated = AnnotationPrefix + "allocated"

	// PodUID store pod uid
	PodUID = AnnotationPrefix + "pod-uid"

	// NetworkPriority set pod network priority
	NetworkPriority = AnnotationPrefix + "network-priority"

	ENIAllocFromPool   = AnnotationPrefix + "eni-alloc-from-pool"
	ENIRelatedNodeName = AnnotationPrefix + "node"

	PodIPs = AnnotationPrefix + "pod-ips"

	// IgnoreByTerway if the label exist , terway will not handle this kind of res
	IgnoreByTerway = LabelPrefix + "ignore-by-terway"
)

annotations used by terway

View Source
const (
	EventCreateENISucceed = "CreateENISucceed"

	EventCreateENIFailed  = "CreateENIFailed"
	EventAttachENISucceed = "AttachENISucceed"
	EventAttachENIFailed  = "AttachENIFailed"
	EventDetachENISucceed = "DetachENISucceed"
	EventDetachENIFailed  = "DetachENIFailed"
	EventDeleteENISucceed = "DeleteENISucceed"
	EventDeleteENIFailed  = "DeleteENIFailed"

	EventUpdatePodENIFailed = "UpdatePodENIFailed"

	EventSyncPodNetworkingSucceed = "SyncPodNetworkingSucceed"
	EventSyncPodNetworkingFailed  = "SyncPodNetworkingFailed"
)

events for control plane

View Source
const (
	SufficientIPCondition   corev1.NodeConditionType = "SufficientIP"
	IPResInsufficientReason string                   = "InsufficientIP"
	IPResSufficientReason   string                   = "SufficientIP"
)

SufficientIPCondition definitions

View Source
const (
	IPAMTypeCRD       = "crd"
	IPAMTypePreferCRD = "preferCRD"
	IPAMTypeDefault   = ""
)

how terway deal with ip resource

View Source
const AnnotationPrefix = "k8s.aliyun.com/"

AnnotationPrefix is the annotation prefix

View Source
const FinalizerPodENI = "pod-eni"

FinalizerPodENI finalizer for podENI resource

View Source
const LabelPrefix = "k8s.aliyun.com/"

Variables

View Source
var Scheme = runtime.NewScheme()

Functions

func DisableFeature added in v1.8.0

func DisableFeature(features *Feat, feature Feat)

func EnableFeature added in v1.8.0

func EnableFeature(features *Feat, feature Feat)

func IgnoredByTerway added in v1.5.5

func IgnoredByTerway(labels map[string]string) bool

IgnoredByTerway for both pods and nodes

func IsFeatureEnabled added in v1.8.0

func IsFeatureEnabled(features Feat, feature Feat) bool

func NewRESTMapper added in v1.6.0

func NewRESTMapper() meta.RESTMapper

func PodUseENI added in v1.1.0

func PodUseENI(pod *corev1.Pod) bool

PodUseENI whether pod is use podENI cr res

Types

type ENIConfig added in v1.8.0

type ENIConfig struct {
	ZoneID           string
	VSwitchOptions   []string
	ENITags          map[string]string
	SecurityGroupIDs []string
	InstanceID       string

	VSwitchSelectionPolicy vswitch.SelectionPolicy

	ResourceGroupID string

	EniTypeAttr Feat

	EnableIPv4 bool
	EnableIPv6 bool
}

type ErrCode added in v1.7.0

type ErrCode string
const (
	ErrInternalError      ErrCode = "InternalError"
	ErrInvalidArgsErrCode ErrCode = "InvalidArgs"
	ErrInvalidDataType    ErrCode = "InvalidDataType"

	ErrPodIsProcessing ErrCode = "PodIsProcessing"

	ErrResourceInvalid ErrCode = "ResourceInvalid"

	ErrOpenAPIErr     ErrCode = "OpenAPIErr"
	ErrPodENINotReady ErrCode = "PodENINotReady"

	ErrIPOutOfSyncErr ErrCode = "OutIPOfSync"
)

type Error added in v1.7.0

type Error struct {
	Code ErrCode
	Msg  string

	R error
}

func (*Error) Error added in v1.7.0

func (e *Error) Error() string

func (*Error) Unwrap added in v1.7.0

func (e *Error) Unwrap() error

type Feat added in v1.8.0

type Feat uint8
const (
	FeatTrunk Feat = 1 << iota
	FeatERDMA
)

type IPAMType added in v1.2.0

type IPAMType string

IPAMType how terway deal with ip resource

type IPInsufficientError added in v1.5.7

type IPInsufficientError struct {
	Err    error
	Reason string
}

func (*IPInsufficientError) Error added in v1.5.7

func (e *IPInsufficientError) Error() string

type IPNetSet added in v1.1.0

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

func BuildIPNet added in v1.1.0

func BuildIPNet(ip, subnet *rpc.IPSet) (*IPNetSet, error)

func ToIPNetSet added in v1.1.0

func ToIPNetSet(ip *rpc.IPSet) (*IPNetSet, error)

func (*IPNetSet) SetIPNet added in v1.1.0

func (i *IPNetSet) SetIPNet(str string) *IPNetSet

func (*IPNetSet) String added in v1.1.0

func (i *IPNetSet) String() string

func (*IPNetSet) ToRPC added in v1.1.0

func (i *IPNetSet) ToRPC() *rpc.IPSet

type IPSet added in v1.1.0

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

IPSet is the type hole both ipv4 and ipv6 net.IP

func ToIPSet added in v1.1.0

func ToIPSet(ip *rpc.IPSet) (*IPSet, error)

func (*IPSet) GetIPv4 added in v1.1.0

func (i *IPSet) GetIPv4() string

func (*IPSet) GetIPv6 added in v1.1.0

func (i *IPSet) GetIPv6() string

func (*IPSet) SetIP added in v1.1.0

func (i *IPSet) SetIP(str string) *IPSet

func (*IPSet) String added in v1.1.0

func (i *IPSet) String() string

func (*IPSet) ToRPC added in v1.1.0

func (i *IPSet) ToRPC() *rpc.IPSet

type IPSet2 added in v1.7.0

type IPSet2 struct {
	IPv4 netip.Addr
	IPv6 netip.Addr
}

func (*IPSet2) GetIPv4 added in v1.7.0

func (i *IPSet2) GetIPv4() string

func (*IPSet2) GetIPv6 added in v1.7.0

func (i *IPSet2) GetIPv6() string

func (*IPSet2) String added in v1.7.0

func (i *IPSet2) String() string

func (*IPSet2) ToRPC added in v1.7.0

func (i *IPSet2) ToRPC() *rpc.IPSet

type IPStack added in v1.1.0

type IPStack string

IPStack is the ip family type

const (
	IPStackIPv4 IPStack = "ipv4"
	IPStackDual IPStack = "dual"
	IPStackIPv6 IPStack = "ipv6"
)

IPStack is the ip family type

type NetworkPrio added in v1.3.0

type NetworkPrio string

NetworkPrio network priority for pod

const (
	NetworkPrioBestEffort NetworkPrio = "best-effort"
	NetworkPrioBurstable  NetworkPrio = "burstable"
	NetworkPrioGuaranteed NetworkPrio = "guaranteed"
)

NetworkPrio val

type PodIPTypeIPs added in v1.5.7

type PodIPTypeIPs string

PodIPTypeIPs Pod IP address type

const (
	NormalIPTypeIPs    PodIPTypeIPs = AnnotationPrefix + "max-available-ip"
	MemberENIIPTypeIPs PodIPTypeIPs = AnnotationPrefix + "max-member-eni-ip"
	ERDMAIPTypeIPs     PodIPTypeIPs = AnnotationPrefix + "max-erdma-ip"
)

PodIPTypeIPs val

type PoolConfig

type PoolConfig struct {
	EnableIPv4 bool
	EnableIPv6 bool

	Capacity      int // the max res can hold in the pool
	MaxENI        int // the max eni terway can be created (already exclude main eni)
	MaxMemberENI  int // the max member eni can be created
	ERdmaCapacity int // the max erdma res can be created
	MaxIPPerENI   int
	BatchSize     int

	MaxPoolSize int
	MinPoolSize int
}

PoolConfig configuration of pool and resource factory

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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