Documentation
¶
Index ¶
- Constants
- func AreEqualMTUs(MTU1, MTU2 int) bool
- func EnsureSysctlValue(name, value string) error
- func FilterFirstActiveStorageNetworkNad(nads []*nadv1.NetworkAttachmentDefinition) *nadv1.NetworkAttachmentDefinition
- func GetMTUFromAnnotation(annotation string) (int, error)
- func GetMTUFromVlanConfig(vc *networkv1.VlanConfig) int
- func GetNadNameFromProvider(provider string) (nadName string, nadNamespace string, err error)
- func GetProviderFromNad(nadName string, nadNamespace string) (provider string, err error)
- func IsDefaultMTU(MTU int) bool
- func IsReservedSubnet(subnetName string, provider string) (bool, error)
- func IsStorageNetworkNad(nad *nadv1.NetworkAttachmentDefinition) bool
- func IsValidMTU(MTU int) bool
- func IsVlanNad(nad *nadv1.NetworkAttachmentDefinition) bool
- func Name(prefix string, s ...string) string
- func NewSelector(selector map[string]string) (labels.Selector, error)
- type Connectivity
- type Layer3NetworkConf
- type Mode
- type NadGetter
- func (n *NadGetter) GetFirstActiveStorageNetworkNadOnClusterNetwork(cnName string) (*nadv1.NetworkAttachmentDefinition, error)
- func (n *NadGetter) ListNadsOnClusterNetwork(cnName string) ([]*nadv1.NetworkAttachmentDefinition, error)
- func (n *NadGetter) NadNamesOnClusterNetwork(cnName string) ([]string, error)
- type NadSelectedNetworks
- type NetConf
- type NetworkType
- type VMGetter
- func (v *VMGetter) VMNamesWhoUseNad(nad *nadv1.NetworkAttachmentDefinition) ([]string, error)
- func (v *VMGetter) VMNamesWhoUseNads(nads []*nadv1.NetworkAttachmentDefinition) ([]string, error)
- func (v *VMGetter) WhoUseNad(nad *nadv1.NetworkAttachmentDefinition) ([]*kubevirtv1.VirtualMachine, error)
- func (v *VMGetter) WhoUseNads(nads []*nadv1.NetworkAttachmentDefinition) ([]*kubevirtv1.VirtualMachine, error)
- type VmiGetter
- func (v *VmiGetter) VmiNamesWhoUseNad(nad *nadv1.NetworkAttachmentDefinition, filterFlag bool, ...) ([]string, error)
- func (v *VmiGetter) VmiNamesWhoUseNads(nads []*nadv1.NetworkAttachmentDefinition, filterFlag bool, ...) ([]string, error)
- func (v *VmiGetter) WhoUseNad(nad *nadv1.NetworkAttachmentDefinition, filterFlag bool, ...) ([]*kubevirtv1.VirtualMachineInstance, error)
- func (v *VmiGetter) WhoUseNads(nads []*nadv1.NetworkAttachmentDefinition, filterFlag bool, ...) ([]*kubevirtv1.VirtualMachineInstance, error)
Constants ¶
const ( DefaultMTU = 1500 MaxMTU = 9000 MinMTU = 576 // IPv4 does not define this explicitly; IPv6 defines 1280; Some protocol requires 576; hence 576 is used )
const ( KeyVlanLabel = network.GroupName + "/vlan-id" // KeyLastVlanLabel is used to record the last VLAN id to support changing the VLAN id of the VLAN networks KeyLastVlanLabel = network.GroupName + "/last-vlan-id" KeyVlanConfigLabel = network.GroupName + "/vlanconfig" KeyClusterNetworkLabel = network.GroupName + "/clusternetwork" // KeyLastClusterNetworkLabel is used to record the last cluster network to support changing the cluster network of NADs KeyLastClusterNetworkLabel = network.GroupName + "/last-clusternetwork" KeyNodeLabel = network.GroupName + "/node" KeyNetworkType = network.GroupName + "/type" KeyLastNetworkType = network.GroupName + "/last-type" KeyNetworkReady = network.GroupName + "/ready" KeyNetworkRoute = network.GroupName + "/route" KeyMTUSourceVlanConfig = network.GroupName + "/mtu-source-vc" // the VC which syncs MTU to CN KeyUplinkMTU = network.GroupName + "/uplink-mtu" // configured MTU on the VC'uplink KeyMatchedNodes = network.GroupName + "/matched-nodes" ValueTrue = "true" ValueFalse = "false" HarvesterWitnessNodeLabelKey = "node-role.harvesterhci.io/witness" // defined in Harvester pkg/controller/master/storagenetwork/storage_network.go // to avoid loop references, needs to wait until Harvester move this to its const and then refers to StorageNetworkAnnotation = "storage-network.settings.harvesterhci.io" StorageNetworkNetAttachDefPrefix = "storagenetwork-" )
const (
CNITypeKubeOVN = "kube-ovn"
)
const ManagementClusterNetworkName = "mgmt"
const (
VMByNetworkIndex = "vm.harvesterhci.io/vm-by-network"
)
Variables ¶
This section is empty.
Functions ¶
func AreEqualMTUs ¶ added in v1.6.0
func EnsureSysctlValue ¶ added in v0.3.0
func FilterFirstActiveStorageNetworkNad ¶ added in v1.6.0
func FilterFirstActiveStorageNetworkNad(nads []*nadv1.NetworkAttachmentDefinition) *nadv1.NetworkAttachmentDefinition
filter the first active storage network nad from a list of nads
func GetMTUFromAnnotation ¶ added in v1.6.0
func GetMTUFromVlanConfig ¶ added in v1.6.0
func GetMTUFromVlanConfig(vc *networkv1.VlanConfig) int
caller handlers the return value of 0 which is normally treated as the default MTU
func GetNadNameFromProvider ¶ added in v1.6.0
func GetProviderFromNad ¶ added in v1.6.0
func IsDefaultMTU ¶ added in v1.6.0
func IsReservedSubnet ¶ added in v1.6.0
func IsStorageNetworkNad ¶ added in v1.6.0
func IsStorageNetworkNad(nad *nadv1.NetworkAttachmentDefinition) bool
if this nad is a storagenetwork nad
func IsValidMTU ¶ added in v1.6.0
func IsVlanNad ¶ added in v0.3.2
func IsVlanNad(nad *nadv1.NetworkAttachmentDefinition) bool
Types ¶
type Connectivity ¶
type Connectivity string
const ( Connectable Connectivity = "true" Unconnectable Connectivity = "false" DHCPFailed Connectivity = "DHCP failed" PingFailed Connectivity = "ping failed" )
type Layer3NetworkConf ¶
type Layer3NetworkConf struct {
Mode Mode `json:"mode,omitempty"`
CIDR string `json:"cidr,omitempty"`
Gateway string `json:"gateway,omitempty"`
ServerIPAddr string `json:"serverIPAddr,omitempty"`
Connectivity Connectivity `json:"connectivity,omitempty"`
Outdated bool `json:"outdated,omitempty"`
}
func NewLayer3NetworkConf ¶
func NewLayer3NetworkConf(conf string) (*Layer3NetworkConf, error)
func (*Layer3NetworkConf) ToString ¶
func (c *Layer3NetworkConf) ToString() (string, error)
type NadGetter ¶ added in v1.6.0
type NadGetter struct {
// contains filtered or unexported fields
}
func NewNadGetter ¶ added in v1.6.0
func NewNadGetter(nadCache ctlcniv1.NetworkAttachmentDefinitionCache) *NadGetter
func (*NadGetter) GetFirstActiveStorageNetworkNadOnClusterNetwork ¶ added in v1.6.0
func (n *NadGetter) GetFirstActiveStorageNetworkNadOnClusterNetwork(cnName string) (*nadv1.NetworkAttachmentDefinition, error)
func (*NadGetter) ListNadsOnClusterNetwork ¶ added in v1.6.0
func (n *NadGetter) ListNadsOnClusterNetwork(cnName string) ([]*nadv1.NetworkAttachmentDefinition, error)
list all nads attached to a cluster network
type NadSelectedNetworks ¶
type NadSelectedNetworks []nadv1.NetworkSelectionElement
func NewNADSelectedNetworks ¶
func NewNADSelectedNetworks(conf string) (NadSelectedNetworks, error)
func (NadSelectedNetworks) ToString ¶
func (n NadSelectedNetworks) ToString() (string, error)
type NetConf ¶ added in v0.3.0
type NetConf struct {
cniv1.NetConf
BrName string `json:"bridge"`
IsGW bool `json:"isGateway"`
IsDefaultGW bool `json:"isDefaultGateway"`
ForceAddress bool `json:"forceAddress"`
IPMasq bool `json:"ipMasq"`
MTU int `json:"mtu"`
HairpinMode bool `json:"hairpinMode"`
PromiscMode bool `json:"promiscMode"`
Vlan int `json:"vlan"`
Provider string `json:"provider"`
}
type NetworkType ¶ added in v0.3.2
type NetworkType string
const ( L2VlanNetwork NetworkType = "L2VlanNetwork" UntaggedNetwork NetworkType = "UntaggedNetwork" OverlayNetwork NetworkType = "OverlayNetwork" )
type VMGetter ¶ added in v1.6.0
type VMGetter struct {
// contains filtered or unexported fields
}
func NewVMGetter ¶ added in v1.6.0
func NewVMGetter(vmCache ctlkubevirtv1.VirtualMachineCache) *VMGetter
func (*VMGetter) VMNamesWhoUseNad ¶ added in v1.6.0
func (v *VMGetter) VMNamesWhoUseNad(nad *nadv1.NetworkAttachmentDefinition) ([]string, error)
Get the vm name list who uses the nad
func (*VMGetter) VMNamesWhoUseNads ¶ added in v1.6.0
func (v *VMGetter) VMNamesWhoUseNads(nads []*nadv1.NetworkAttachmentDefinition) ([]string, error)
Get the vm name list who uses a group of nads, note: duplicated names are removed
func (*VMGetter) WhoUseNad ¶ added in v1.6.0
func (v *VMGetter) WhoUseNad(nad *nadv1.NetworkAttachmentDefinition) ([]*kubevirtv1.VirtualMachine, error)
WhoUseNad requires adding network indexer to the vm cache before invoking it
func (*VMGetter) WhoUseNads ¶ added in v1.6.0
func (v *VMGetter) WhoUseNads(nads []*nadv1.NetworkAttachmentDefinition) ([]*kubevirtv1.VirtualMachine, error)
Get the vm lists who uses a group of nads, note: duplicated vmis may exist when they attache to mutli nads
type VmiGetter ¶ added in v0.3.2
type VmiGetter struct {
VmiCache ctlkubevirtv1.VirtualMachineInstanceCache
}
func NewVmiGetter ¶ added in v1.6.0
func NewVmiGetter(vmiCache ctlkubevirtv1.VirtualMachineInstanceCache) *VmiGetter
func (*VmiGetter) VmiNamesWhoUseNad ¶ added in v1.6.0
func (v *VmiGetter) VmiNamesWhoUseNad(nad *nadv1.NetworkAttachmentDefinition, filterFlag bool, nodesFilter mapset.Set[string]) ([]string, error)
Get the vmi name list who uses the nad
func (*VmiGetter) VmiNamesWhoUseNads ¶ added in v1.6.0
func (v *VmiGetter) VmiNamesWhoUseNads(nads []*nadv1.NetworkAttachmentDefinition, filterFlag bool, nodesFilter mapset.Set[string]) ([]string, error)
Get the vmi name list who uses a group of nads, note: duplicated names are removed
func (*VmiGetter) WhoUseNad ¶ added in v0.3.2
func (v *VmiGetter) WhoUseNad(nad *nadv1.NetworkAttachmentDefinition, filterFlag bool, nodesFilter mapset.Set[string]) ([]*kubevirtv1.VirtualMachineInstance, error)
WhoUseNad requires adding network indexer to the vmi cache before invoking it when filterFlag is true, it ensures the return vmis are on the given nodesFilter
func (*VmiGetter) WhoUseNads ¶ added in v1.6.0
func (v *VmiGetter) WhoUseNads(nads []*nadv1.NetworkAttachmentDefinition, filterFlag bool, nodesFilter mapset.Set[string]) ([]*kubevirtv1.VirtualMachineInstance, error)
Get the vmi lists who uses a group of nads, note: duplicated vmis may exist when they attache to mutli nads