libnet

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIPv6Address = "fd10:0:2::2"
	DefaultIPv6CIDR    = DefaultIPv6Address + "/120"
	DefaultIPv6Gateway = "fd10:0:2::1"
)

Variables

This section is empty.

Functions

func AddLabelToNamespace added in v0.42.0

func AddLabelToNamespace(client kubecli.KubevirtClient, namespace, key, value string) error

func CidrToIP added in v0.53.0

func CidrToIP(cidr string) (string, error)

func ClusterDNSServiceIP added in v0.35.0

func ClusterDNSServiceIP() (string, error)

ClusterDNSServiceIP returns the cluster IP address of the DNS service. Attempts first to detect the DNS service on a k8s cluster and if not found on an openshift cluster.

func CreateDefaultCloudInitNetworkData added in v0.35.0

func CreateDefaultCloudInitNetworkData() string

CreateDefaultCloudInitNetworkData generates a default configuration for the Cloud-Init Network Data, in version 2 format. The default configuration sets dynamic IPv4 (DHCP) and static IPv6 addresses, inclusing DNS settings of the cluster nameserver IP and search domains.

func CreateNAD added in v1.0.0

func CreateNAD(namespace, nadName string) error

func GetIP added in v0.55.0

func GetIP(ips []string, family k8sv1.IPFamily) string

func GetLoopbackAddress added in v0.52.0

func GetLoopbackAddress(family k8sv1.IPFamily) string

func GetLoopbackAddressForURL added in v0.55.0

func GetLoopbackAddressForURL(family k8sv1.IPFamily) string

func GetPodIPByFamily added in v0.55.0

func GetPodIPByFamily(pod *k8sv1.Pod, family k8sv1.IPFamily) string

func GetVmiPrimaryIPByFamily added in v0.55.0

func GetVmiPrimaryIPByFamily(vmi *v1.VirtualMachineInstance, family k8sv1.IPFamily) string

func InterfaceExists added in v1.0.0

func InterfaceExists(vmi *v1.VirtualMachineInstance, interfaceName string) error

func NewExposeArgs added in v0.45.0

func NewExposeArgs(resource, namespace, name string, opts ...Option) []string

func NewNetworkData added in v0.36.0

func NewNetworkData(options ...NetworkDataOption) (string, error)

func NewVMExposeArgs added in v0.45.0

func NewVMExposeArgs(vm *v1.VirtualMachine, opts ...Option) []string

func NewVMIExposeArgs added in v0.45.0

func NewVMIExposeArgs(vmi *v1.VirtualMachineInstance, opts ...Option) []string

func NewVMIRSExposeArgs added in v0.45.0

func NewVMIRSExposeArgs(vmrs *v1.VirtualMachineInstanceReplicaSet, opts ...Option) []string

func PatchNamespace added in v0.58.1

func PatchNamespace(client kubecli.KubevirtClient, namespace string, patchFunc func(*v1.Namespace)) error

func PingFromVMConsole added in v0.35.0

func PingFromVMConsole(vmi *v1.VirtualMachineInstance, ipAddr string, args ...string) error

PingFromVMConsole performs a ping through the provided VMI console. Optional arguments for the ping command may be provided, overwirting the default ones. (default ping options: "-c 5, -w 10") Note: The maximum overall command timeout is 20 seconds.

func RemoveLabelFromNamespace added in v0.42.0

func RemoveLabelFromNamespace(client kubecli.KubevirtClient, namespace, key string) error

func SearchDomains added in v0.35.0

func SearchDomains() []string

SearchDomains returns a list of default search name domains.

func SkipWhenClusterNotSupportIPFamily added in v0.55.0

func SkipWhenClusterNotSupportIPFamily(ipFamily k8sv1.IPFamily)

func SkipWhenClusterNotSupportIpv4 added in v0.52.0

func SkipWhenClusterNotSupportIpv4()

func SkipWhenClusterNotSupportIpv6 added in v0.52.0

func SkipWhenClusterNotSupportIpv6()

func SkipWhenNotDualStackCluster added in v0.34.1

func SkipWhenNotDualStackCluster()

func ValidateVMIandPodIPMatch added in v0.35.0

