vmlayer

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDockerSeedWait = 1 * time.Minute

	FileDownloadDir = "/var/tmp/"
)
View Source
const (
	MexSubnetPrefix = "mex-k8s-subnet-"

	ActionAdd    = "add"
	ActionRemove = "remove"
	ActionNone   = "none"
)
View Source
const ClusterMasterIPLastIPOctet uint32 = 10
View Source
const CommonInternalCIDRDefault = "10.201.0.0/16"

CommonInternalCIDRDefault is default if the platform uses a common internal network between the shared LB and all clusters

View Source
const CommonInternalV6Subnet = "fc00:201:ecec:0"

CommonInternalV6Subnet is the same as CommonInternalCIDRDefault, but for ipv6 (assumes /64)

View Source
const DriverInstallationTimeout = 30 * time.Minute
View Source
const GPUOperatorNamespace = "gpu-operator-resources"
View Source
const GPUOperatorSelector = "app=nvidia-operator-validator"
View Source
const GPUOperatorTimeout = 10 * time.Minute
View Source
const MEX_ROOTLB_FLAVOR_NAME = "mex-rootlb-flavor"
View Source
const MINIMUM_DISK_SIZE uint64 = 20
View Source
const MINIMUM_RAM_SIZE uint64 = 2048
View Source
const MINIMUM_VCPUS uint64 = 2
View Source
const NetworkTypeVLAN string = "vlan"

NetworkTypeVLAN is an OpenStack provider network type

View Source
const ServerDoesNotExistError string = "Server does not exist"
View Source
const ServerIPNotFound string = "unable to find IP"
View Source
const TestCACert = "ssh-rsa DUMMYTESTCACERT"

Variables

View Source
var ActionReboot = "reboot"
View Source
var ActionStart = "start"
View Source
var ActionStop = "stop"
View Source
var CloudletAccessToken = "CloudletAccessToken"
View Source
var CloudletNetworkNamesMap = "CloudletNetworkNamesMap"
View Source
var ClusterTypeDockerVMLabel = "mex-docker-vm"
View Source
var ClusterTypeKubernetesMasterLabel = "mex-k8s-master"
View Source
var ImageFormatQcow2 = "qcow2"

note that qcow2 must be understood by vsphere and vmdk must be known by openstack so they can be converted back and forth

View Source
var ImageFormatVmdk = "vmdk"
View Source
var ListenAllIPs infracommon.IPs
View Source
var MaxDockerVmWait = 2 * time.Minute
View Source
var MaxRootLBWait = 5 * time.Minute
View Source
var NextAvailableResource = "NextAvailable"

NextAvailableResource means the orchestration code needs to find an available resource of the given type as the calling code won't know what is free

View Source
var NoAccessKey string
View Source
var NoConfigExternalRouter = "NOCONFIG"

NoConfigExternalRouter is used for the case in which we don't manage the external router and don't add ports to it ourself, as happens with Contrail. The router does exist in this case and we use it to route from the LB to the pods

View Source
var NoExternalRouter = "NONE"

NoExternalRouter means there is no router at all and we connect the LB to the k8s pods on the same subnet this may eventually be the default and possibly only option

View Source
var NoSubnetDNS = "NONE"

NoSubnetDNS means that DNS servers are not specified when creating the subnet

View Source
var NvidiaGPUOperatorApp = edgeproto.App{
	Key: edgeproto.AppKey{
		Name:         "nvidia-gpu-operator",
		Version:      "v1.7.0",
		Organization: edgeproto.OrganizationEdgeCloud,
	},
	ImagePath:     "https://nvidia.github.io/gpu-operator:nvidia/gpu-operator",
	Deployment:    cloudcommon.DeploymentTypeHelm,
	DelOpt:        edgeproto.DeleteType_AUTO_DELETE,
	InternalPorts: true,
	Trusted:       true,
	Annotations:   "version=v23.3.2,wait=true,timeout=180s",
	Configs: []*edgeproto.ConfigFile{
		&edgeproto.ConfigFile{
			Kind: edgeproto.AppConfigHelmYaml,
			Config: `driver:
  enabled: false
`,
		},
	},
}

helm install --wait gpu-operator nvidia/gpu-operator --version v23.3.2 --set driver.enabled=false

View Source
var RootLBPorts = []dme.AppPort{}
View Source
var ServerActive = "ACTIVE"
View Source
var ServerShutoff = "SHUTOFF"
View Source
var SupportedSchemes = map[string]string{
	"name":               "Deprecated",
	"cidr":               "XXX.XXX.XXX.XXX/XX",
	"floatingipnet":      "Floating IP Network Name",
	"floatingipsubnet":   "Floating IP Subnet Name",
	"floatingipextnet":   "Floating IP External Network Name",
	"vnictype":           "VNIC Type",
	"routergateway":      "Router Gateway IP",
	"networktype":        "Network Type: " + NetworkTypeVLAN,
	"commoninternalnet":  "XXX.XXX.XXX.XXX/XX",
	"ipv6routingprefix":  "XXXX:XXXX:XXXX (uses /64)",
	"ipv6internalsubnet": "XXXX:XXXX:XXXX:XXXX (uses /64)",
	"ipv6routergateway":  "IPV6 Router Gateway IP",
}
View Source
var VMProviderProps = map[string]*edgeproto.PropertyInfo{
	"MEX_EXT_NETWORK": {
		Name:        "Infra External Network Name",
		Description: "Name of the external network to be used to reach developer apps",
		Value:       "external-network-shared",
	},
	"MEX_EXT_NETWORK_SECONDARY": {
		Name:        "Infra Secondary External Network Name",
		Description: "Name of a secondary external network to be used to reach developer apps if running dual stack and IPv4 and IPv6 subnets are on different networks",
		Value:       "",
	},
	"MEX_NETWORK": {
		Name:        "Infra Internal Network Name",
		Description: "Name of the internal network which will be created to be used for cluster communication",
		Value:       "mex-k8s-net-1",
	},

	"MEX_OS_IMAGE": {
		Name:        "Cloudlet Image Name",
		Description: "Name of the VM base image in cloudlet-specific VM storage to be used for bringing up Cloudlet VMs, i.e. \"edgecloud-v5.0.0\"",
		Value:       "",
	},
	"MEX_SECURITY_GROUP": {
		Name:        "Security Group Name",
		Description: "Name of the security group to which cloudlet VMs will be part of",
	},
	"MEX_SHARED_ROOTLB_RAM": {
		Name:        "Security Group Name",
		Description: "Size of RAM (MB) required to bring up shared RootLB",
		Value:       "4096",
	},
	"MEX_SHARED_ROOTLB_VCPUS": {
		Name:        "RootLB vCPUs",
		Description: "Number of vCPUs required to bring up shared RootLB",
		Value:       "2",
	},
	"MEX_SHARED_ROOTLB_DISK": {
		Name:        "RootLB Disk",
		Description: "Size of disk (GB) required to bring up shared RootLB",
		Value:       "40",
	},
	"MEX_NETWORK_SCHEME": {
		Name:        "Internal Network Scheme",
		Description: GetSupportedSchemesStr(),
		Value:       "cidr=10.101.X.0/24,ipv6routingprefix=fc00:101:ecec",
	},
	"MEX_COMPUTE_AVAILABILITY_ZONE": {
		Name:        "Compute Availability Zone",
		Description: "Compute Availability Zone",
	},
	"MEX_NETWORK_AVAILABILITY_ZONE": {
		Name:        "Network Availability Zone",
		Description: "Network Availability Zone",
	},
	"MEX_VOLUME_AVAILABILITY_ZONE": {
		Name:        "Volume Availability Zone",
		Description: "Volume Availability Zone",
	},
	"MEX_IMAGE_DISK_FORMAT": {
		Name:        "VM Image Disk Format",
		Description: "Name of the disk format required to upload VM image to infra datastore",
		Value:       ImageFormatQcow2,
	},
	"MEX_ROUTER": {
		Name:        "External Router Type",
		Description: GetSupportedRouterTypes(),
		Value:       NoExternalRouter,
	},
	"MEX_SUBNET_DNS": {
		Name:        "DNS Override for Subnet",
		Description: "Set to NONE to use no DNS entry for new subnets.  Otherwise subnet DNS is set to MEX_DNS",
	},
	"MEX_DNS": {
		Name:        "DNS Server(s)",
		Description: "Override DNS server IP(s), e.g. \"8.8.8.8\" or \"1.1.1.1,8.8.8.8\"",
		Value:       "1.1.1.1,1.0.0.1",
	},
	"MEX_DNS_IPV6": {
		Name:        "IPv6 DNS Server(s)",
		Description: "Override IPv6 DNS server IP(s), comma separated list of IPv6 DNS server IPs",
		Value:       "2606:4700:4700::1111,2606:4700:4700::1001",
	},
	"MEX_CLOUDLET_FIREWALL_WHITELIST_EGRESS": {
		Name:        "Cloudlet Firewall Whitelist Egress",
		Description: "Firewall rule to whitelist egress traffic",
		Value:       "protocol=tcp,portrange=1:65535,remotecidr=0.0.0.0/0;protocol=udp,portrange=1:65535,remotecidr=0.0.0.0/0;protocol=icmp,remotecidr=0.0.0.0/0",
	},
	"MEX_CLOUDLET_FIREWALL_WHITELIST_INGRESS": {
		Name:        "Cloudlet Firewall Whitelist Ingress",
		Description: "Firewall rule to whitelist ingress traffic",
	},
	"MEX_ADDITIONAL_PLATFORM_NETWORKS": {
		Name:        "Additional Platform Networks",
		Description: "Optional comma separated list of networks to add to platform VM",
	},
	"MEX_ADDITIONAL_ROOTLB_NETWORKS": {
		Name:        "Additional RootLB Networks",
		Description: "Optional comma separated list of networks to add to rootLB VMs",
	},
	"MEX_NTP_SERVERS": {
		Name:        "NTP Servers",
		Description: "Optional comma separated list of NTP servers to override default of ntp.ubuntu.com",
	},
	"MEX_VM_APP_SUBNET_DHCP_ENABLED": {
		Name:        "VM App subnet enable DHCP",
		Description: "Enable DHCP for the subnet created for VM based applications (yes or no)",
		Value:       "yes",
	},
	"MEX_VM_APP_IMAGE_CLEANUP_ON_DELETE": {
		Name:        "VM App image cleanup on delete",
		Description: "Delete image files when VM apps are deleted (yes or no)",
		Value:       "yes",
	},
	"MEX_VM_APP_METRICS_COLLECT_INTERVAL": {
		Name:        "VM App Metrics collect interval, in minutes",
		Description: "Determines how often VM metrics are collected",
		Value:       "5",
	},
	"MEX_METALLB_OCTET3_RANGE": {
		Name:        "MetalLB IP third octet range",
		Description: "Start and end value of MetalLB IP range third octet, (start-end). Set to NONE to disable MetalLB",
		Value:       "200-250",
	},
	"MEX_METALLB_IPV6_RANGE": {
		Name:        "MetalLB IPv6 IP range",
		Description: "Start and end value of MetalLB IP range, last four hextets, (start-end)",
		Value:       "ffff:ffff:ffff:0-ffff:ffff:ffff:fff0",
	},
	"MEX_ENABLE_ANTI_AFFINITY": {
		Name:        "Enable Anti-Affinity Rules",
		Description: "Enable Anti-Affinity rules where applicable for H/A (yes or no). Set to \"no\" for environments with limited hosts",
		Value:       "yes",
	},
	"MEX_SUBNETS_IGNORE_DHCP": {
		Name:        "Subnets to ignore DHCP setting",
		Description: "Some platform IPv6 DHCP services seems to have problems, use this to specify a comma separated list of subnet names to ignore DHCP when configuring interfaces",
		Value:       "",
	},
}

