photon

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

This version of Photon cloud provider supports the disk interface for Photon persistent disk volume plugin. LoadBalancer, Routes, and Zones are currently not supported. The use of Photon cloud provider requires to start kubelet, kube-apiserver, and kube-controller-manager with config flag: '--cloud-provider=photon --cloud-config=[path_to_config_file]'. When running multi-node kubernetes using docker, the config file should be located inside /etc/kubernetes.

Index

Constants

View Source
const (
	ProviderName = "photon"
	DiskSpecKind = "persistent-disk"
	MAC_OUI_VC   = "00:50:56"
	MAC_OUI_ESX  = "00:0c:29"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Disks

type Disks interface {
	// AttachDisk attaches given disk to given node. Current node
	// is used when nodeName is empty string.
	AttachDisk(ctx context.Context, pdID string, nodeName k8stypes.NodeName) error

	// DetachDisk detaches given disk to given node. Current node
	// is used when nodeName is empty string.
	DetachDisk(ctx context.Context, pdID string, nodeName k8stypes.NodeName) error

	// DiskIsAttached checks if a disk is attached to the given node.
	DiskIsAttached(ctx context.Context, pdID string, nodeName k8stypes.NodeName) (bool, error)

	// DisksAreAttached is a batch function to check if a list of disks are attached
	// to the node with the specified NodeName.
	DisksAreAttached(ctx context.Context, pdIDs []string, nodeName k8stypes.NodeName) (map[string]bool, error)

	// CreateDisk creates a new PD with given properties.
	CreateDisk(volumeOptions *VolumeOptions) (pdID string, err error)

	// DeleteDisk deletes PD.
	DeleteDisk(pdID string) error
}

Disks is interface for manipulation with PhotonController Persistent Disks.

type PCCloud

type PCCloud struct {
	cloudprovider.Zone
	// contains filtered or unexported fields
}

Photon is an implementation of the cloud provider interface for Photon Controller.

func (*PCCloud) AddSSHKeyToAllInstances

func (pc *PCCloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error

func (*PCCloud) AttachDisk

func (pc *PCCloud) AttachDisk(ctx context.Context, pdID string, nodeName k8stypes.NodeName) error

Attaches given virtual disk volume to the compute running kubelet.

func (*PCCloud) Clusters

func (pc *PCCloud) Clusters() (cloudprovider.Clusters, bool)

func (*PCCloud) CreateDisk

func (pc *PCCloud) CreateDisk(volumeOptions *VolumeOptions) (pdID string, err error)

Create a volume of given size (in GB).

func (*PCCloud) CurrentNodeName

func (pc *PCCloud) CurrentNodeName(ctx context.Context, hostname string) (k8stypes.NodeName, error)

func (*PCCloud) DeleteDisk

func (pc *PCCloud) DeleteDisk(pdID string) error

Deletes a volume given volume name.

func (*PCCloud) DetachDisk

func (pc *PCCloud) DetachDisk(ctx context.Context, pdID string, nodeName k8stypes.NodeName) error

Detaches given virtual disk volume from the compute running kubelet.

func (*PCCloud) DiskIsAttached

func (pc *PCCloud) DiskIsAttached(ctx context.Context, pdID string, nodeName k8stypes.NodeName) (bool, error)

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

func (*PCCloud) DisksAreAttached

func (pc *PCCloud) DisksAreAttached(ctx context.Context, pdIDs []string, nodeName k8stypes.NodeName) (map[string]bool, error)

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

func (*PCCloud) GetZone

func (pc *PCCloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)

func (*PCCloud) GetZoneByNodeName added in v1.8.0

func (pc *PCCloud) GetZoneByNodeName(ctx context.Context, nodeName k8stypes.NodeName) (cloudprovider.Zone, error)

GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*PCCloud) GetZoneByProviderID added in v1.8.0

func (pc *PCCloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)

GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.

func (*PCCloud) HasClusterID added in v1.8.0

func (pc *PCCloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*PCCloud) Initialize added in v1.7.0

func (pc *PCCloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{})

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*PCCloud) InstanceExistsByProviderID added in v1.8.0

func (pc *PCCloud) InstanceExistsByProviderID(ctx context.Context, 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 (*PCCloud) InstanceID

func (pc *PCCloud) InstanceID(ctx context.Context, nodeName k8stypes.NodeName) (string, error)

InstanceID returns the cloud provider ID of the specified instance.

func (*PCCloud) InstanceShutdownByProviderID added in v1.11.0

func (pc *PCCloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

InstanceShutdownByProviderID returns true if the instance is in safe state to detach volumes

func (*PCCloud) InstanceType

func (pc *PCCloud) InstanceType(ctx context.Context, nodeName k8stypes.NodeName) (string, error)

func (*PCCloud) InstanceTypeByProviderID added in v1.7.0

func (pc *PCCloud) InstanceTypeByProviderID(ctx context.Context, 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 (*PCCloud) Instances

func (pc *PCCloud) Instances() (cloudprovider.Instances, bool)

Instances returns an implementation of Instances for Photon Controller.

func (*PCCloud) List

func (pc *PCCloud) List(filter string) ([]k8stypes.NodeName, error)

List is an implementation of Instances.List.

func (*PCCloud) LoadBalancer

func (pc *PCCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns an implementation of LoadBalancer for Photon Controller.

func (*PCCloud) NodeAddresses

func (pc *PCCloud) NodeAddresses(ctx context.Context, nodeName k8stypes.NodeName) ([]v1.NodeAddress, error)

NodeAddresses is an implementation of Instances.NodeAddresses.

func (*PCCloud) NodeAddressesByProviderID added in v1.7.0

func (pc *PCCloud) NodeAddressesByProviderID(ctx context.Context, 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 (*PCCloud) ProviderName

func (pc *PCCloud) ProviderName() string

ProviderName returns the cloud provider ID.

func (*PCCloud) Routes

func (pc *PCCloud) Routes() (cloudprovider.Routes, bool)

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

func (*PCCloud) Zones

func (pc *PCCloud) Zones() (cloudprovider.Zones, bool)

Zones returns an implementation of Zones for Photon Controller.

type PCConfig

type PCConfig struct {
	Global struct {
		// the Photon Controller endpoint IP address
		CloudTarget string `gcfg:"target"`
		// Photon Controller project name
		Project string `gcfg:"project"`
		// when kubelet is started with '--hostname-override=${IP_ADDRESS}', set to true;
		// otherwise, set to false.
		OverrideIP bool `gcfg:"overrideIP"`
		// VM ID for this node
		VMID string `gcfg:"vmID"`
		// Authentication enabled or not
		AuthEnabled bool `gcfg:"authentication"`
	}
}

type VolumeOptions

type VolumeOptions struct {
	CapacityGB int
	Tags       map[string]string
	Name       string
	Flavor     string
}

VolumeOptions specifies capacity, tags, name and flavorID for a volume.

Jump to

Keyboard shortcuts

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