kubernetes: k8s.io/kubernetes/pkg/cloudprovider/providers/openstack Index | Files

package openstack

import "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"

Index

Package Files

metadata.go openstack.go openstack_client.go openstack_instances.go openstack_loadbalancer.go openstack_metrics.go openstack_routes.go openstack_volumes.go

Constants

const (
    // ProviderName is the name of the openstack provider
    ProviderName = "openstack"

    // TypeHostName is the name type of openstack instance
    TypeHostName = "hostname"
)
const (
    ServiceAnnotationLoadBalancerFloatingNetworkID = "loadbalancer.openstack.org/floating-network-id"
    ServiceAnnotationLoadBalancerSubnetID          = "loadbalancer.openstack.org/subnet-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.

Variables

var ErrBadMetadata = errors.New("invalid OpenStack metadata, got empty uuid")

ErrBadMetadata is used to indicate a problem parsing data from metadata server

var ErrMultipleResults = errors.New("multiple results where only one expected")

ErrMultipleResults is used when we unexpectedly get back multiple results

var ErrNoAddressFound = errors.New("no address found for host")

ErrNoAddressFound is used when we cannot find an ip address for the host

var ErrNotFound = errors.New("failed to find object")

ErrNotFound is used to inform that the object is missing

func NewRoutes Uses

func NewRoutes(compute *gophercloud.ServiceClient, network *gophercloud.ServiceClient, opts RouterOpts) (cloudprovider.Routes, error)

NewRoutes creates a new instance of Routes

type BlockStorageOpts Uses

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"`
    NodeVolumeAttachLimit int    `gcfg:"node-volume-attach-limit"` // override volume attach limit for Cinder. Default is : 256
}

BlockStorageOpts is used to talk to Cinder service

type Config Uses

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"`
        SecretName      string `gcfg:"secret-name"`
        SecretNamespace string `gcfg:"secret-namespace"`
        KubeconfigPath  string `gcfg:"kubeconfig-path"`
    }
    LoadBalancer LoadBalancerOpts
    BlockStorage BlockStorageOpts
    Route        RouterOpts
    Metadata     MetadataOpts
}

Config is used to read and store information from the cloud configuration file

type DeviceMetadata Uses

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

DeviceMetadata is a single/simplified data structure for all kinds of device metadata types.

type Instances Uses

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

Instances encapsulates an implementation of Instances for OpenStack.

func (*Instances) AddSSHKeyToAllInstances Uses

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

AddSSHKeyToAllInstances is not implemented for OpenStack

func (*Instances) CurrentNodeName Uses

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

CurrentNodeName implements Instances.CurrentNodeName Note this is *not* necessarily the same as hostname.

func (*Instances) InstanceExistsByProviderID Uses

func (i *Instances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)

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

func (*Instances) InstanceID Uses

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

InstanceID returns the cloud provider ID of the specified instance.

func (*Instances) InstanceShutdownByProviderID Uses

func (i *Instances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)

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

func (*Instances) InstanceType Uses

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

InstanceType returns the type of the specified instance.

func (*Instances) InstanceTypeByProviderID Uses

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

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

NodeAddresses implements Instances.NodeAddresses

func (*Instances) NodeAddressesByProviderID Uses

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

type LbaasV2 Uses

type LbaasV2 struct {
    LoadBalancer
}

LbaasV2 is a LoadBalancer implementation for Neutron LBaaS v2 API

func (*LbaasV2) EnsureLoadBalancer Uses

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

EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one.

func (*LbaasV2) EnsureLoadBalancerDeleted Uses

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

EnsureLoadBalancerDeleted deletes the specified load balancer

func (*LbaasV2) EnsureSecurityGroupDeleted Uses

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

EnsureSecurityGroupDeleted deleting security group for specific loadbalancer service.

func (*LbaasV2) GetLoadBalancer Uses

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

GetLoadBalancer returns whether the specified load balancer exists and its status

func (*LbaasV2) GetLoadBalancerName Uses

func (lbaas *LbaasV2) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string

GetLoadBalancerName is an implementation of LoadBalancer.GetLoadBalancerName.

func (*LbaasV2) UpdateLoadBalancer Uses

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

UpdateLoadBalancer updates hosts under the specified load balancer.

type LoadBalancer Uses

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

LoadBalancer is used for creating and maintaining load balancers

type LoadBalancerOpts Uses

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
}

LoadBalancerOpts have the options to talk to Neutron LBaaSV2 or Octavia

type Metadata Uses

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

Metadata has the information fetched from OpenStack metadata service or config drives. Assumes the "2012-08-10" meta_data.json format. See http://docs.openstack.org/user-guide/cli_config_drive.html

type MetadataOpts Uses

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

MetadataOpts is used for configuring how to talk to metadata service or config drive

type MyDuration Uses

type MyDuration struct {
    time.Duration
}

MyDuration is the encoding.TextUnmarshaler interface for time.Duration

func (*MyDuration) UnmarshalText Uses

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

UnmarshalText is used to convert from text to Duration

type OpenStack Uses

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