properties common to all VM providers

View Source
var VmCloudConfig = `` /* 2048-byte string literal not displayed */
View Source
var VmCloudConfigShareMount = `` /* 513-byte string literal not displayed */

vmCloudConfigShareMount is appended optionally to vmCloudConfig. It assumes the end of vmCloudConfig is runcmd

Functions

func AddServerExternalIpToCache

func AddServerExternalIpToCache(ctx context.Context, serverName string, sips ServerIPs)

func CleanupGPUOperatorConfigs

func CleanupGPUOperatorConfigs(ctx context.Context, client ssh.Client) error

func ClusterNodePrefix

func ClusterNodePrefix(num uint32) string

func ConvertQcowToVmdk

func ConvertQcowToVmdk(ctx context.Context, sourceFile string, size uint64) (string, error)

func CopyResourceTracker

func CopyResourceTracker(ctx context.Context, client ssh.Client) error

This function copies resource-tracker from crm to rootLb - we need this to provide docker metrics

func DeleteServerIpFromCache

func DeleteServerIpFromCache(ctx context.Context, serverName string)

func DownloadVMImage

func DownloadVMImage(ctx context.Context, accessApi platform.AccessApi, imageName, imageUrl, md5Sum string) (outPath string, reterr error)

func GetBootCommandsForInterClusterIptables

func GetBootCommandsForInterClusterIptables(ctx context.Context, allowedCidr, blockedCidr, gateway string, ipversion infracommon.IPVersion) ([]string, error)

GetBootCommandsForInterClusterIptables generates a list of commands that can be used to block all traffic from a specified CIDR with exceptions for an allowed range and a gateway.

func GetCertFilePath

func GetCertFilePath(key *edgeproto.CloudletKey) string

func GetCloudletNetworkIfaceFile

func GetCloudletNetworkIfaceFile() string

func GetClusterMasterName

func GetClusterMasterName(ctx context.Context, clusterInst *edgeproto.ClusterInst) string

func GetClusterMasterNameFromNodeList

func GetClusterMasterNameFromNodeList(ctx context.Context, client ssh.Client, clusterInst *edgeproto.ClusterInst) (string, error)

GetClusterMasterNameFromNodeList is used instead of GetClusterMasterName when getting the actual master name from a running cluster, because the name can get truncated if it is too long

func GetClusterNodeName

func GetClusterNodeName(ctx context.Context, clusterInst *edgeproto.ClusterInst, nodeNum uint32) string

func GetLastHostAddressForCidr

func GetLastHostAddressForCidr(cidr string) (string, error)

GetLastHostAddressForCidr requires either 8,16 or 24 bit mask

func GetPortName

func GetPortName(vmname, netname string) string

func GetPortNameFromSubnet

func GetPortNameFromSubnet(vmname string, subnetNames SubnetNames) string

func GetServerIPFromCache

func GetServerIPFromCache(ctx context.Context, serverName string) (*ServerIP, *ServerIP)

func GetServerIPsByMAC

func GetServerIPsByMAC(ctx context.Context, sd *ServerDetail) map[string]ServerIPs

func GetSupportedRouterTypes

func GetSupportedRouterTypes() string

func GetSupportedSchemesStr

func GetSupportedSchemesStr() string

func GetVMMetaData

func GetVMMetaData(role VMRole, masterIP, masterIPv6 string, formatter VmConfigDataFormatter) string

func GetVMUserData

func GetVMUserData(name string, sharedVolume bool, manifest, command string, cloudConfigParams *VMCloudConfigParams, formatter VmConfigDataFormatter) (string, error)

func GetVaultCloudletCommonPath

func GetVaultCloudletCommonPath(filePath string) string

func GetVmwareMappedOsType

func GetVmwareMappedOsType(osType edgeproto.VmAppOsType) (string, error)

func MaskLenToMask

func MaskLenToMask(maskLen string) (string, error)

MaskLenToMask converts the number of bits in a mask to a dot notation mask

func NewProxyConfig

func NewProxyConfig(listenIPs infracommon.IPs, destIPs ServerIPs, enableIPV6 bool) *proxy.ProxyConfig

NewProxyConfig creates a proxy config to be passed to the proxy code. Listen addresses will proxy data to the destination addresses.

func ParseClusterNodePrefix

func ParseClusterNodePrefix(name string) (bool, uint32)

func WaitServerReady

func WaitServerReady(ctx context.Context, provider VMProvider, client ssh.Client, server string, timeout time.Duration) error

WaitServerReady waits up to the specified duration for the server to be reachable via SSH and pass any additional checks from the provider

Types

type AccessPortSpec

type AccessPortSpec struct {
	Ports []util.PortSpec
}

type ActionType

type ActionType string
const (
	ActionCreate ActionType = "create"
	ActionUpdate ActionType = "update"
	ActionDelete ActionType = "delete"
)

type CacheOption

type CacheOption bool
const NoCache CacheOption = false
const UseCache CacheOption = true

type ClusterFlavor

type ClusterFlavor struct {
	Kind           string
	Name           string
	PlatformFlavor string
	Status         string
	NumNodes       int
	MaxNodes       int
	NumMasterNodes int
	NetworkSpec    string
	StorageSpec    string
	NodeFlavor     ClusterNodeFlavor
	Topology       string
}

ClusterFlavor contains definitions of cluster flavor

type ClusterNodeFlavor

type ClusterNodeFlavor struct {
	Type string
	Name string
}

ClusterNodeFlavor contains details of flavor for the node

type DhcpConfigParms

type DhcpConfigParms struct {
	Subnet         string
	Gateway        string
	Mask           string
	DnsServers     string
	IpAddressStart string
	IpAddressEnd   string
	Interface      string
}

type FixedIPOrchestrationParams

type FixedIPOrchestrationParams struct {
	LastIPOctet uint32
	Address     string
	Mask        string
	Subnet      ResourceReference
	Gateway     string
	IPVersion   infracommon.IPVersion
}

type FloatingIPOrchestrationParams

type FloatingIPOrchestrationParams struct {
	Name         string
	ParamName    string
	Port         ResourceReference
	FloatingIpId string
}

type GPUSetupStage

type GPUSetupStage string

Some platforms like VCD needs an additional step to setup GPU driver. Hence, GPU drivers should only be setup as part of AppInst bringup. For other platforms like Openstack, GPU driver can be setup as part of ClusterInst bringup

const (
	ClusterInstStage GPUSetupStage = "clusterinst"
	AppInstStage     GPUSetupStage = "appinst"
)

type GetIPOp

type GetIPOp func(ops *GetIPOptions)

func GetIPOpsFromSSHOps