func ValidateVMIandPodIPMatch(vmi *v1.VirtualMachineInstance, vmiPod *k8sv1.Pod) error

ValidateVMIandPodIPMatch Checks that the vmi pod and vmi scheme have matching Ip/Ips fields for primary interface

func WithPort added in v0.45.0

func WithPort(port string) func(cmdArgs []string) []string

func WithProtocol added in v0.45.0

func WithProtocol(protocol string) func(cmdArgs []string) []string

func WithServiceName added in v0.45.0

func WithServiceName(serviceName string) func(cmdArgs []string) []string

func WithTargetPort added in v0.45.0

func WithTargetPort(targetPort string) func(cmdArgs []string) []string

func WithType added in v0.45.0

func WithType(serviceType string) func(cmdArgs []string) []string

Types

type CloudInitInterface added in v0.35.0

type CloudInitInterface struct {
	AcceptRA       *bool                `json:"accept-ra,omitempty"`
	Addresses      []string             `json:"addresses,omitempty"`
	DHCP4          *bool                `json:"dhcp4,omitempty"`
	DHCP6          *bool                `json:"dhcp6,omitempty"`
	DHCPIdentifier string               `json:"dhcp-identifier,omitempty"` // "duid" or  "mac"
	Gateway4       string               `json:"gateway4,omitempty"`
	Gateway6       string               `json:"gateway6,omitempty"`
	Nameservers    CloudInitNameservers `json:"nameservers,omitempty"`
	MACAddress     string               `json:"macaddress,omitempty"`
	Match          CloudInitMatch       `json:"match,omitempty"`
	MTU            int                  `json:"mtu,omitempty"`
	Routes         []CloudInitRoute     `json:"routes,omitempty"`
	SetName        string               `json:"set-name,omitempty"`
	// contains filtered or unexported fields
}

type CloudInitMatch added in v0.36.0

type CloudInitMatch struct {
	Name       string `json:"name,omitempty"`
	MACAddress string `json:"macaddress,omitempty"`
	Driver     string `json:"driver,omitempty"`
}

type CloudInitNameservers added in v0.35.0

type CloudInitNameservers struct {
	Search    []string `json:"search,omitempty"`
	Addresses []string `json:"addresses,omitempty"`
}

type CloudInitNetworkData added in v0.35.0

type CloudInitNetworkData struct {
	Version   int                           `json:"version"`
	Ethernets map[string]CloudInitInterface `json:"ethernets,omitempty"`
}

type CloudInitRoute added in v0.35.0

type CloudInitRoute struct {
	From   string `json:"from,omitempty"`
	OnLink *bool  `json:"on-link,omitempty"`
	Scope  string `json:"scope,omitempty"`
	Table  *int   `json:"table,omitempty"`
	To     string `json:"to,omitempty"`
	Type   string `json:"type,omitempty"`
	Via    string `json:"via,omitempty"`
	Metric *int   `json:"metric,omitempty"`
}

type NetworkDataInterfaceOption added in v0.36.0

type NetworkDataInterfaceOption func(*CloudInitInterface) error

func WithAcceptRA added in v0.37.0

func WithAcceptRA() NetworkDataInterfaceOption

func WithAddresses added in v0.36.0

func WithAddresses(addresses ...string) NetworkDataInterfaceOption

func WithDHCP4Enabled added in v0.36.0

func WithDHCP4Enabled() NetworkDataInterfaceOption

func WithDHCP6Enabled added in v0.37.0

func WithDHCP6Enabled() NetworkDataInterfaceOption

func WithGateway6 added in v0.36.0

func WithGateway6(gateway6 string) NetworkDataInterfaceOption

func WithMatchingMAC added in v0.36.0

func WithMatchingMAC(macAddress string) NetworkDataInterfaceOption

func WithNameserverFromCluster added in v0.36.0

func WithNameserverFromCluster() NetworkDataInterfaceOption

type NetworkDataOption added in v0.36.0

type NetworkDataOption func(*CloudInitNetworkData) error

func WithEthernet added in v0.36.0

func WithEthernet(name string, options ...NetworkDataInterfaceOption) NetworkDataOption

type Option added in v0.45.0

type Option func(cmdArgs []string) []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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