vsphere

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderName                  = "vsphere"
	VolDir                        = "kubevols"
	RoundTripperDefaultCount      = 3
	DummyVMPrefixName             = "vsphere-k8s"
	VSANDatastoreType             = "vsan"
	MacOuiVC                      = "00:50:56"
	MacOuiEsx                     = "00:0c:29"
	CleanUpDummyVMRoutineInterval = 5
	UUIDPath                      = "/sys/class/dmi/id/product_serial"
	UUIDPrefix                    = "VMware-"
)

VSphere Cloud Provider constants

View Source
const (
	DatastoreProperty     = "datastore"
	DatastoreInfoProperty = "info"
	Folder                = "Folder"
	VirtualMachine        = "VirtualMachine"
	DummyDiskName         = "kube-dummyDisk.vmdk"
)

Variables

This section is empty.

Functions

func GetgovmomiClient added in v1.6.0

func GetgovmomiClient(conn *vclib.VSphereConnection) (*govmomi.Client, error)

GetgovmomiClient gets the goVMOMI client for the vsphere connection object

Types

type VSphere

type VSphere struct {
	// contains filtered or unexported fields
}

VSphere is an implementation of cloud provider Interface for VSphere.

func GetVSphere added in v1.6.0

func GetVSphere() (*VSphere, error)

GetVSphere reads vSphere configuration from system environment and construct vSphere object

func (*VSphere) AddSSHKeyToAllInstances added in v1.6.5

func (vs *VSphere) AddSSHKeyToAllInstances(user string, keyData []byte) error

AddSSHKeyToAllInstances add SSH key to all instances

func (*VSphere) AttachDisk

func (vs *VSphere) AttachDisk(vmDiskPath string, storagePolicyID string, nodeName k8stypes.NodeName) (diskUUID string, err error)

AttachDisk attaches given virtual disk volume to the compute running kubelet.

func (*VSphere) Clusters

func (vs *VSphere) Clusters() (cloudprovider.Clusters, bool)

func (*VSphere) CreateVolume

func (vs *VSphere) CreateVolume(volumeOptions *vclib.VolumeOptions) (canonicalVolumePath string, err error)

CreateVolume creates a volume of given size (in KiB) and return the volume path. If the volumeOptions.Datastore is part of datastore cluster for example - DatastoreCluster/sharedVmfs-0 then return value will be DatastoreCluster/sharedVmfs-0 kubevols/<volume-name>.vmdk else return value will be [sharedVmfs-0] kubevols/<volume-name>.vmdk

func (*VSphere) CurrentNodeName added in v1.6.5

func (vs *VSphere) CurrentNodeName(hostname string) (k8stypes.NodeName, error)

CurrentNodeName gives the current node name

func (*VSphere) DeleteVolume

func (vs *VSphere) DeleteVolume(vmDiskPath string) error

DeleteVolume deletes a volume given volume name.

func (*VSphere) DetachDisk

func (vs *VSphere) DetachDisk(volPath string, nodeName k8stypes.NodeName) error

DetachDisk detaches given virtual disk volume from the compute running kubelet.

func (*VSphere) DiskIsAttached added in v1.4.0

func (vs *VSphere) DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (bool, error)

DiskIsAttached returns if disk is attached to the VM using controllers supported by the plugin.

func (*VSphere) DisksAreAttached added in v1.4.6

func (vs *VSphere) DisksAreAttached(nodeVolumes map[k8stypes.NodeName][]string) (map[k8stypes.NodeName]map[string]bool, error)

DisksAreAttached returns if disks are attached to the VM using controllers supported by the plugin.

func (*VSphere) ExternalID added in v1.6.5

func (vs *VSphere) ExternalID(nodeName k8stypes.NodeName) (string, error)

ExternalID returns the cloud provider ID of the node with the specified Name (deprecated).

func (*VSphere) HasClusterID added in v1.8.0

func (vs *VSphere) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*VSphere) Initialize added in v1.7.0

func (vs *VSphere) Initialize(clientBuilder controller.ControllerClientBuilder)

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*VSphere) InstanceExistsByProviderID added in v1.8.0

func (vs *VSphere) InstanceExistsByProviderID(providerID string) (bool, error)

InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.

func (*VSphere) InstanceID added in v1.6.5

func (vs *VSphere) InstanceID(nodeName k8stypes.NodeName) (string, error)

InstanceID returns the cloud provider ID of the node with the specified Name.

func (*VSphere) InstanceType added in v1.6.5

func (vs *VSphere) InstanceType(name k8stypes.NodeName) (string, error)