func GetIPOpsFromSSHOps(ops []pc.SSHClientOp) []GetIPOp

GetIPOpsFromSSHOps allows for passing down ssh options to getIP options that are common to both. Previously we only used ssh options, but that did not allow for adding getIP-specific options.

func WithCachedIP

func WithCachedIP(cached bool) GetIPOp

func WithServerDetail

func WithServerDetail(sd *ServerDetail) GetIPOp

WithServerDetail avoids an extra lookup if needed

type GetIPOptions

type GetIPOptions struct {
	CachedIP     bool
	ServerDetail *ServerDetail
}

GetIPOptions for getting ServerIPs information

func (*GetIPOptions) Apply

func (s *GetIPOptions) Apply(ops ...GetIPOp)

type InternalPortAttachPolicy

type InternalPortAttachPolicy string

InternalPortAttachPolicy is for dedicated clusters to define whether the internal port should be created when the rootlb is spun up, or afterwards.

const AttachPortAfterCreate InternalPortAttachPolicy = "AttachPortAfterCreate"
const AttachPortDuringCreate InternalPortAttachPolicy = "AttachPortDuringCreate"
const AttachPortNotSupported InternalPortAttachPolicy = "AttachPortNotSupported"

type NetSpecInfo

type NetSpecInfo struct {
	CIDR                          string
	NetworkType                   string
	NetworkAddress                string
	NetmaskBits                   string
	Octets                        []string
	MasterIPLastOctet             string
	DelimiterOctet                int // this is the X
	FloatingIPNet                 string
	FloatingIPSubnet              string
	FloatingIPExternalNet         string
	VnicType                      string
	RouterGatewayIP               string
	CommonInternalCIDR            string
	CommonInternalNetworkAddress  string
	CommonInternalNetworkMaskBits int
	NetworkAddressV6              string
	NetmaskBitsV6                 string
	IPV6RoutingPrefix             string
	IPV6InternalSubnet            string
	IPV6RouterGatewayIP           string
}

func ParseNetSpec

func ParseNetSpec(ctx context.Context, netSpec string) (*NetSpecInfo, error)

ParseNetSpec decodes netspec string which defines internal network parameters

type NetworkDetail

type NetworkDetail struct {
	ID      string
	Name    string
	Status  string
	MTU     int
	Subnets []SubnetDetail
}

func (*NetworkDetail) GetSubnet

func (s *NetworkDetail) GetSubnet(name string) *SubnetDetail

type NetworkType

type NetworkType string
const NetworkTypeExternalAdditionalClusterNode NetworkType = "cluster-node"
const NetworkTypeExternalAdditionalPlatform NetworkType = "platform"
const NetworkTypeExternalAdditionalRootLb NetworkType = "rootlb"
const NetworkTypeExternalPrimary NetworkType = "external-primary"
const NetworkTypeExternalSecondary NetworkType = "external-secondary"
const NetworkTypeInternalPrivate NetworkType = "internal-private" // internal network for only one cluster
const NetworkTypeInternalSharedLb NetworkType = "internal-shared-lb" // internal network connected to shared rootlb

type NodeInfo

type NodeInfo struct {
	NodeName string
	NodeRole cloudcommon.NodeRole
	NodeType cloudcommon.NodeType
}

type OperationInitResult

type OperationInitResult string

OperationInitResult indicates whether the initialization was newly done or previously done for the context. It is necessary because there are some flows in which an initialization could be done multiple times. If OperationAlreadyInitialized is returned, cleanup should be skipped

const (
	OperationNewlyInitialized   OperationInitResult = "OperationNewlyInitialized"
	OperationInitFailed         OperationInitResult = "OperationInitFailed"
	OperationAlreadyInitialized OperationInitResult = "OperationAlreadyInitialized"
)

type OperationInitStage

type OperationInitStage string

OperationInitStage is used to perform any common functions needed when starting and finishing an operation on the provider

const (
	OperationInitStart    OperationInitStage = "OperationStart"
	OperationInitComplete OperationInitStage = "OperationComplete"
)

type PlatformResources

type PlatformResources struct {
	// Timestamp when this was collected
	CollectTime *types.Timestamp
	// Total number of CPUs
	VCpuMax uint64
	// Current number of CPUs used
	VCpuUsed uint64
	// Total amount of RAM(in MB)
	MemMax uint64
	// Currently used RAM(in MB)
	MemUsed uint64
	// Total amount of Storage(in GB)
	DiskUsed uint64
	// Currently used Storage(in GB)
	DiskMax uint64
	// Total number of Floating IPs available
	FloatingIpsMax uint64
	// Currently used number of Floating IPs
	FloatingIpsUsed uint64
	// Total KBytes received
	NetRecv uint64
	// Total KBytes sent
	NetSent uint64
	// Total available IP addresses
	Ipv4Max uint64
	// Currently used IP addrs
	Ipv4Used uint64
}

type PortOrchestrationParams

type PortOrchestrationParams struct {
	Name                        string
	Id                          string
	SubnetIds                   SubnetNames
	NetworkName                 string
	NetworkId                   string
	NetType                     NetworkType
	VnicType                    string
	SkipAttachVM                bool
	FixedIPs                    []FixedIPOrchestrationParams
	SecurityGroups              []ResourceReference
	IsAdditionalExternalNetwork bool
}

type PortResourceReference

type PortResourceReference struct {
	Name         string
	Id           string
	NetworkId    string
	SubnetId     string
	SubnetIdIPV6 string
	Preexisting  bool
	NetType      NetworkType
	PortGroup    string
}

PortResourceReference needs also a network id

func NewPortResourceReference

func NewPortResourceReference(name string, id string, netid string, subnetIds SubnetNames, preexisting bool, netType NetworkType) PortResourceReference

type ProviderInitStage

type ProviderInitStage string
const (
	ProviderInitCreateCloudletDirect        ProviderInitStage = "CreateCloudletDirect"
	ProviderInitCreateCloudletRestricted    ProviderInitStage = "CreateCloudletRestricted"
	ProviderInitPlatformStartCrmConditional ProviderInitStage = "ProviderInitPlatformStartCrmConditional"
	ProviderInitPlatformStartCrmCommon      ProviderInitStage = "ProviderInitPlatformStartCrmCommon"
	ProviderInitPlatformStartShepherd       ProviderInitStage = "PlatformStartShepherd"
	ProviderInitDeleteCloudlet              ProviderInitStage = "DeleteCloudlet"
	ProviderInitGetVmSpec                   ProviderInitStage = "GetVmSpec"
)

type ProxyDnsSecOpts

type ProxyDnsSecOpts struct {
	AddProxy              bool
	AddDnsAndPatchKubeSvc bool
	AddSecurityRules      bool
}

type ResTagTables

type ResTagTables map[string]*edgeproto.ResTagTable

type ResourceReference

type ResourceReference struct {
	Name        string
	Id          string
	Preexisting bool
}

ResourceReference identifies a resource that is referenced by another resource. The Preexisting flag indicates whether the resource is already present or is being created as part of this operation. How the resource is referred to during the orchestration process may be different for preexisting vs new resources.

func NewResourceReference

func NewResourceReference(name string, id string, preexisting bool) ResourceReference

type ResourceType

type ResourceType string

ResourceType is not exhaustive list, currently only ResourceTypeSecurityGroup is needed

const (
	ResourceTypeVM            ResourceType = "VM"
	ResourceTypeSubnet        ResourceType = "Subnet"
	ResourceTypeSecurityGroup ResourceType = "SecGrp"
)

type RouterDetail

type RouterDetail struct {
	Name         string
	ExternalIP   string
	ExternalIPV6 string
}

type RouterInterfaceOrchestrationParams

type RouterInterfaceOrchestrationParams struct {
	RouterName string
	RouterPort ResourceReference
}

type SecgrpParamsOp

type SecgrpParamsOp func(vmp *SecurityGroupOrchestrationParams) error

func SecGrpWithAccessPorts

func SecGrpWithAccessPorts(ports string) SecgrpParamsOp

func SecGrpWithEgressRules

func SecGrpWithEgressRules(rules []edgeproto.SecurityRule, egressRestricted, enableIPV6 bool) SecgrpParamsOp

type SecurityGroupOrchestrationParams

type SecurityGroupOrchestrationParams struct {
	Name        string
	AccessPorts AccessPortSpec
	EgressRules []SecurityRule
}

func GetSecGrpParams

func GetSecGrpParams(name string, opts ...SecgrpParamsOp) (*SecurityGroupOrchestrationParams, error)

type SecurityRule

type SecurityRule struct {
	Protocol     string
	PortRangeMin int
	PortRangeMax int
	RemoteCidr   string
	IPVersion    infracommon.IPVersion
}

type ServerDetail

type ServerDetail struct {
	Addresses []ServerIP
	Networks  map[string]*NetworkDetail
	ID        string
	Name      string
	Status    string
}

type ServerIP

type ServerIP struct {
	MacAddress             string
	InternalAddr           string // this is the address used inside the server
	ExternalAddr           string // this is external with respect to the server, not necessarily internet reachable.  Can be a floating IP
	Network                string
	PortName               string
	ExternalAddrIsFloating bool
	IPVersion              infracommon.IPVersion
	SubnetName             string
}

