openstack

package
v1.9.12-beta.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ProviderName     = "openstack"
	AvailabilityZone = "availability_zone"
)
View Source
const (
	ServiceAnnotationLoadBalancerFloatingNetworkId = "loadbalancer.openstack.org/floating-network-id"

	// ServiceAnnotationLoadBalancerInternal is the annotation used on the service
	// to indicate that we want an internal loadbalancer service.
	// If the value of ServiceAnnotationLoadBalancerInternal is false, it indicates that we want an external loadbalancer service. Default to false.
	ServiceAnnotationLoadBalancerInternal = "service.beta.kubernetes.io/openstack-internal-load-balancer"
)

Note: when creating a new Loadbalancer (VM), it can take some time before it is ready for use, this timeout is used for waiting until the Loadbalancer provisioning status goes to ACTIVE state.

View Source
const (
	OpenstackSubsystem         = "openstack"
	OpenstackOperationKey      = "cloudprovider_openstack_api_request_duration_seconds"
	OpenstackOperationErrorKey = "cloudprovider_openstack_api_request_errors"
)
View Source
const (
	VolumeAvailableStatus = "available"
	VolumeInUseStatus     = "in-use"
	VolumeDeletedStatus   = "deleted"
	VolumeErrorStatus     = "error"

	// On some environments, we need to query the metadata service in order
	// to locate disks. We'll use the Newton version, which includes device
	// metadata.
	NewtonMetadataVersion = "2016-06-30"
)

Variables

View Source
var (
	OpenstackOperationsLatency = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Subsystem: OpenstackSubsystem,
			Name:      OpenstackOperationKey,
			Help:      "Latency of openstack api call",
		},
		[]string{"request"},
	)

	OpenstackApiRequestErrors = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: OpenstackSubsystem,
			Name:      OpenstackOperationErrorKey,
			Help:      "Cumulative number of openstack Api call errors",
		},
		[]string{"request"},
	)
)
View Source
var ErrBadMetadata = errors.New("invalid OpenStack metadata, got empty uuid")
View Source
var ErrMultipleResults = errors.New("multiple results where only one expected")
View Source
var ErrNoAddressFound = errors.New("no address found for host")
View Source
var ErrNoRouterId = errors.New("router-id not set in cloud provider config")
View Source
var ErrNotFound = errors.New("failed to find object")

Functions

func NewRoutes added in v1.6.0

func RegisterMetrics added in v1.7.0

func RegisterMetrics()

Types

type BlockStorageOpts added in v1.5.0

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
	IgnoreVolumeAZ  bool   `gcfg:"ignore-volume-az"`
}

type Caller added in v1.6.0

type Caller bool

Tiny helper for conditional unwind logic

func NewCaller added in v1.6.0

func NewCaller() Caller

func (*Caller) Call added in v1.6.0

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

func (*Caller) Disarm added in v1.6.0

func (c *Caller) Disarm()

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
	Metadata     MetadataOpts
}

type DeviceMetadata added in v1.9.0

type DeviceMetadata struct {
	Type    string `json:"type"`
	Bus     string `json:"bus,omitempty"`
	Serial  string `json:"serial,omitempty"`
	Address string `json:"address,omitempty"`
}

There are multiple device types. To keep it simple, we're using a single structure for all device metadata types.

type Instances

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

func (*Instances) AddSSHKeyToAllInstances

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

func (*Instances) CurrentNodeName

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

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) InstanceExistsByProviderID added in v1.8.0

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

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

InstanceID returns the cloud provider ID of the specified instance.

func (*Instances) InstanceType added in v1.2.0

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

InstanceType returns the type of the specified instance.

func (*Instances) InstanceTypeByProviderID added in v1.7.0

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) NodeAddresses

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

func (*Instances) NodeAddressesByProviderID added in v1.7.0

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 LbaasV2 added in v1.3.0

type LbaasV2 struct {
	LoadBalancer
}

LoadBalancer implementation for LBaaS v2

func (*LbaasV2) EnsureLoadBalancer added in v1.3.0

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

func (*LbaasV2) EnsureLoadBalancerDeleted added in v1.3.0

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

func (*LbaasV2) EnsureOldSecurityGroupDeleted added in v1.9.0

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

EnsureOldSecurityGroupDeleted deleting old security group for specific loadbalancer service. Related to #53764 TODO(FengyunPan): Remove it at V1.10

func (*LbaasV2) EnsureSecurityGroupDeleted added in v1.9.0

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

EnsureSecurityGroupDeleted deleting security group for specific loadbalancer service.

func (*LbaasV2) GetLoadBalancer added in v1.3.0

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

func (*LbaasV2) UpdateLoadBalancer added in v1.3.0

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

type LoadBalancer

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

type LoadBalancerOpts

type LoadBalancerOpts struct {
	LBVersion            string     `gcfg:"lb-version"`          // overrides autodetection. Only support v2.
	UseOctavia           bool       `gcfg:"use-octavia"`         // uses Octavia V2 service catalog endpoint
	SubnetId             string     `gcfg:"subnet-id"`           // overrides autodetection.
	FloatingNetworkId    string     `gcfg:"floating-network-id"` // If specified, will create floating ip for loadbalancer, or do not create floating ip.
	LBMethod             string     `gcfg:"lb-method"`           // default to ROUND_ROBIN.
	LBProvider           string     `gcfg:"lb-provider"`
	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"`
	NodeSecurityGroupIDs []string   // Do not specify, get it automatically when enable manage-security-groups. TODO(FengyunPan): move it into cache
}