OpenStack is an implementation of cloud provider Interface for OpenStack.

func NewFakeOpenStackCloud Uses

func NewFakeOpenStackCloud(cfg Config) (*OpenStack, error)

NewFakeOpenStackCloud creates and returns an instance of Openstack cloudprovider. Mainly for use in tests that require instantiating Openstack without having to go through cloudprovider interface.

func (*OpenStack) AttachDisk Uses

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

AttachDisk attaches given cinder volume to the compute running kubelet

func (*OpenStack) Clusters Uses

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

Clusters is a no-op

func (*OpenStack) CreateVolume Uses

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

CreateVolume creates a volume of given size (in GiB)

func (*OpenStack) DeleteVolume Uses

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

DeleteVolume deletes a volume given volume name.

func (*OpenStack) DetachDisk Uses

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

DetachDisk detaches given cinder volume from the compute running kubelet

func (*OpenStack) DiskIsAttached Uses

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

DiskIsAttached queries if a volume is attached to a compute instance

func (*OpenStack) DiskIsAttachedByName Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

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

func (*OpenStack) GetDevicePathBySerialID Uses

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

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

func (*OpenStack) GetLabelsForVolume Uses

func (os *OpenStack) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error)

GetLabelsForVolume implements PVLabeler.GetLabelsForVolume

func (*OpenStack) GetNodeNameByID Uses

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

GetNodeNameByID maps instanceid to types.NodeName

func (*OpenStack) GetZone Uses

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

GetZone returns the current zone

func (*OpenStack) GetZoneByNodeName Uses

func (os *OpenStack) GetZoneByNodeName(ctx context.Context, 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 Uses

func (os *OpenStack) 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 (*OpenStack) HasClusterID Uses

func (os *OpenStack) HasClusterID() bool

HasClusterID returns true if the cluster has a clusterID

func (*OpenStack) Initialize Uses

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

Initialize passes a Kubernetes clientBuilder interface to the cloud provider

func (*OpenStack) InstanceID Uses

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

InstanceID returns the kubelet's cloud provider ID.

func (*OpenStack) Instances Uses

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

Instances returns an implementation of Instances for OpenStack.

func (*OpenStack) LoadBalancer Uses

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

LoadBalancer initializes a LbaasV2 object

func (*OpenStack) NewBlockStorageV1 Uses

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

NewBlockStorageV1 creates a ServiceClient that may be used with the Cinder v1 API

func (*OpenStack) NewBlockStorageV2 Uses

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

NewBlockStorageV2 creates a ServiceClient that may be used with the Cinder v2 API

func (*OpenStack) NewBlockStorageV3 Uses

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

NewBlockStorageV3 creates a ServiceClient that may be used with the Cinder v3 API

func (*OpenStack) NewComputeV2 Uses

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

NewComputeV2 creates a ServiceClient that may be used with the nova v2 API

func (*OpenStack) NewLoadBalancerV2 Uses

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

NewLoadBalancerV2 creates a ServiceClient that may be used with the Neutron LBaaS v2 API

func (*OpenStack) NewNetworkV2 Uses

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

NewNetworkV2 creates a ServiceClient that may be used with the neutron v2 API

func (*OpenStack) NodeVolumeAttachLimit Uses

func (os *OpenStack) NodeVolumeAttachLimit() int

NodeVolumeAttachLimit specifies number of cinder volumes that can be attached to this node.

func (*OpenStack) OperationPending Uses

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

OperationPending checks if there is an operation pending on a volume

func (*OpenStack) ProviderName Uses

func (os *OpenStack) ProviderName() string

ProviderName returns the cloud provider ID.

func (*OpenStack) Routes Uses

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

Routes initializes routes support

func (*OpenStack) ShouldTrustDevicePath Uses

func (os *OpenStack) ShouldTrustDevicePath() bool

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

func (*OpenStack) Zones Uses

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

Zones indicates that we support zones

type RouterOpts Uses

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

RouterOpts is used for Neutron routes

type Routes Uses

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

Routes implements the cloudprovider.Routes for OpenStack clouds

func (*Routes) CreateRoute Uses

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

CreateRoute creates the described managed route

func (*Routes) DeleteRoute Uses

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

DeleteRoute deletes the specified managed route

func (*Routes) ListRoutes Uses

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

ListRoutes lists all managed routes that belong to the specified clusterName

type Volume Uses

type Volume struct {
    // ID of the instance, to which this volume is attached. "" if not attached
    AttachedServerID string
    // Device file path
    AttachedDevice string
    // availabilityZone is which availability zone the volume is in
    AvailabilityZone 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
}

Volume stores information about a single volume

type VolumesV1 Uses

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

VolumesV1 is a Volumes implementation for cinder v1

type VolumesV2 Uses

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

VolumesV2 is a Volumes implementation for cinder v2

type VolumesV3 Uses

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

VolumesV3 is a Volumes implementation for cinder v3

Package openstack imports 63 packages (graph) and is imported by 240 packages. Updated 2019-07-18. Refresh now. Tools for package owners.