ServerIP is an IP address for a given network on a port. In the case of floating IPs, there are both internal and external addresses which are associated via NAT. In the non floating case, the external and internal are the same

type ServerIPs

type ServerIPs [infracommon.NumIPTypes]*ServerIP

ServerIPs is a fixed length array of ServerIPs. IPs may be nil.

func GetIPFromServerDetails

func GetIPFromServerDetails(ctx context.Context, networkName string, portName string, sd *ServerDetail) (ServerIPs, error)

GetIPFromServerDetails returns the IPv4 and IPv6 IPs for the given network name or port name. While an interface may technically have multiple IPv4 or IPv6 addresses, we only recognize one IPv4 and/or one IPv6. Because this is retreiving IPs based on the infra and the subnet attached to the network, it will not report any IPv6 link-local addresses that are automatically assigned by the VM's operating system.

func (ServerIPs) ExternalAddr

func (s ServerIPs) ExternalAddr(index int) string

func (ServerIPs) IPV4

func (s ServerIPs) IPV4() *ServerIP

func (ServerIPs) IPV4ExternalAddr

func (s ServerIPs) IPV4ExternalAddr() string

func (ServerIPs) IPV6

func (s ServerIPs) IPV6() *ServerIP

func (ServerIPs) IPV6ExternalAddr

func (s ServerIPs) IPV6ExternalAddr() string

func (ServerIPs) IsSet

func (s ServerIPs) IsSet() bool

type SkipK8sChoice

type SkipK8sChoice string
const (
	SkipK8sNo  SkipK8sChoice = "no"
	SkipK8sYes SkipK8sChoice = "yes"
)

type StringSanitizer

type StringSanitizer func(value string) string

type SubnetDetail

type SubnetDetail struct {
	ID             string
	Name           string
	IPVersion      infracommon.IPVersion
	DHCP           bool // if DHCP is set, IP info may be empty
	SLAAC          bool // ipv6 only
	SubnetIPRanges []SubnetIPRange
	CIDR           netip.Prefix
	DNSServers     []string
	GatewayIP      string
}

type SubnetIPRange

type SubnetIPRange struct {
	Start string
	End   string
}

type SubnetNames

type SubnetNames = infracommon.IPs

SubnetNames is a fixed length array of ip type subnet names

var NoSubnets SubnetNames

type SubnetOrchestrationParams

type SubnetOrchestrationParams struct {
	Id                string
	Name              string
	ReservedName      string
	NetworkName       string
	CIDR              string
	IPVersion         infracommon.IPVersion
	NodeIPPrefix      string
	GatewayIP         string
	DNSServers        []string
	DHCPEnabled       string
	Vlan              uint32
	SkipGateway       bool
	SecurityGroupName string
}

type TagOrchestrationParams

type TagOrchestrationParams struct {
	Id       string
	Name     string
	Category string
}

type VMAccess

type VMAccess struct {
	Name   string
	Client ssh.Client
	Role   VMRole
}

type VMCloudConfigParams

type VMCloudConfigParams struct {
	ExtraBootCommands []string
	ConfigureNodeVars *confignode.ConfigureNodeVars
	CACert            string
	AccessKey         string
	PrimaryDNS        string
	FallbackDNS       string
	NtpServers        string
	AnsiblePkgURL     string
	CloudletVarsURL   string
}

type VMDomain

type VMDomain string

VMDomain is to differentiate platform vs computing VMs and associated resources

const (
	VMDomainCompute  VMDomain = "compute"
	VMDomainPlatform VMDomain = "platform"
	VMDomainAny      VMDomain = "any" // used for matching only
)

type VMGroupOrchestrationParams

type VMGroupOrchestrationParams struct {
	OwnerID                       string
	GroupName                     string
	Subnets                       []SubnetOrchestrationParams
	Ports                         []PortOrchestrationParams
	RouterInterfaces              []RouterInterfaceOrchestrationParams
	VMs                           []VMOrchestrationParams
	FloatingIPs                   []FloatingIPOrchestrationParams
	SecurityGroups                []SecurityGroupOrchestrationParams
	Netspec                       *NetSpecInfo
	Tags                          []TagOrchestrationParams
	SkipInfraSpecificCheck        bool
	SkipSubnetGateway             bool
	InitOrchestrator              bool
	NodeUpdateActions             map[string]string
	ConnectsToSharedRootLB        bool
	SkipCleanupOnFailure          bool
	AntiAffinitySpecified         bool
	AntiAffinityEnabledInCloudlet bool
	EnableIPV6                    bool
	UseExistingVMs                bool
}

VMGroupOrchestrationParams contains all the details used by the orchestator to create a set of associated VMs

func GetVMGroupOrchestrationParamsFromTrustPolicy

func GetVMGroupOrchestrationParamsFromTrustPolicy(ctx context.Context, name string, rules []edgeproto.SecurityRule, egressRestricted, cloudletEnableIPV6 bool, opts ...SecgrpParamsOp) (*VMGroupOrchestrationParams, error)

GetVMGroupOrchestrationParamsFromTrustPolicy returns an set of orchestration params for just a privacy policy egress rules

type VMGroupReqOp

type VMGroupReqOp func(vmp *VMGroupRequestSpec) error

func WithAccessPorts

func WithAccessPorts(ports string) VMGroupReqOp

func WithAntiAffinity

func WithAntiAffinity(anti bool) VMGroupReqOp

func WithEnableIPV6

func WithEnableIPV6(enable bool) VMGroupReqOp

func WithInitOrchestrator

func WithInitOrchestrator(init bool) VMGroupReqOp

func WithNewSecurityGroup

func WithNewSecurityGroup(sg string) VMGroupReqOp

func WithNewSubnet

func WithNewSubnet(sn SubnetNames) VMGroupReqOp

func WithNodeUpdateActions

func WithNodeUpdateActions(updateActions map[string]string) VMGroupReqOp

func WithSkipCleanupOnFailure

func WithSkipCleanupOnFailure(skip bool) VMGroupReqOp

func WithSkipDefaultSecGrp

func WithSkipDefaultSecGrp(skip bool) VMGroupReqOp

func WithSkipInfraSpecificCheck

func WithSkipInfraSpecificCheck(skip bool) VMGroupReqOp

func WithSkipSubnetGateway

func WithSkipSubnetGateway(skip bool) VMGroupReqOp

func WithTrustPolicy

func WithTrustPolicy(pp *edgeproto.TrustPolicy) VMGroupReqOp

func WithUseExistingVMs

func WithUseExistingVMs(useExistingVMs bool) VMGroupReqOp

type VMGroupRequestSpec

type VMGroupRequestSpec struct {
	GroupName                     string
	VMs                           []*VMRequestSpec
	NewSubnetNames                SubnetNames
	NewSecgrpName                 string
	AccessPorts                   string
	EnableIPV6                    bool
	TrustPolicy                   *edgeproto.TrustPolicy
	SkipDefaultSecGrp             bool
	SkipSubnetGateway             bool
	SkipInfraSpecificCheck        bool
	InitOrchestrator              bool
	Domain                        string
	NodeUpdateActions             map[string]string
	SkipCleanupOnFailure          bool
	AntiAffinity                  bool
	AntiAffinityEnabledInCloudlet bool
	UseExistingVMs                bool
}

VMGroupRequestSpec is used to specify a set of VMs to be created. It is used as input to create VMGroupOrchestrationParams

type VMMetrics

type VMMetrics struct {
	// Cpu is a percentage
	Cpu   float64
	CpuTS *types.Timestamp
	// Mem is bytes used
	Mem   uint64
	MemTS *types.Timestamp
	// Disk is bytes used
	Disk   uint64
	DiskTS *types.Timestamp
	// NetSent is bytes/second average
	NetSent   uint64
	NetSentTS *types.Timestamp
	// NetRecv is bytes/second average
	NetRecv   uint64
	NetRecvTS *types.Timestamp
}

VMMetrics contains stats and timestamp

type VMOrchestrationParams

type VMOrchestrationParams struct {
	Id                      string
	Name                    string
	Role                    VMRole
	ImageName               string
	ImageFolder             string
	HostName                string
	DNSDomain               string
	FlavorName              string
	Vcpus                   uint64
	Ram                     uint64
	Disk                    uint64
	ComputeAvailabilityZone string
	UserData                string
	MetaData                string
	SharedVolume            bool
	AuthPublicKey           string
	DeploymentManifest      string
	Command                 string
	// TODO - Volumes should be just a reference here and
	// and the volume definition should be in VMGroupOrchestrationParams
	// similar how ports and handled.
	Volumes            []VolumeOrchestrationParams
	Ports              []PortResourceReference      // depending on the orchestrator, IPs may be assigned to ports or
	FixedIPs           []FixedIPOrchestrationParams // to VMs directly
	AttachExternalDisk bool
	CloudConfigParams  VMCloudConfigParams
	VmAppOsType        edgeproto.VmAppOsType
	Routes             map[string][]edgeproto.Route // map of network name to routes
	ExistingVm         bool
	ExistingData       interface{}
}

VMOrchestrationParams contains all details that are needed by the orchestator

type VMPlatform

