openstack

package
v0.0.0-...-9711aa8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0, Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeAvailableStatus = "available"
	VolumeInUseStatus     = "in-use"
	VolumeDeletedStatus   = "deleted"
	VolumeErrorStatus     = "error"
)

Valid Volume status strings

View Source
const ProviderName = "openstack"

ProviderName is the name of the cloud provider

Variables

View Source
var ErrBadMetadata = errors.New("Invalid OpenStack metadata, got empty uuid")

ErrBadMetadata is an error for bad metadata

View Source
var ErrMultipleResults = errors.New("Multiple results where only one expected")

ErrMultipleResults is the error when multiple results obtained but only on expected

View Source
var ErrNoAddressFound = errors.New("No address found for host")

ErrNoAddressFound is the error when no address found for host

View Source
var ErrNoRouterID = errors.New("router-id not set in cloud provider config")

ErrNoRouterID is the error for no router ID

View Source
var ErrNotFound = errors.New("Failed to find object")

ErrNotFound is the error for not found

Functions

func NewRoutes

NewRoutes creates new Routes

Types

type BlockStorageOpts

type BlockStorageOpts struct {
	BSVersion       string `gcfg:"bs-version"`        // overrides autodetection. v1 or v2. Defaults to auto
	TrustDevicePath bool   `gcfg:"trust-device-path"` // See Issue #33128
}

BlockStorageOpts defines options for block storage

type Caller

type Caller bool

Caller is Tiny helper for conditional unwind logic

func NewCaller

func NewCaller() Caller

NewCaller returns a Caller

func (*Caller) Call

func (c *Caller) Call(f func())

Call returns a Call

func (*Caller) Disarm

func (c *Caller) Disarm()

Disarm disarms the caller

type Config

type Config struct {
	Global struct {
		AuthURL    string `gcfg:"auth-url"`
		Username   string
		UserID     string `gcfg:"user-id"`
		Password   string
		TenantID   string `gcfg:"tenant-id"`
		TenantName string `gcfg:"tenant-name"`
		TrustID    string `gcfg:"trust-id"`
		DomainID   string `gcfg:"domain-id"`
		DomainName string `gcfg:"domain-name"`
		Region     string
		CAFile     string `gcfg:"ca-file"`
	}
	LoadBalancer LoadBalancerOpts
	BlockStorage BlockStorageOpts
	Route        RouterOpts
}

Config defines config options for the openstack cloud provider

type Instances

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

Instances defines compute instances

func (*Instances) AddSSHKeyToAllInstances

func (i *Instances) AddSSHKeyToAllInstances(user string, keyData []byte) error

AddSSHKeyToAllInstances adds SSH key to all instances

func (*Instances) CurrentNodeName

func (i *Instances) CurrentNodeName(hostname string) (types.NodeName, error)

CurrentNodeName is an implementation of Instances.CurrentNodeName Note this is *not* necessarily the same as hostname.

func (*Instances) ExternalID

func (i *Instances) ExternalID(name types.NodeName) (string, error)

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

func (*Instances) InstanceID

func (i *Instances) InstanceID(name types.NodeName) (string, error)

InstanceID returns the cloud provider ID of the specified instance.

func (*Instances) InstanceType

func (i *Instances) InstanceType(name types.NodeName) (string, error)

InstanceType returns the type of the specified instance.

func (*Instances) InstanceTypeByProviderID

func (i *Instances) 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 (*Instances) List

func (i *Instances) List(nameFilter string) ([]types.NodeName, error)

List lists node names

func (*Instances) NodeAddresses

func (i *Instances) NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error)

NodeAddresses gets node addresses

func (*Instances) NodeAddressesByProviderID

func (i *Instances) 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

type LbaasV1

type LbaasV1 struct {
	LoadBalancer
}

LbaasV1 is the LoadBalancer implementation for LBaaS v1

func (*LbaasV1) EnsureLoadBalancer

func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer ensures the load balancer works well

func (*LbaasV1) EnsureLoadBalancerDeleted

func (lb *LbaasV1) EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted ensures the load balancer is deleted

func (*LbaasV1) GetLoadBalancer

func (lb *LbaasV1) GetLoadBalancer(clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)

GetLoadBalancer gets a load balancer

func (*LbaasV1) UpdateLoadBalancer

func (lb *LbaasV1) UpdateLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates the load balancer

type LbaasV2

type LbaasV2 struct {
	LoadBalancer
}

LbaasV2 is the LoadBalancer implementation for LBaaS v2

func (*LbaasV2) EnsureLoadBalancer

func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer ensures the load balancer works properly

func (*LbaasV2) EnsureLoadBalancerDeleted

func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted ensures the load balancer is deleted