func (*VSphere) InstanceTypeByProviderID added in v1.6.5

func (vs *VSphere) InstanceTypeByProviderID(providerID string) (string, error)

InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*VSphere) Instances

func (vs *VSphere) Instances() (cloudprovider.Instances, bool)

Instances returns an implementation of Instances for vSphere.

func (*VSphere) LoadBalancer

func (vs *VSphere) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns an implementation of LoadBalancer for vSphere.

func (*VSphere) NodeAddresses added in v1.6.5

func (vs *VSphere) NodeAddresses(nodeName k8stypes.NodeName) ([]v1.NodeAddress, error)

NodeAddresses is an implementation of Instances.NodeAddresses.

func (*VSphere) NodeAddressesByProviderID added in v1.6.5

func (vs *VSphere) NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error)

NodeAddressesByProviderID returns the node addresses of an instances with the specified unique providerID This method will not be called from the node that is requesting this ID. i.e. metadata service and other local methods cannot be used here

func (*VSphere) ProviderName

func (vs *VSphere) ProviderName() string

ProviderName returns the cloud provider ID.

func (*VSphere) Routes

func (vs *VSphere) Routes() (cloudprovider.Routes, bool)

Routes returns a false since the interface is not supported for vSphere.

func (*VSphere) ScrubDNS

func (vs *VSphere) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

ScrubDNS filters DNS settings for pods.

func (*VSphere) Zones

func (vs *VSphere) Zones() (cloudprovider.Zones, bool)

Zones returns an implementation of Zones for Google vSphere.

type VSphereConfig

type VSphereConfig struct {
	Global struct {
		// vCenter username.
		User string `gcfg:"user"`
		// vCenter password in clear text.
		Password string `gcfg:"password"`
		// vCenter IP.
		VCenterIP string `gcfg:"server"`
		// vCenter port.
		VCenterPort string `gcfg:"port"`
		// True if vCenter uses self-signed cert.
		InsecureFlag bool `gcfg:"insecure-flag"`
		// Datacenter in which VMs are located.
		Datacenter string `gcfg:"datacenter"`
		// Datastore in which vmdks are stored.
		Datastore string `gcfg:"datastore"`
		// WorkingDir is path where VMs can be found.
		WorkingDir string `gcfg:"working-dir"`
		// Soap round tripper count (retries = RoundTripper - 1)
		RoundTripperCount uint `gcfg:"soap-roundtrip-count"`
		// VMUUID is the VM Instance UUID of virtual machine which can be retrieved from instanceUuid
		// property in VmConfigInfo, or also set as vc.uuid in VMX file.
		// If not set, will be fetched from the machine via sysfs (requires root)
		VMUUID string `gcfg:"vm-uuid"`
		// VMName is the VM name of virtual machine
		// Combining the WorkingDir and VMName can form a unique InstanceID.
		// When vm-name is set, no username/password is required on worker nodes.
		VMName string `gcfg:"vm-name"`
	}

	Network struct {
		// PublicNetwork is name of the network the VMs are joined to.
		PublicNetwork string `gcfg:"public-network"`
	}

	Disk struct {
		// SCSIControllerType defines SCSI controller to be used.
		SCSIControllerType string `dcfg:"scsicontrollertype"`
	}
}

VSphereConfig information that is used by vSphere Cloud Provider to connect to VC

type Volumes added in v1.4.0

type Volumes interface {
	// AttachDisk attaches given disk to given node. Current node
	// is used when nodeName is empty string.
	AttachDisk(vmDiskPath string, storagePolicyID string, nodeName k8stypes.NodeName) (diskUUID string, err error)

	// DetachDisk detaches given disk to given node. Current node
	// is used when nodeName is empty string.
	// Assumption: If node doesn't exist, disk is already detached from node.
	DetachDisk(volPath string, nodeName k8stypes.NodeName) error

	// DiskIsAttached checks if a disk is attached to the given node.
	// Assumption: If node doesn't exist, disk is not attached to the node.
	DiskIsAttached(volPath string, nodeName k8stypes.NodeName) (bool, error)

	// DisksAreAttached checks if a list disks are attached to the given node.
	// Assumption: If node doesn't exist, disks are not attached to the node.
	DisksAreAttached(nodeVolumes map[k8stypes.NodeName][]string) (map[k8stypes.NodeName]map[string]bool, error)

	// CreateVolume creates a new vmdk with specified parameters.
	CreateVolume(volumeOptions *vclib.VolumeOptions) (volumePath string, err error)

	// DeleteVolume deletes vmdk.
	DeleteVolume(vmDiskPath string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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