type VMPlatform struct {
	Type         string
	VMProvider   VMProvider
	VMProperties VMProperties

	Caches    *platform.Caches
	GPUConfig edgeproto.GPUConfig
	CacheDir  string
	infracommon.CommonEmbedded
	HAManager *redundancy.HighAvailabilityManager
	// contains filtered or unexported fields
}

VMPlatform contains the needed by all VM based platforms

func (*VMPlatform) ActivateFQDNs

func (v *VMPlatform) ActivateFQDNs(ctx context.Context, fqdn string, ips ...*ServerIP) error

func (*VMPlatform) ActiveChanged

func (v *VMPlatform) ActiveChanged(ctx context.Context, platformActive bool) error

func (*VMPlatform) AttachAndEnableRootLBInterface

func (v *VMPlatform) AttachAndEnableRootLBInterface(ctx context.Context, client ssh.Client, rootLBName string, attachPort bool, subnetNames SubnetNames, internalPortName string, internalIPs infracommon.IPs, vmAction ActionType) (*ServerDetail, string, error)

AttachAndEnableRootLBInterface attaches the interface and enables it in the OS. Returns the internal interface name

func (*VMPlatform) ChangeAppInstDNS

func (v *VMPlatform) ChangeAppInstDNS(ctx context.Context, app *edgeproto.App, appInst *edgeproto.AppInst, oldURI string, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) ChangeCloudletDNS

func (v *VMPlatform) ChangeCloudletDNS(ctx context.Context, cloudlet *edgeproto.Cloudlet, oldFqdn string, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) ChangeClusterInstDNS

func (v *VMPlatform) ChangeClusterInstDNS(ctx context.Context, clusterInst *edgeproto.ClusterInst, oldFqdn string, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) ConfigureCloudletSecurityRules

func (v *VMPlatform) ConfigureCloudletSecurityRules(ctx context.Context, action ActionType) error

func (*VMPlatform) ConfigureNetworkInterfaces

func (v *VMPlatform) ConfigureNetworkInterfaces(ctx context.Context, client ssh.Client, serverDetail *ServerDetail, configNetworks map[string]struct{}, defaultRouteNets map[string]struct{}, additionalRoutesByNetwork map[string][]edgeproto.Route) error

func (*VMPlatform) CreateAppInst

func (v *VMPlatform) CreateAppInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, appFlavor *edgeproto.Flavor, updateSender edgeproto.AppInstInfoSender) error

func (*VMPlatform) CreateCloudlet

func (v *VMPlatform) CreateCloudlet(ctx context.Context, cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, pfInitConfig *pf.PlatformInitConfig, pfFlavor *edgeproto.Flavor, caches *pf.Caches, updateCallback edgeproto.CacheUpdateCallback) (bool, error)

func (*VMPlatform) CreateClusterInst

func (v *VMPlatform) CreateClusterInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, updateCallback edgeproto.CacheUpdateCallback, timeout time.Duration) error

func (*VMPlatform) CreateRootLB

func (v *VMPlatform) CreateRootLB(
	ctx context.Context, rootLBName string,
	cloudletKey *edgeproto.CloudletKey,
	action ActionType,
	accessKey string,
	nodeRole cloudcommon.NodeRole,
	updateCallback edgeproto.CacheUpdateCallback,
) error

CreateOrUpdateRootLB creates or updates the rootLB

func (*VMPlatform) DeleteAppInst

func (v *VMPlatform) DeleteAppInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) DeleteCloudlet

func (v *VMPlatform) DeleteCloudlet(ctx context.Context, cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, pfInitConfig *pf.PlatformInitConfig, caches *pf.Caches, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) DeleteClusterInst

func (v *VMPlatform) DeleteClusterInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) DeleteTrustPolicyException

func (v *VMPlatform) DeleteTrustPolicyException(ctx context.Context, TrustPolicyExceptionKey *edgeproto.TrustPolicyExceptionKey, clusterKey *edgeproto.ClusterKey) error

func (*VMPlatform) DetachAndDisableRootLBInterface

func (v *VMPlatform) DetachAndDisableRootLBInterface(ctx context.Context, client ssh.Client, rootLBName string, subnetNames SubnetNames, internalPortName string) error

DetachAndDisableRootLBInterface performs some cleanup when deleting the rootLB port.

func (*VMPlatform) GatherCloudletInfo

func (v *VMPlatform) GatherCloudletInfo(ctx context.Context, info *edgeproto.CloudletInfo) error

func (*VMPlatform) GetAllCloudletVMs

func (v *VMPlatform) GetAllCloudletVMs(ctx context.Context, caches *platform.Caches) ([]VMAccess, error)

func (*VMPlatform) GetAppInstRuntime

func (v *VMPlatform) GetAppInstRuntime(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst) (*edgeproto.AppInstRuntime, error)

func (*VMPlatform) GetCachedFlavorList

func (v *VMPlatform) GetCachedFlavorList(ctx context.Context) ([]*edgeproto.FlavorInfo, error)

func (*VMPlatform) GetCloudlet

func (v *VMPlatform) GetCloudlet(ctx context.Context) (*edgeproto.Cloudlet, error)

func (*VMPlatform) GetCloudletGPUDriver

func (v *VMPlatform) GetCloudletGPUDriver(ctx context.Context) (*edgeproto.GPUDriver, error)

func (*VMPlatform) GetCloudletImageName

func (v *VMPlatform) GetCloudletImageName(ctx context.Context) (string, string, error)

GetCloudletImageName decides what image to use based on 1) if MEX_OS_IMAGE is specified in properties and not default, use that 2) Use image specified on startup based on cloudlet config

func (*VMPlatform) GetCloudletImageToUse

func (v *VMPlatform) GetCloudletImageToUse(ctx context.Context, updateCallback edgeproto.CacheUpdateCallback) (string, error)

GetCloudletImageToUse decides what image to use based on 1) if MEX_OS_IMAGE is specified in properties and not default, use that 2) Use image specified on startup based on cloudlet config 3) Add image to cloudlet image storage if not

func (*VMPlatform) GetCloudletInfraResources

func (v *VMPlatform) GetCloudletInfraResources(ctx context.Context) (*edgeproto.InfraResourcesSnapshot, error)

func (*VMPlatform) GetCloudletManifest

func (v *VMPlatform) GetCloudletManifest(ctx context.Context, cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, pfInitConfig *pf.PlatformInitConfig, accessApi platform.AccessApi, pfFlavor *edgeproto.Flavor, caches *platform.Caches) (*edgeproto.CloudletManifest, error)

func (*VMPlatform) GetClusterAccessIP

func (v *VMPlatform) GetClusterAccessIP(ctx context.Context, clusterInst *edgeproto.ClusterInst) (ServerIPs, error)

func (*VMPlatform) GetClusterAdditionalResourceMetric

func (v *VMPlatform) GetClusterAdditionalResourceMetric(ctx context.Context, cloudlet *edgeproto.Cloudlet, resMetric *edgeproto.Metric, resources []edgeproto.VMResource) error

func (*VMPlatform) GetClusterAdditionalResources

func (v *VMPlatform) GetClusterAdditionalResources(ctx context.Context, cloudlet *edgeproto.Cloudlet, vmResources []edgeproto.VMResource, infraResMap map[string]edgeproto.InfraResource) map[string]edgeproto.InfraResource

called by controller, make sure it doesn't make any calls to infra API

func (*VMPlatform) GetClusterInfraResources

func (v *VMPlatform) GetClusterInfraResources(ctx context.Context, cluster *edgeproto.ClusterInst) (*edgeproto.InfraResources, error)

func (*VMPlatform) GetClusterPlatformClient

func (v *VMPlatform) GetClusterPlatformClient(ctx context.Context, clusterInst *edgeproto.ClusterInst, clientType string) (ssh.Client, error)

func (*VMPlatform) GetClusterPlatformClientInternal

func (v *VMPlatform) GetClusterPlatformClientInternal(ctx context.Context, clusterInst *edgeproto.ClusterInst, clientType string, ops ...pc.SSHClientOp) (ssh.Client, error)

func (*VMPlatform) GetClusterSubnetName

func (v *VMPlatform) GetClusterSubnetName(ctx context.Context, clusterInst *edgeproto.ClusterInst) SubnetNames

func (*VMPlatform) GetConsoleUrl

func (v *VMPlatform) GetConsoleUrl(ctx context.Context, app *edgeproto.App, appInst *edgeproto.AppInst) (string, error)

func (*VMPlatform) GetContainerCommand

func (v *VMPlatform) GetContainerCommand(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, req *edgeproto.ExecRequest) (string, error)

func (*VMPlatform) GetDedicatedRootLBClients

func (v *VMPlatform) GetDedicatedRootLBClients(ctx context.Context) (map[string]platform.RootLBClient, error)

GetDedicatedRootLBClients gets all RootLB Clients for dedicated LBs and mapping of lbnames to FQDN.

func (*VMPlatform) GetDefaultRootLBFlavor

func (v *VMPlatform) GetDefaultRootLBFlavor(ctx context.Context) (*edgeproto.FlavorInfo, error)

used by cloudlet.go currently

func (*VMPlatform) GetDockerNodeName

func (v *VMPlatform) GetDockerNodeName(ctx context.Context, clusterInst *edgeproto.ClusterInst) string

func (*VMPlatform) GetExternalIPFromServerName