func (*LbaasV2) GetLoadBalancer

func (lbaas *LbaasV2) GetLoadBalancer(clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)

GetLoadBalancer gets the status of the load balancer

func (*LbaasV2) UpdateLoadBalancer

func (lbaas *LbaasV2) UpdateLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates the load balancer

type LoadBalancer

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

LoadBalancer is the struct for load balancer

type LoadBalancerOpts

type LoadBalancerOpts struct {
	LBVersion            string     `gcfg:"lb-version"` // overrides autodetection. v1 or v2
	SubnetID             string     `gcfg:"subnet-id"`  // required
	FloatingNetworkID    string     `gcfg:"floating-network-id"`
	LBMethod             string     `gcfg:"lb-method"`
	CreateMonitor        bool       `gcfg:"create-monitor"`
	MonitorDelay         MyDuration `gcfg:"monitor-delay"`
	MonitorTimeout       MyDuration `gcfg:"monitor-timeout"`
	MonitorMaxRetries    uint       `gcfg:"monitor-max-retries"`
	ManageSecurityGroups bool       `gcfg:"manage-security-groups"`
	NodeSecurityGroupID  string     `gcfg:"node-security-group"`
}

LoadBalancerOpts defines options for load balancer

type Metadata

type Metadata struct {
	UUID             string `json:"uuid"`
	Name             string `json:"name"`
	AvailabilityZone string `json:"availability_zone"`
}

Metadata assumes the "2012-08-10" meta_data.json format. See http://docs.openstack.org/user-guide/cli_config_drive.html

type MyDuration

type MyDuration struct {
	time.Duration
}

MyDuration is the encoding.TextUnmarshaler interface for time.Duration

func (*MyDuration) UnmarshalText

func (d *MyDuration) UnmarshalText(text []byte) error

UnmarshalText unmarshals the text

type OpenStack

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

OpenStack is an implementation of cloud provider Interface for OpenStack.

func (*OpenStack) AttachDisk

func (os *OpenStack) AttachDisk(instanceID, volumeID string) (string, error)

AttachDisk attaches specified cinder volume to the compute running kubelet

func (*OpenStack) Clusters

func (os *OpenStack) Clusters() (cloudprovider.Clusters, bool)

Clusters return cloud provider clusters

func (*OpenStack) CreateSnapshot

func (os *OpenStack) CreateSnapshot(sourceVolumeID, name, description string, tags map[string]string) (string, string, error)

CreateSnapshot from the specified volume

func (*OpenStack) CreateVolume

func (os *OpenStack) CreateVolume(name string, size int, vtype, availability, snapshotID string, tags *map[string]string) (string, string, error)

CreateVolume of given size (in GiB)

func (*OpenStack) DeleteSnapshot

func (os *OpenStack) DeleteSnapshot(snapshotID string) error

DeleteSnapshot deletes the specified snapshot

func (*OpenStack) DeleteVolume

func (os *OpenStack) DeleteVolume(volumeID string) error

DeleteVolume deletes the specified volume

func (*OpenStack) DescribeSnapshot

func (os *OpenStack) DescribeSnapshot(snapshotID string) (status string, isCompleted bool, err error)

DescribeSnapshot returns the status of the snapshot FIXME(j-griffith): Name doesn't fit at all here, this is actually more like is `IsAvailable`

func (*OpenStack) DetachDisk

func (os *OpenStack) DetachDisk(instanceID, volumeID string) error

DetachDisk detaches given cinder volume from the compute running kubelet

func (*OpenStack) DiskIsAttached

func (os *OpenStack) DiskIsAttached(instanceID, volumeID string) (bool, error)

DiskIsAttached query if a volume is attached to a compute instance

func (*OpenStack) DisksAreAttached

func (os *OpenStack) DisksAreAttached(instanceID string, volumeIDs []string) (map[string]bool, error)

DisksAreAttached query if a list of volumes are attached to a compute instance

func (*OpenStack) FindSnapshot

func (os *OpenStack) FindSnapshot(tags map[string]string) ([]string, []string, error)

FindSnapshot finds snapshot by metadata

func (*OpenStack) GetAttachmentDiskPath

func (os *OpenStack) GetAttachmentDiskPath(instanceID, volumeID string) (string, error)

GetAttachmentDiskPath retrieves device path of attached volume to the compute running kubelet, as known by cinder

func (*OpenStack) GetDevicePath

func (os *OpenStack) GetDevicePath(volumeID string) string

GetDevicePath returns the path of an attached block storage volume, specified by its id.

func (*OpenStack) GetZone

func (os *OpenStack) GetZone() (cloudprovider.Zone, error)

GetZone gets a zone from cloud provider

func (*OpenStack) Initialize

