photon

package
v0.0.0-...-8a55389 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 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(pdID string, nodeName k8stypes.NodeName) error

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

	// DiskIsAttached checks if a disk is attached to the given node.
	DiskIsAttached(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(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(user string, keyData []byte) error

func (*PCCloud) AttachDisk

func (pc *PCCloud) AttachDisk(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(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(pdID string, nodeName k8stypes.NodeName) error

Detaches given virtual disk volume from the compute running kubelet.

func (*PCCloud) DiskIsAttached

func (pc *PCCloud) DiskIsAttached(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(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) ExternalID

func (pc *PCCloud) ExternalID(nodeName k8stypes.NodeName) (string, error)

ExternalID returns the cloud provider ID of the specified instance (deprecated).

func (*PCCloud) GetZone

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

func (*PCCloud) HasClusterID

func (pc *PCCloud) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*PCCloud) Initialize

func (pc *PCCloud) Initialize(clientBuilder controller.ControllerClientBuilder)

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*PCCloud) InstanceID

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

InstanceID returns the cloud provider ID of the specified instance.

func (*PCCloud) InstanceType

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

func (*PCCloud) InstanceTypeByProviderID

func (pc *PCCloud) 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 (*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(nodeName k8stypes.NodeName) ([]v1.NodeAddress, error)

NodeAddresses is an implementation of Instances.NodeAddresses.

func (*PCCloud) NodeAddressesByProviderID

func (pc *PCCloud) 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 (*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) ScrubDNS

func (pc *PCCloud) ScrubDNS(nameservers, searches []string) (nsOut, srchOut []string)

ScrubDNS filters DNS settings for pods.

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