func (v *VMPlatform) GetExternalIPFromServerName(ctx context.Context, serverName string, ops ...GetIPOp) (ServerIPs, error)

GetExternalIPFromServerName gets the external ipv4 and ipv6 addresses from the defined external network names, for the given server name. We expect that if multiple external networks are defined, only one IP of each type is present across all networks.

func (*VMPlatform) GetFeatures

func (v *VMPlatform) GetFeatures() *edgeproto.PlatformFeatures

func (*VMPlatform) GetIPFromServerName

func (v *VMPlatform) GetIPFromServerName(ctx context.Context, networkName string, subnetNames SubnetNames, serverName string, ops ...GetIPOp) (ServerIPs, error)

GetIPFromServerName returns the IPv4 and IPv6 for the givens serverName, on either the network or subnetName, preferring the subnet name. Optionally lookup and store to cache can be specified.

func (*VMPlatform) GetInitHAConditionalCompatibilityVersion

func (v *VMPlatform) GetInitHAConditionalCompatibilityVersion(ctx context.Context) string

for now there is only only HA Conditional compat version for all providers. This could be changed if needed, but if a provider specific version is defined it should be appended to the VMPlatform version in place of v.Type in case the VMPlatform init sequence changes

func (*VMPlatform) GetInterfaceNameForMac

func (v *VMPlatform) GetInterfaceNameForMac(ctx context.Context, client ssh.Client, mac string) string

func (*VMPlatform) GetNodePlatformClient

func (v *VMPlatform) GetNodePlatformClient(ctx context.Context, node *edgeproto.CloudletMgmtNode, ops ...pc.SSHClientOp) (ssh.Client, error)

func (*VMPlatform) GetPlatformNodes

func (v *VMPlatform) GetPlatformNodes(cloudlet *edgeproto.Cloudlet) []NodeInfo

func (*VMPlatform) GetPlatformSubnetName

func (v *VMPlatform) GetPlatformSubnetName(key *edgeproto.CloudletKey) SubnetNames

func (*VMPlatform) GetPlatformVMName

func (v *VMPlatform) GetPlatformVMName(key *edgeproto.CloudletKey) string

func (*VMPlatform) GetResTablesForCloudlet

func (v *VMPlatform) GetResTablesForCloudlet(ctx context.Context, ckey *edgeproto.CloudletKey) ResTagTables

func (*VMPlatform) GetRestrictedCloudletStatus

func (v *VMPlatform) GetRestrictedCloudletStatus(ctx context.Context, cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, accessApi platform.AccessApi, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) GetRootLBClientForClusterKey

func (v *VMPlatform) GetRootLBClientForClusterKey(ctx context.Context, clusterKey *edgeproto.ClusterKey) (map[string]platform.RootLBClient, error)

func (*VMPlatform) GetRootLBClients

func (v *VMPlatform) GetRootLBClients(ctx context.Context) (map[string]platform.RootLBClient, error)

GetRootLBClients gets rootLb clients for both Shared and Dedicated LBs

func (*VMPlatform) GetRootLBFlavor

func (v *VMPlatform) GetRootLBFlavor(ctx context.Context) (*edgeproto.Flavor, error)

func (*VMPlatform) GetRootLBName

func (v *VMPlatform) GetRootLBName(key *edgeproto.CloudletKey) string

GetRootLBName uses the old rootLB name format to ensure backwards compatibility. Ideally we'd have some check that could tell us whether to use the old name (if the VM exists), or the new name, but setting the VMProperties.SharedRootLBName is done early in Init(), and it has many dependencies, and we cannot actually check for VM existence until later after the VMProvider is initialized. So for safety we're going to keep the VM name the same, and only use the new RootLBFQDN name for the DNS registration.

func (*VMPlatform) GetSSHClientForCluster

func (v *VMPlatform) GetSSHClientForCluster(ctx context.Context, clusterInst *edgeproto.ClusterInst) (ssh.Client, error)

func (*VMPlatform) GetSSHClientForServer

func (v *VMPlatform) GetSSHClientForServer(ctx context.Context, serverName, networkName string, ops ...pc.SSHClientOp) (ssh.Client, error)

GetSSHClient returns ssh client handle for the server

func (*VMPlatform) GetSanitizedCloudletName

func (v *VMPlatform) GetSanitizedCloudletName(key *edgeproto.CloudletKey) string

func (*VMPlatform) GetSubnetGatewayFromVMGroupParms

func (v *VMPlatform) GetSubnetGatewayFromVMGroupParms(ctx context.Context, subnetNames SubnetNames, vmgp *VMGroupOrchestrationParams) (infracommon.IPs, error)

func (*VMPlatform) GetVMAppSubnetNames

func (v *VMPlatform) GetVMAppSubnetNames(appVmName string) SubnetNames

func (*VMPlatform) GetVMGroupOrchestrationParamsFromVMSpec

func (v *VMPlatform) GetVMGroupOrchestrationParamsFromVMSpec(ctx context.Context, name, ownerID string, vms []*VMRequestSpec, opts ...VMGroupReqOp) (*VMGroupOrchestrationParams, error)

func (*VMPlatform) GetVMRequestSpec

func (v *VMPlatform) GetVMRequestSpec(ctx context.Context, nodeType cloudcommon.NodeType, serverName, flavorName string, imageName string, connectExternal bool, opts ...VMReqOp) (*VMRequestSpec, error)

func (*VMPlatform) GetVMSpecForRootLB

func (v *VMPlatform) GetVMSpecForRootLB(ctx context.Context, rootLbName string, subnetConnect SubnetNames, ownerKey objstore.ObjKey, addNets map[string]NetworkType, addRoutes map[string][]edgeproto.Route, accessKey string, nodeRole cloudcommon.NodeRole, updateCallback edgeproto.CacheUpdateCallback) (*VMRequestSpec, error)

GetVMSpecForRootLB gets the VM spec for the rootLB when it is not specified within a cluster. This is used for Shared RootLb and for VM app based RootLb

func (*VMPlatform) GetVMSpecForSharedRootLBPorts

func (v *VMPlatform) GetVMSpecForSharedRootLBPorts(ctx context.Context, rootLbName string, subnets SubnetNames) (*VMRequestSpec, error)

GetVMSpecForSharedRootLBPorts get a vmspec for the purpose of creating new ports to the specified subnet

func (*VMPlatform) HandleFedAppInstCb

func (*VMPlatform) HandleFedAppInstCb(ctx context.Context, msg *edgeproto.FedAppInstEvent)

func (*VMPlatform) InitCommon

func (v *VMPlatform) InitCommon(ctx context.Context, platformConfig *platform.PlatformConfig, caches *platform.Caches, haMgr *redundancy.HighAvailabilityManager, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) InitHAConditional

func (v *VMPlatform) InitHAConditional(ctx context.Context, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) InitProps

func (v *VMPlatform) InitProps(ctx context.Context, platformConfig *platform.PlatformConfig, ops ...infracommon.InitOp) error

func (*VMPlatform) IsCloudletServicesLocal

func (v *VMPlatform) IsCloudletServicesLocal() bool

func (*VMPlatform) ListCloudletMgmtNodes

func (v *VMPlatform) ListCloudletMgmtNodes(ctx context.Context, clusterInsts []edgeproto.ClusterInst, vmAppInsts []edgeproto.AppInst) ([]edgeproto.CloudletMgmtNode, error)

func (*VMPlatform) NameSanitize

func (v *VMPlatform) NameSanitize(name string) string

func (*VMPlatform) OrchestrateVMsFromVMSpec

func (v *VMPlatform) OrchestrateVMsFromVMSpec(ctx context.Context, name, ownerID string, vms []*VMRequestSpec, action ActionType, updateCallback edgeproto.CacheUpdateCallback, opts ...VMGroupReqOp) (*VMGroupOrchestrationParams, error)

OrchestrateVMsFromVMSpec calls the provider function to do the orchestation of the VMs. It returns the updated VM group spec

func (*VMPlatform) PerformOrchestrationForCluster

func (v *VMPlatform) PerformOrchestrationForCluster(ctx context.Context, imgName string, clusterInst *edgeproto.ClusterInst, action ActionType, updateInfo map[string]string, updateCallback edgeproto.CacheUpdateCallback) (*VMGroupOrchestrationParams, error)

func (*VMPlatform) PerformOrchestrationForVMApp

func (v *VMPlatform) PerformOrchestrationForVMApp(ctx context.Context, app *edgeproto.App, appInst *edgeproto.AppInst, action ActionType, updateCallback edgeproto.CacheUpdateCallback) (*vmAppOrchValues, error)

func (*VMPlatform) PerformUpgrades

func (v *VMPlatform) PerformUpgrades(ctx context.Context, caches *platform.Caches, cloudletState dme.CloudletState) error

func (*VMPlatform) SetExternalGateways

func (v *VMPlatform) SetExternalGateways(ctx context.Context, serverDetail *ServerDetail, gatewayIPs infracommon.IPs) error

func (*VMPlatform) SetPowerState

func (v *VMPlatform) SetPowerState(ctx context.Context, app *edgeproto.App, appInst *edgeproto.AppInst, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) SetupPlatformVM