type Metadata added in v1.5.0

type Metadata struct {
	Uuid             string           `json:"uuid"`
	Name             string           `json:"name"`
	AvailabilityZone string           `json:"availability_zone"`
	Devices          []DeviceMetadata `json:"devices,omitempty"`
}

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

type MetadataOpts added in v1.9.0

type MetadataOpts struct {
	SearchOrder    string     `gcfg:"search-order"`
	RequestTimeout MyDuration `gcfg:"request-timeout"`
}

type MyDuration

type MyDuration struct {
	time.Duration
}

encoding.TextUnmarshaler interface for time.Duration

func (*MyDuration) UnmarshalText

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

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 given cinder volume to the compute running kubelet

func (*OpenStack) Clusters

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

func (*OpenStack) CreateVolume added in v1.2.0

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

CreateVolume creates a volume of given size (in GiB)

func (*OpenStack) DeleteVolume added in v1.2.0

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

func (*OpenStack) DetachDisk

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

DetachDisk detaches given cinder volume from the compute running kubelet

func (*OpenStack) DiskIsAttached added in v1.3.0

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

DiskIsAttached queries if a volume is attached to a compute instance

func (*OpenStack) DiskIsAttachedByName added in v1.9.7

func (os *OpenStack) DiskIsAttachedByName(nodeName types.NodeName, volumeID string) (bool, string, error)

DiskIsAttachedByName queries if a volume is attached to a compute instance by name

func (*OpenStack) DisksAreAttached added in v1.4.6

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

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

func (*OpenStack) DisksAreAttachedByName added in v1.9.7

func (os *OpenStack) DisksAreAttachedByName(nodeName types.NodeName, volumeIDs []string) (map[string]bool, error)

DisksAreAttachedByName queries if a list of volumes are attached to a compute instance by name

func (*OpenStack) ExpandVolume added in v1.9.0

func (os *OpenStack) ExpandVolume(volumeID string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error)

ExpandVolume expands the size of specific cinder volume (in GiB)

func (*OpenStack) GetAttachmentDiskPath added in v1.3.0

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

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

func (*OpenStack) GetDevicePath added in v1.3.0

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

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

func (*OpenStack) GetDevicePathBySerialId added in v1.9.0

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

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

func (*OpenStack) GetDevicePathFromInstanceMetadata added in v1.9.0

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

func (*OpenStack) GetNodeNameByID added in v1.9.7

func (os *OpenStack) GetNodeNameByID(instanceID string) (types.NodeName, error)

getNodeNameByID maps instanceid to types.NodeName

func (*OpenStack) GetZone

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

func (*OpenStack) GetZoneByNodeName added in v1.8.0

func (os *OpenStack) GetZoneByNodeName(nodeName types.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 (*OpenStack) GetZoneByProviderID added in v1.8.0

func (os *OpenStack) GetZoneByProviderID(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 (*OpenStack) HasClusterID added in v1.8.0

func (os *OpenStack) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*OpenStack) Initialize added in v1.7.0

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

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*OpenStack) InstanceID added in v1.3.0

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 added in v1.2.0

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

func (*OpenStack) NewBlockStorageV1 added in v1.7.0

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

func (*OpenStack) NewBlockStorageV2 added in v1.7.0

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

func (*OpenStack) NewBlockStorageV3 added in v1.9.0

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

func (*OpenStack) NewComputeV2 added in v1.7.0

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

func (*OpenStack) NewLoadBalancerV2 added in v1.9.0

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

func (*OpenStack) NewNetworkV2 added in v1.7.0

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

func (*OpenStack) OperationPending added in v1.7.0

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

func (*OpenStack) ProviderName

func (os *OpenStack) ProviderName() string

ProviderName returns the cloud provider ID.

func (*OpenStack) Routes

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

func (*OpenStack) ScrubDNS added in v1.1.1

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

ScrubDNS filters DNS settings for pods.

func (*OpenStack) ShouldTrustDevicePath added in v1.5.0

func (os *OpenStack) ShouldTrustDevicePath() bool

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

func (*OpenStack) Zones

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

type RouterOpts added in v1.6.0

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

type Routes added in v1.6.0

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

func (*Routes) CreateRoute added in v1.6.0

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

func (*Routes) DeleteRoute added in v1.6.0

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

func (*Routes) ListRoutes added in v1.6.0

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

type Volume added in v1.7.0

type Volume struct {
	// ID of the instance, to which this volume is attached. "" if not attached
	AttachedServerId string
	// Device file path
	AttachedDevice string
	// Unique identifier for the volume.
	ID string
	// Human-readable display name for the volume.
	Name string
	// Current status of the volume.
	Status string
	// Volume size in GB
	Size int
}

type VolumeCreateOpts added in v1.7.0

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

type VolumesV1 added in v1.7.0

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

Volumes implementation for v1

type VolumesV2 added in v1.7.0

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

Volumes implementation for v2

type VolumesV3 added in v1.9.0

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

Volumes implementation for v3

Jump to

Keyboard shortcuts

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