func (os *OpenStack) Initialize(clientBuilder controller.ControllerClientBuilder)

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*OpenStack) InstanceID

func (os *OpenStack) InstanceID() (string, error)

InstanceID returns the kubelet's cloud provider ID.

func (*OpenStack) Instances

func (os *OpenStack) Instances() (cloudprovider.Instances, bool)

Instances returns an implementation of Instances for OpenStack.

func (*OpenStack) LoadBalancer

func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool)

LoadBalancer returns a load balancer

func (*OpenStack) NewBlockStorageV1

func (os *OpenStack) NewBlockStorageV1() (*gophercloud.ServiceClient, error)

NewBlockStorageV1 creates a new BlockStorage V1 endpoint TODO(xyang): This should be removed at some point after the OpenStack Queens release because V1 API has been deprecated for many releases and was finally removed from Cinder in Queens.

func (*OpenStack) NewBlockStorageV2

func (os *OpenStack) NewBlockStorageV2() (*gophercloud.ServiceClient, error)

NewBlockStorageV2 creates a new BlockStorage V2 endpoint

func (*OpenStack) NewComputeV2

func (os *OpenStack) NewComputeV2() (*gophercloud.ServiceClient, error)

NewComputeV2 creates a new Compute V2 endpoint

func (*OpenStack) NewNetworkV2

func (os *OpenStack) NewNetworkV2() (*gophercloud.ServiceClient, error)

NewNetworkV2 creates a new Network V2 endpoint

func (*OpenStack) OperationPending

func (os *OpenStack) OperationPending(diskName string) (bool, string, error)

OperationPending checks status, makes sure we're not in error state

func (*OpenStack) ProviderName

func (os *OpenStack) ProviderName() string

ProviderName returns the cloud provider ID.

func (*OpenStack) Routes

func (os *OpenStack) Routes() (cloudprovider.Routes, bool)

Routes returns cloud provider routes

func (*OpenStack) ScrubDNS

func (os *OpenStack) ScrubDNS(nameServers, searches []string) ([]string, []string)

ScrubDNS filters DNS settings for pods.

func (*OpenStack) ShouldTrustDevicePath

func (os *OpenStack) ShouldTrustDevicePath() bool

ShouldTrustDevicePath query if we should trust the cinder provide deviceName, See issue #33128

func (*OpenStack) Zones

func (os *OpenStack) Zones() (cloudprovider.Zones, bool)

Zones returns cloud provider zones

type RouterOpts

type RouterOpts struct {
	RouterID string `gcfg:"router-id"` // required
}

RouterOpts defines options for the router

type Routes

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

Routes defines options for the routes

func (*Routes) CreateRoute

func (r *Routes) CreateRoute(clusterName string, nameHint string, route *cloudprovider.Route) error

CreateRoute creates a route

func (*Routes) DeleteRoute

func (r *Routes) DeleteRoute(clusterName string, route *cloudprovider.Route) error

DeleteRoute deletes a route

func (*Routes) ListRoutes

func (r *Routes) ListRoutes(clusterName string) ([]*cloudprovider.Route, error)

ListRoutes lists routes

type Snapshot

type Snapshot struct {
	ID             string
	Name           string
	Status         string
	SourceVolumeID string
	Description    string
	Metadata       map[string]string
}

Snapshot is the representation of the Cinder Snapshot object

type SnapshotCreateOpts

type SnapshotCreateOpts struct {
	VolumeID    string
	Name        string
	Description string
	Force       bool
	Metadata    map[string]string
}

SnapshotCreateOpts are the valid create options for Cinder Snapshots

type SnapshotListOpts

type SnapshotListOpts struct {
	Name     string
	Status   string
	VolumeID string
}

SnapshotListOpts are the valid list options for Cinder Snapshots

type SnapshotsV2

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

SnapshotsV2 is the Cinder V2 Snapshot service from gophercloud

type Volume

type Volume struct {
	// AttachedServerID is a UUID representing the Server Volume is attached to
	AttachedServerID string
	// AttachedDevice is device file path
	AttachedDevice string
	// ID is the volumes Cinder UUID.
	ID string
	// Name is a Human-readable display name for the volume.
	Name string
	// Status is the current state of the volume.
	Status string
}

Volume reprsents the Cinder Volume object

type VolumeCreateOpts

type VolumeCreateOpts struct {
	Size             int
	Availability     string
	Name             string
	VolumeType       string
	Metadata         map[string]string
	SourceVolumeID   string
	SourceSnapshotID string
}

VolumeCreateOpts valid options for creating a Volume

type VolumesV1

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

VolumesV1 implementation for v1

type VolumesV2

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

VolumesV2 implementation for v2

Jump to

Keyboard shortcuts

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