func (v *VMPlatform) SetupPlatformVM(ctx context.Context, accessApi platform.AccessApi, cloudlet *edgeproto.Cloudlet, pfConfig *edgeproto.PlatformConfig, pfFlavor *edgeproto.Flavor, updateCallback edgeproto.CacheUpdateCallback) error

setupPlatformVM:

  • Downloads Cloudlet VM base image (if not-present)
  • Brings up Platform VM (using vm provider stack)
  • Sets up Security Group for access to Cloudlet

Returns ssh client

func (*VMPlatform) SetupRootLB

func (v *VMPlatform) SetupRootLB(
	ctx context.Context, rootLBName, rootLBFQDN string,
	cloudletKey *edgeproto.CloudletKey,
	TrustPolicy *edgeproto.TrustPolicy,
	sd *ServerDetail,
	enableIPV6 bool,
	updateCallback edgeproto.CacheUpdateCallback,
) error

SetupRootLB prepares the RootLB.

func (*VMPlatform) StartDHCPServerForVMApp

func (v *VMPlatform) StartDHCPServerForVMApp(ctx context.Context, client ssh.Client, serverDetail *ServerDetail, internalIfName string, vmips ServerIPs, vmname string) error

StartDhcpServerForVmApp sets up a DHCP server on the LB to enable the VMApp to get an IP address configured for VM providers which do not have DHCP built in for internal networks.

func (*VMPlatform) UpdateAppInst

func (v *VMPlatform) UpdateAppInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, app *edgeproto.App, appInst *edgeproto.AppInst, flavor *edgeproto.Flavor, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) UpdateCloudlet

func (v *VMPlatform) UpdateCloudlet(ctx context.Context, cloudlet *edgeproto.Cloudlet, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) UpdateClusterInst

func (v *VMPlatform) UpdateClusterInst(ctx context.Context, clusterInst *edgeproto.ClusterInst, updateCallback edgeproto.CacheUpdateCallback) error

func (*VMPlatform) UpdateTrustPolicy

func (v *VMPlatform) UpdateTrustPolicy(ctx context.Context, TrustPolicy *edgeproto.TrustPolicy) error

func (*VMPlatform) UpdateTrustPolicyException

func (v *VMPlatform) UpdateTrustPolicyException(ctx context.Context, TrustPolicyException *edgeproto.TrustPolicyException, clusterKey *edgeproto.ClusterKey) error

func (*VMPlatform) VerifyVMs

func (v *VMPlatform) VerifyVMs(ctx context.Context, vms []edgeproto.VM) error

type VMProperties

type VMProperties struct {
	CommonPf                          infracommon.CommonPlatform
	SharedRootLBName                  string
	Domain                            VMDomain
	PlatformSecgrpName                string
	CloudletSecgrpName                string
	IptablesBasedFirewall             bool
	Upgrade                           bool
	UseSecgrpForInternalSubnet        bool
	RequiresWhitelistOwnIp            bool
	RunLbDhcpServerForVmApps          bool
	AppendFlavorToVmAppImage          bool
	ValidateExternalIPMapping         bool
	CloudletEnableIPV6                bool // enable IPv6 on shared rootLB and shared security groups which may affect all LBs
	CloudletAccessToken               string
	NumCleanupRetries                 int
	UsesCommonSharedInternalLBNetwork bool
	PlatformExternalNetwork           string
	UseTestCACert                     bool
}

func (*VMProperties) GetCloudletAdditionalPlatformNetworks

func (vp *VMProperties) GetCloudletAdditionalPlatformNetworks() []string

func (*VMProperties) GetCloudletAdditionalRootLbNetworks

func (vp *VMProperties) GetCloudletAdditionalRootLbNetworks() []string

func (*VMProperties) GetCloudletComputeAvailabilityZone

func (vp *VMProperties) GetCloudletComputeAvailabilityZone() string

func (*VMProperties) GetCloudletDNS

func (vp *VMProperties) GetCloudletDNS() string

func (*VMProperties) GetCloudletDNSIPV6

func (vp *VMProperties) GetCloudletDNSIPV6() string

func (*VMProperties) GetCloudletExternalNetwork

func (vp *VMProperties) GetCloudletExternalNetwork() string

func (*VMProperties) GetCloudletExternalNetworkSecondary

func (vp *VMProperties) GetCloudletExternalNetworkSecondary() string

func (*VMProperties) GetCloudletExternalNetworks

func (vp *VMProperties) GetCloudletExternalNetworks() []string

func (*VMProperties) GetCloudletExternalRouter

func (vp *VMProperties) GetCloudletExternalRouter() string

func (*VMProperties) GetCloudletFlavorMatchPattern

func (vp *VMProperties) GetCloudletFlavorMatchPattern() string

func (*VMProperties) GetCloudletImageDiskFormat

func (vp *VMProperties) GetCloudletImageDiskFormat() string

func (*VMProperties) GetCloudletMexNetwork

func (vp *VMProperties) GetCloudletMexNetwork() string

GetCloudletNetwork returns default MEX network, internal and prepped

func (*VMProperties) GetCloudletNetworkAvailabilityZone

func (vp *VMProperties) GetCloudletNetworkAvailabilityZone() string

func (*VMProperties) GetCloudletNetworkScheme

func (vp *VMProperties) GetCloudletNetworkScheme() string

func (*VMProperties) GetCloudletOSImage

func (vp *VMProperties) GetCloudletOSImage() string

func (*VMProperties) GetCloudletSharedRootLBFlavor

func (vp *VMProperties) GetCloudletSharedRootLBFlavor(flavor *edgeproto.Flavor) error

GetCloudletSharedRootLBFlavor gets the flavor from defaults or environment variables

func (*VMProperties) GetCloudletVolumeAvailabilityZone

func (vp *VMProperties) GetCloudletVolumeAvailabilityZone() string

func (*VMProperties) GetDeploymentTag

func (vp *VMProperties) GetDeploymentTag() string

func (*VMProperties) GetEnableAntiAffinity

func (vp *VMProperties) GetEnableAntiAffinity() bool

func (*VMProperties) GetFlavorListInternal

func (vp *VMProperties) GetFlavorListInternal(ctx context.Context, caches *platform.Caches) ([]*edgeproto.FlavorInfo, error)

For platforms without native flavor support, just use our meta flavors Adjust flavor size if subpar.

func (*VMProperties) GetInternalNetworkRoute

func (v *VMProperties) GetInternalNetworkRoute(ctx context.Context, commonSharedNetwork bool) (string, string, error)

func (*VMProperties) GetMetalLBAddresses

func (vp *VMProperties) GetMetalLBAddresses(ctx context.Context, masterIPs ServerIPs) ([]string, error)

func (*VMProperties) GetMetalLBIPV6Range

func (vp *VMProperties) GetMetalLBIPV6Range() (string, string, error)

func (*VMProperties) GetMetalLBIPV6RangeFromMasterIp

func (vp *VMProperties) GetMetalLBIPV6RangeFromMasterIp(ctx context.Context, masterIPV6 string) (string, error)

func (*VMProperties) GetMetalLBIp3rdOctetRange

func (vp *VMProperties) GetMetalLBIp3rdOctetRange() (uint64, uint64, error)

func (*VMProperties) GetMetalLBIp3rdOctetRangeFromMasterIp

func (vp *VMProperties) GetMetalLBIp3rdOctetRangeFromMasterIp(ctx context.Context, masterIP string) (string, error)

GetMetalLBIp3rdOctetRangeFromMasterIp gives an IP range on the same subnet as the master IP

func (*VMProperties) GetNetworksByType

func (vp *VMProperties) GetNetworksByType(ctx context.Context, netTypes []NetworkType) map[string]NetworkType

GetNetworksByType returns a map of networkName -> Type

func (*VMProperties) GetNodeTypeForVmNameAndRole

func (v *VMProperties) GetNodeTypeForVmNameAndRole(vmname, role string) cloudcommon.NodeType

func (*VMProperties) GetNtpServers

func (vp *VMProperties) GetNtpServers() []string

func (*VMProperties) GetRegion

func (vp *VMProperties) GetRegion() string

func (*VMProperties) GetRootLBNameForCluster

func (vp *VMProperties) GetRootLBNameForCluster(ctx context.Context, clusterInst *edgeproto.ClusterInst) string

func (*VMProperties) GetSharedCommonSubnetName

func (vp *VMProperties) GetSharedCommonSubnetName() SubnetNames

func (*VMProperties) GetSkipInstallResourceTracker

func (vp *VMProperties) GetSkipInstallResourceTracker() bool

func (*VMProperties) GetSubnetDNS

func (vp *VMProperties) GetSubnetDNS() string

func (*VMProperties) GetSubnetsIgnoreDHCP

func (vp *VMProperties) GetSubnetsIgnoreDHCP() []string

func (*VMProperties) GetUsesMetalLb

func (vp *VMProperties) GetUsesMetalLb() bool

func (*VMProperties) GetVMAppCleanupImageOnDelete

func (vp *VMProperties) GetVMAppCleanupImageOnDelete() bool

func (*VMProperties) GetVMAppSubnetDHCPEnabled

func (vp *VMProperties) GetVMAppSubnetDHCPEnabled() string

func (*VMProperties) GetVmAppMetricsCollectInterval

func (vp *VMProperties) GetVmAppMetricsCollectInterval() (uint64, error)

func (*VMProperties) SetCloudletExternalNetwork

func (vp *VMProperties) SetCloudletExternalNetwork(name string)

func (*VMProperties) SetupIptablesRulesForRootLB

func (v *VMProperties) SetupIptablesRulesForRootLB(ctx context.Context, client ssh.Client, sshCidrsAllowed []string, egressRestricted bool, secGrpName string, rules []edgeproto.SecurityRule, commonSharedAccess, enableIPV6 bool) error

type VMProvider

type VMProvider interface {
	NameSanitize(string) string
	IdSanitize(string) string
	SetVMProperties(vmProperties *VMProperties)
	GetFeatures() *edgeproto.PlatformFeatures
	InitData(ctx context.Context, caches *platform.Caches)
	InitProvider(ctx context.Context, caches *platform.Caches, stage ProviderInitStage, updateCallback edgeproto.CacheUpdateCallback) error
	GetFlavorList(ctx context.Context) ([]*edgeproto.FlavorInfo, error)
	GetNetworkList(ctx context.Context) ([]string, error)
	AddImageIfNotPresent(ctx context.Context, imageInfo *infracommon.ImageInfo, updateCallback edgeproto.CacheUpdateCallback) error
	GetCloudletImageSuffix(ctx context.Context) string
	DeleteImage(ctx context.Context, folder, image string) error
	GetServerDetail(ctx context.Context, serverName string) (*ServerDetail, error)
	GetConsoleUrl(ctx context.Context, serverName string) (string, error)
	GetInternalPortPolicy() InternalPortAttachPolicy
	AttachPortToServer(ctx context.Context, serverName string, subnetNames SubnetNames, portName string, ips infracommon.IPs, action ActionType) error
	DetachPortFromServer(ctx context.Context, serverName string, subnetNames SubnetNames, portName string) error
	PrepareRootLB(ctx context.Context, client ssh.Client, rootLBName string, secGrpName string, TrustPolicy *edgeproto.TrustPolicy, updateCallback edgeproto.CacheUpdateCallback) error
	WhitelistSecurityRules(ctx context.Context, client ssh.Client, wlParams *infracommon.WhiteListParams) error
	RemoveWhitelistSecurityRules(ctx context.Context, client ssh.Client, wlParams *infracommon.WhiteListParams) error
	GetResourceID(ctx context.Context, resourceType ResourceType, resourceName string) (string, error)
	InitApiAccessProperties(ctx context.Context, accessApi platform.AccessApi, vars map[string]string) error
	GetApiEndpointAddr(ctx context.Context) (string, error)
	GetExternalGateway(ctx context.Context, extNetName string) (string, error)
	SetPowerState(ctx context.Context, serverName, serverAction string) error
	GatherCloudletInfo(ctx context.Context, info *edgeproto.CloudletInfo) error
	GetCloudletManifest(ctx context.Context, name string, cloudletImagePath string, VMGroupOrchestrationParams *VMGroupOrchestrationParams) (string, error)
	GetRouterDetail(ctx context.Context, routerName string) (*RouterDetail, error)
	CreateVMs(ctx context.Context, vmGroupOrchestrationParams *VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error
	UpdateVMs(ctx context.Context, vmGroupOrchestrationParams *VMGroupOrchestrationParams, updateCallback edgeproto.CacheUpdateCallback) error
	DeleteVMs(ctx context.Context, vmGroupName, ownerID string) error
	GetVMStats(ctx context.Context, appInst *edgeproto.AppInst) (*VMMetrics, error)
	GetPlatformResourceInfo(ctx context.Context) (*PlatformResources, error)
	VerifyVMs(ctx context.Context, vms []edgeproto.VM) error
	CheckServerReady(ctx context.Context, client ssh.Client, serverName string) error
	GetServerGroupResources(ctx context.Context, name string) (*edgeproto.InfraResources, error)
	ValidateAdditionalNetworks(ctx context.Context, additionalNets map[string]NetworkType) error
	ConfigureCloudletSecurityRules(ctx context.Context, egressRestricted bool, TrustPolicy *edgeproto.TrustPolicy, rootlbClients map[string]platform.RootLBClient, action ActionType, updateCallback edgeproto.CacheUpdateCallback) error
	ConfigureTrustPolicyExceptionSecurityRules(ctx context.Context, TrustPolicyException *edgeproto.TrustPolicyException, rootLbClients map[string]platform.RootLBClient, action ActionType, updateCallback edgeproto.CacheUpdateCallback) error
	InitOperationContext(ctx context.Context, operationStage OperationInitStage) (context.Context, OperationInitResult, error)
	GetCloudletInfraResourcesInfo(ctx context.Context) ([]edgeproto.InfraResource, error)
	GetClusterAdditionalResources(ctx context.Context, cloudlet *edgeproto.Cloudlet, vmResources []edgeproto.VMResource, infraResMap map[string]edgeproto.InfraResource) map[string]edgeproto.InfraResource
	GetClusterAdditionalResourceMetric(ctx context.Context, cloudlet *edgeproto.Cloudlet, resMetric *edgeproto.Metric, resources []edgeproto.VMResource) error
	InternalCloudletUpdatedCallback(ctx context.Context, old *edgeproto.CloudletInternal, new *edgeproto.CloudletInternal)
	VmAppChangedCallback(ctx context.Context, appInst *edgeproto.AppInst, newState edgeproto.TrackedState)
	GetGPUSetupStage(ctx context.Context) GPUSetupStage
	ActiveChanged(ctx context.Context, platformActive bool) error
}

type VMReqOp

type VMReqOp func(vmp *VMRequestSpec) error

func WithAccessKey

func WithAccessKey(accessKey string) VMReqOp

func WithAdditionalNetworks

func WithAdditionalNetworks(networks map[string]NetworkType) VMReqOp

func WithCommand

func WithCommand(command string) VMReqOp

func WithComputeAvailabilityZone

func WithComputeAvailabilityZone(zone string) VMReqOp

func WithConfigureNodeVars

func WithConfigureNodeVars(v *VMPlatform, nodeRole cloudcommon.NodeRole, ckey *edgeproto.CloudletKey, ownerKey objstore.ObjKey) VMReqOp

func WithCreatePortsOnly

func WithCreatePortsOnly(portsonly bool) VMReqOp

func WithDeploymentManifest

func WithDeploymentManifest(deploymentManifest string) VMReqOp

func WithExternalVolume

func WithExternalVolume(size uint64) VMReqOp

func WithImageFolder

func WithImageFolder(folder string) VMReqOp

func WithOptionalResource

func WithOptionalResource(optRes string) VMReqOp

func WithPublicKey

func WithPublicKey(authPublicKey string) VMReqOp

func WithRoutes

func WithRoutes(routes map[string][]edgeproto.Route) VMReqOp

func WithSharedVolume

func WithSharedVolume(size uint64) VMReqOp

func WithSubnetConnection

func WithSubnetConnection(subnetNames SubnetNames) VMReqOp

func WithVmAppOsType

func WithVmAppOsType(osType edgeproto.VmAppOsType) VMReqOp

type VMRequestSpec

type VMRequestSpec struct {
	Name                    string
	Type                    cloudcommon.NodeType
	FlavorName              string
	ImageName               string
	ImageFolder             string
	ComputeAvailabilityZone string
	AuthPublicKey           string
	ExternalVolumeSize      uint64
	SharedVolumeSize        uint64
	DeploymentManifest      string
	Command                 string
	ConnectToExternalNet    bool
	CreatePortsOnly         bool
	ConnectToSubnets        SubnetNames
	ConfigureNodeVars       *confignode.ConfigureNodeVars
	OptionalResource        string
	AccessKey               string
	AdditionalNetworks      map[string]NetworkType
	Routes                  map[string][]edgeproto.Route
	VmAppOsType             edgeproto.VmAppOsType
}

VMRequestSpec has the infromation which the caller needs to provide when creating a VM.

type VMRole

type VMRole string
var RoleAgent VMRole = "mex-agent-node"
var RoleDockerNode VMRole = "docker-node"
var RoleK8sNode VMRole = "k8s-node"
var RoleMaster VMRole = "k8s-master"
var RoleMatchAny VMRole = "any" // not a real role, used for matching
var RoleVMApplication VMRole = "vmapp"
var RoleVMPlatform VMRole = "platform"

type VMUpdateList

type VMUpdateList struct {
	CurrentVMs  (map[string]string)
	NewVMs      (map[string]*VMOrchestrationParams)
	VmsToCreate (map[string]*VMOrchestrationParams)
	VmsToDelete (map[string]string)
}

type VmConfigDataFormatter

type VmConfigDataFormatter func(instring string) string

VmConfigDataFormatter formats user or meta data to fit into orchestration templates

type VolumeOrchestrationParams

type VolumeOrchestrationParams struct {
	Name               string
	ImageName          string
	Size               uint64
	AvailabilityZone   string
	DeviceName         string
	AttachExternalDisk bool
	UnitNumber         uint64
}

type VolumeOrchestrationParamsOp

type VolumeOrchestrationParamsOp func(vmp *VolumeOrchestrationParams) error

Jump to

Keyboard shortcuts

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