juju: github.com/wallyworld/juju/provider/openstack Index | Files

package openstack

import "github.com/wallyworld/juju/provider/openstack"


Package Files

cinder.go client.go config.go credentials.go errors.go firewaller.go image.go init.go instance_information.go networking.go provider.go provider_configurator.go storage.go upgrades.go userdata.go


const (
    ExternalNetworkKey    = "external-network"
    NetworkKey            = "network"
    PolicyTargetGroupKey  = "policy-target-group"
    UseDefaultSecgroupKey = "use-default-secgroup"
    UseOpenstackGBPKey    = "use-openstack-gbp"
    UseFloatingIPKey      = "use-floating-ip"
const (
    CredAttrTenantName        = "tenant-name"
    CredAttrTenantID          = "tenant-id"
    CredAttrUserName          = "username"
    CredAttrPassword          = "password"
    CredAttrDomainName        = "domain-name"
    CredAttrProjectDomainName = "project-domain-name"
    CredAttrUserDomainName    = "user-domain-name"
    CredAttrAccessKey         = "access-key"
    CredAttrSecretKey         = "secret-key"
    CredAttrVersion           = "version"
const (
    CinderProviderType = storage.ProviderType("cinder")
const (
    GroupControllerPattern = `^(?P<prefix>juju-)(?P<controllerUUID>` + validUUID + `)(?P<suffix>-.*)$`

func AcceptAllFlavors Uses

func AcceptAllFlavors(nova.FlavorDetail) bool

AcceptAllFlavors is a function that returns true for any input, and can be assigned to a value of type FlavorFilterFunc.

func IsAuthorisationFailure Uses

func IsAuthorisationFailure(err error) bool

IsAuthorisationFailure determines if the given error has an authorisation failure.

func IsNotFoundError Uses

func IsNotFoundError(err error) bool

type AuthMode Uses

type AuthMode string
const (
    AuthKeyPair  AuthMode = "keypair"
    AuthLegacy   AuthMode = "legacy"
    AuthUserPass AuthMode = "userpass"

type ClientFactory Uses

type ClientFactory struct {
    // contains filtered or unexported fields

ClientFactory creates various goose (openstack) clients. TODO (stickupkid): This should be moved into goose and the factory should accept a configuration returning back goose clients.

func NewClientFactory Uses

func NewClientFactory(spec environscloudspec.CloudSpec, sslHostnameConfig SSLHostnameConfig) *ClientFactory

NewClientFactory creates a new ClientFactory from the CloudSpec and environ config arguments.

func (*ClientFactory) AuthClient Uses

func (c *ClientFactory) AuthClient() client.AuthenticatingClient

AuthClient returns an goose AuthenticatingClient.

func (*ClientFactory) Init Uses

func (c *ClientFactory) Init() error

Init the client factory, returns an error if the initialization fails.

func (*ClientFactory) Neutron Uses

func (c *ClientFactory) Neutron() (*neutron.Client, error)

Neutron creates a new Neutron client from the auth mode (v3 or falls back to v2) and the updated credentials. Note: we override the http.Client headers with specific neutron client headers.

func (*ClientFactory) Nova Uses

func (c *ClientFactory) Nova() (*nova.Client, error)

Nova creates a new Nova client from the auth mode (v3 or falls back to v2) and the updated credentials.

type ClientFunc Uses

type ClientFunc = func(cred identity.Credentials,
    authMode identity.AuthMode,
    gooseLogger gooselogging.CompatLogger,
    sslHostnameVerification bool,
    certs []string,
    options ...client.Option) (client.AuthenticatingClient, error)

ClientFunc is used to create a goose client.

type Environ Uses

type Environ struct {
    // contains filtered or unexported fields

func (*Environ) AdoptResources Uses

func (e *Environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error

AdoptResources is part of the Environ interface.

func (*Environ) AllInstances Uses

func (e *Environ) AllInstances(ctx context.ProviderCallContext) ([]instances.Instance, error)

AllInstances returns all instances in this environment.

func (*Environ) AllRunningInstances Uses

func (e *Environ) AllRunningInstances(ctx context.ProviderCallContext) ([]instances.Instance, error)

AllRunningInstances returns all running, available instances in this environment.

func (*Environ) AllocateContainerAddresses Uses

func (e *Environ) AllocateContainerAddresses(ctx context.ProviderCallContext, hostInstanceID instance.Id, containerTag names.MachineTag, preparedInfo corenetwork.InterfaceInfos) (corenetwork.InterfaceInfos, error)

AllocateContainerAddresses is specified on environs.Networking.

func (*Environ) AreSpacesRoutable Uses

func (*Environ) AreSpacesRoutable(ctx context.ProviderCallContext, space1, space2 *environs.ProviderSpaceInfo) (bool, error)

AreSpacesRoutable is specified on environs.NetworkingEnviron.

func (*Environ) AvailabilityZones Uses

func (e *Environ) AvailabilityZones(ctx context.ProviderCallContext) (corenetwork.AvailabilityZones, error)

AvailabilityZones returns a slice of availability zones.

func (*Environ) Bootstrap Uses

func (e *Environ) Bootstrap(ctx environs.BootstrapContext, callCtx context.ProviderCallContext, args environs.BootstrapParams) (*environs.BootstrapResult, error)

func (*Environ) ClosePorts Uses

func (e *Environ) ClosePorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

func (*Environ) Config Uses

func (e *Environ) Config() *config.Config

func (*Environ) ConstraintsValidator Uses

func (e *Environ) ConstraintsValidator(ctx context.ProviderCallContext) (constraints.Validator, error)

ConstraintsValidator is defined on the Environs interface.

func (*Environ) ControllerInstances Uses

func (e *Environ) ControllerInstances(ctx context.ProviderCallContext, controllerUUID string) ([]instance.Id, error)

func (*Environ) Create Uses

func (e *Environ) Create(ctx context.ProviderCallContext, args environs.CreateParams) error

Create is part of the Environ interface.

func (*Environ) DeletePorts Uses

func (e *Environ) DeletePorts(networks []nova.ServerNetworks) error

DeletePorts goes through and attempts to delete any ports that have been created during the creation of the networks for the given instance.

func (*Environ) DeriveAvailabilityZones Uses

func (e *Environ) DeriveAvailabilityZones(ctx context.ProviderCallContext, args environs.StartInstanceParams) ([]string, error)

DeriveAvailabilityZones is part of the common.ZonedEnviron interface.

func (*Environ) Destroy Uses

func (e *Environ) Destroy(ctx context.ProviderCallContext) error

func (*Environ) DestroyController Uses

func (e *Environ) DestroyController(ctx context.ProviderCallContext, controllerUUID string) error

DestroyController implements the Environ interface.

func (*Environ) DistributeInstances Uses

func (e *Environ) DistributeInstances(
    ctx context.ProviderCallContext, candidates, distributionGroup []instance.Id, limitZones []string,
) ([]instance.Id, error)

DistributeInstances implements the state.InstanceDistributor policy.

func (*Environ) IngressRules Uses

func (e *Environ) IngressRules(ctx context.ProviderCallContext) ([]network.IngressRule, error)

func (*Environ) InstanceAvailabilityZoneNames Uses

func (e *Environ) InstanceAvailabilityZoneNames(ctx context.ProviderCallContext, ids []instance.Id) ([]string, error)

InstanceAvailabilityZoneNames returns the availability zone names for each of the specified instances.

func (*Environ) InstanceTypes Uses

func (e *Environ) InstanceTypes(ctx context.ProviderCallContext, c constraints.Value) (instances.InstanceTypesWithCostMetadata, error)

func (*Environ) Instances Uses

func (e *Environ) Instances(ctx context.ProviderCallContext, ids []instance.Id) ([]instances.Instance, error)

func (*Environ) MaintainInstance Uses

func (*Environ) MaintainInstance(ctx context.ProviderCallContext, args environs.StartInstanceParams) error

MaintainInstance is specified in the InstanceBroker interface.

func (*Environ) MetadataLookupParams Uses

func (e *Environ) MetadataLookupParams(region string) (*simplestreams.MetadataLookupParams, error)

MetadataLookupParams returns parameters which are used to query simplestreams metadata.

func (*Environ) NetworkInterfaces Uses

func (e *Environ) NetworkInterfaces(ctx context.ProviderCallContext, ids []instance.Id) ([]corenetwork.InterfaceInfos, error)

NetworkInterfaces is specified on environs.Networking.

func (*Environ) OpenPorts Uses

func (e *Environ) OpenPorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

func (*Environ) PrecheckInstance Uses

func (e *Environ) PrecheckInstance(ctx context.ProviderCallContext, args environs.PrecheckInstanceParams) error

PrecheckInstance is defined on the environs.InstancePrechecker interface.

func (*Environ) PrecheckUpgradeOperations Uses

func (env *Environ) PrecheckUpgradeOperations() []environs.PrecheckJujuUpgradeOperation

PrecheckUpgradeOperations is part of the environs.JujuUpgradePrechecker interface. It returns a slice of PrecheckJujuUpgradeOperation to be used to determine if a controller can be safely upgraded.

func (*Environ) PrepareForBootstrap Uses

func (e *Environ) PrepareForBootstrap(_ environs.BootstrapContext, _ string) error

PrepareForBootstrap is part of the Environ interface.

func (*Environ) PreparePrechecker Uses

func (e *Environ) PreparePrechecker() error

PreparePrechecker is part of the environs.JujuUpgradePrechecker interface. It is called to to give an Environ a chance to perform interactive operations that are required for prechecking an upgrade.

func (*Environ) Provider Uses

func (e *Environ) Provider() environs.EnvironProvider

func (*Environ) ProviderSpaceInfo Uses

func (*Environ) ProviderSpaceInfo(
    ctx context.ProviderCallContext, space *corenetwork.SpaceInfo,
) (*environs.ProviderSpaceInfo, error)

ProviderSpaceInfo is specified on environs.NetworkingEnviron.

func (*Environ) Region Uses

func (e *Environ) Region() (simplestreams.CloudSpec, error)

Region is specified in the HasRegion interface.

func (*Environ) ReleaseContainerAddresses Uses

func (e *Environ) ReleaseContainerAddresses(ctx context.ProviderCallContext, interfaces []corenetwork.ProviderInterfaceInfo) error

ReleaseContainerAddresses is specified on environs.Networking.

func (*Environ) SSHAddresses Uses

func (*Environ) SSHAddresses(ctx context.ProviderCallContext, addresses corenetwork.SpaceAddresses) (corenetwork.SpaceAddresses, error)

SSHAddresses is specified on environs.SSHAddresses.

func (*Environ) SetClock Uses

func (e *Environ) SetClock(clock clock.Clock)

func (*Environ) SetCloudSpec Uses

func (e *Environ) SetCloudSpec(spec environscloudspec.CloudSpec) error

SetCloudSpec is specified in the environs.Environ interface.

func (*Environ) SetConfig Uses

func (e *Environ) SetConfig(cfg *config.Config) error

func (*Environ) Spaces Uses

func (e *Environ) Spaces(ctx context.ProviderCallContext) ([]corenetwork.SpaceInfo, error)

Spaces is specified on environs.Networking.

func (*Environ) StartInstance Uses

func (e *Environ) StartInstance(
    ctx context.ProviderCallContext, args environs.StartInstanceParams,
) (*environs.StartInstanceResult, error)

StartInstance is specified in the InstanceBroker interface.

func (*Environ) StopInstances Uses

func (e *Environ) StopInstances(ctx context.ProviderCallContext, ids ...instance.Id) error

func (*Environ) StorageProvider Uses

func (e *Environ) StorageProvider(t storage.ProviderType) (storage.Provider, error)

StorageProvider implements storage.ProviderRegistry.

func (*Environ) StorageProviderTypes Uses

func (e *Environ) StorageProviderTypes() ([]storage.ProviderType, error)

StorageProviderTypes implements storage.ProviderRegistry.

func (*Environ) Subnets Uses

func (e *Environ) Subnets(
    ctx context.ProviderCallContext, instId instance.Id, subnetIds []corenetwork.Id,
) ([]corenetwork.SubnetInfo, error)

Subnets is specified on environs.Networking.

func (*Environ) SuperSubnets Uses

func (e *Environ) SuperSubnets(ctx context.ProviderCallContext) ([]string, error)

SuperSubnets is specified on environs.Networking

func (*Environ) SupportsContainerAddresses Uses

func (e *Environ) SupportsContainerAddresses(ctx context.ProviderCallContext) (bool, error)

SupportsContainerAddresses is specified on environs.Networking.

func (*Environ) SupportsSpaceDiscovery Uses

func (e *Environ) SupportsSpaceDiscovery(ctx context.ProviderCallContext) (bool, error)

SupportsSpaceDiscovery is specified on environs.Networking.

func (*Environ) SupportsSpaces Uses

func (e *Environ) SupportsSpaces(ctx context.ProviderCallContext) (bool, error)

SupportsSpaces is specified on environs.Networking.

func (*Environ) TagInstance Uses

func (e *Environ) TagInstance(ctx context.ProviderCallContext, id instance.Id, tags map[string]string) error

TagInstance implements environs.InstanceTagger.

type EnvironProvider Uses

type EnvironProvider struct {
    Configurator      ProviderConfigurator
    FirewallerFactory FirewallerFactory
    FlavorFilter      FlavorFilter

    // NetworkingDecorator, if non-nil, will be used to
    // decorate the default networking implementation.
    // This can be used to override behaviour.
    NetworkingDecorator NetworkingDecorator

    // ClientFromEndpoint returns an Openstack client for the given endpoint.
    ClientFromEndpoint func(endpoint string) client.AuthenticatingClient

func (EnvironProvider) CloudSchema Uses

func (p EnvironProvider) CloudSchema() *jsonschema.Schema

CloudSchema returns the schema for adding new clouds of this type.

func (EnvironProvider) ConfigDefaults Uses

func (p EnvironProvider) ConfigDefaults() schema.Defaults

ConfigDefaults returns the default values for the provider specific config attributes.

func (EnvironProvider) ConfigSchema Uses

func (p EnvironProvider) ConfigSchema() schema.Fields

ConfigSchema returns extra config attributes specific to this provider only.

func (EnvironProvider) DetectRegions Uses

func (EnvironProvider) DetectRegions() ([]cloud.Region, error)

DetectRegions implements environs.CloudRegionDetector.

func (EnvironProvider) MetadataLookupParams Uses

func (p EnvironProvider) MetadataLookupParams(region string) (*simplestreams.MetadataLookupParams, error)

MetadataLookupParams returns parameters which are used to query image metadata to find matching image information.

func (EnvironProvider) Open Uses

func (p EnvironProvider) Open(args environs.OpenParams) (environs.Environ, error)

func (EnvironProvider) Ping Uses

func (p EnvironProvider) Ping(ctx context.ProviderCallContext, endpoint string) error

Ping tests the connection to the cloud, to verify the endpoint is valid.

func (EnvironProvider) PrepareConfig Uses

func (p EnvironProvider) PrepareConfig(args environs.PrepareConfigParams) (*config.Config, error)

PrepareConfig is specified in the EnvironProvider interface.

func (EnvironProvider) Schema Uses

func (EnvironProvider) Schema() environschema.Fields

Schema returns the configuration schema for an environment.

func (EnvironProvider) Validate Uses

func (p EnvironProvider) Validate(cfg, old *config.Config) (valid *config.Config, err error)

func (EnvironProvider) Version Uses

func (EnvironProvider) Version() int

Version is part of the EnvironProvider interface.

type Firewaller Uses

type Firewaller interface {
    // OpenPorts opens the given port ranges for the whole environment.
    OpenPorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

    // ClosePorts closes the given port ranges for the whole environment.
    ClosePorts(ctx context.ProviderCallContext, rules []network.IngressRule) error

    // IngressRules returns the ingress rules applied to the whole environment.
    // It is expected that there be only one ingress rule result for a given
    // port range - the rule's SourceCIDRs will contain all applicable source
    // address rules for that port range.
    IngressRules(ctx context.ProviderCallContext) ([]network.IngressRule, error)

    // DeleteAllModelGroups deletes all security groups for the
    // model.
    DeleteAllModelGroups(ctx context.ProviderCallContext) error

    // DeleteAllControllerGroups deletes all security groups for the
    // controller, ie those for all hosted models.
    DeleteAllControllerGroups(ctx context.ProviderCallContext, controllerUUID string) error

    // DeleteGroups deletes the security groups with the specified names.
    DeleteGroups(ctx context.ProviderCallContext, names ...string) error

    // UpdateGroupController updates all of the security groups for
    // this model to refer to the specified controller, such that
    // DeleteAllControllerGroups will remove them only when called
    // with the specified controller ID.
    UpdateGroupController(ctx context.ProviderCallContext, controllerUUID string) error

    // GetSecurityGroups returns a list of the security groups that
    // belong to given instances.
    GetSecurityGroups(ctx context.ProviderCallContext, ids ...instance.Id) ([]string, error)

    // SetUpGroups sets up initial security groups, if any, and returns
    // their names.
    SetUpGroups(ctx context.ProviderCallContext, controllerUUID, machineID string, apiPort int) ([]string, error)

    // OpenInstancePorts opens the given port ranges for the specified  instance.
    OpenInstancePorts(ctx context.ProviderCallContext, inst instances.Instance, machineID string, rules []network.IngressRule) error

    // CloseInstancePorts closes the given port ranges for the specified  instance.
    CloseInstancePorts(ctx context.ProviderCallContext, inst instances.Instance, machineID string, rules []network.IngressRule) error

    // InstanceIngressRules returns the ingress rules applied to the specified  instance.
    InstanceIngressRules(ctx context.ProviderCallContext, inst instances.Instance, machineID string) ([]network.IngressRule, error)

Firewaller allows custom openstack provider behaviour. This is used in other providers that embed the openstack provider.

type FirewallerFactory Uses

type FirewallerFactory interface {
    GetFirewaller(env environs.Environ) Firewaller

FirewallerFactory for obtaining firewaller object.

type FlavorFilter Uses

type FlavorFilter interface {
    // AcceptFlavor returns true iff the given flavor is acceptable.
    AcceptFlavor(nova.FlavorDetail) bool

FlavorFilter is an interface that can control which server flavors are acceptable.

type FlavorFilterFunc Uses

type FlavorFilterFunc func(nova.FlavorDetail) bool

FlavorFilterFunc is a function type that implements FlavorFilter.

func (FlavorFilterFunc) AcceptFlavor Uses

func (f FlavorFilterFunc) AcceptFlavor(d nova.FlavorDetail) bool

AcceptFlavor is part of the FlavorFilter interface.

type Networking Uses

type Networking interface {
    // AllocatePublicIP allocates a public (floating) IP
    // to the specified instance.
    AllocatePublicIP(instance.Id) (*string, error)

    // DefaultNetworks returns the set of networks that should be
    // added by default to all new instances.
    DefaultNetworks() ([]nova.ServerNetworks, error)

    // ResolveNetwork takes either a network ID or label
    // with a string to specify whether the network is external
    // and returns the corresponding network ID.
    ResolveNetwork(string, bool) (string, error)

    // Subnets returns basic information about subnets known
    // by OpenStack for the environment.
    // Needed for Environ.Networking
    Subnets(instance.Id, []corenetwork.Id) ([]corenetwork.SubnetInfo, error)

    // CreatePort creates a port for a given network id with a subnet ID.
    CreatePort(string, string, corenetwork.Id) (*neutron.PortV2, error)

    // DeletePortByID attempts to remove a port using the given port ID.
    DeletePortByID(string) error

    // NetworkInterfaces requests information about the network
    // interfaces on the given list of instances.
    // Needed for Environ.Networking
    NetworkInterfaces(ids []instance.Id) ([]corenetwork.InterfaceInfos, error)

Networking is an interface providing networking-related operations for an OpenStack Environ.

type NetworkingDecorator Uses

type NetworkingDecorator interface {
    // DecorateNetworking can be used to return a new Networking
    // implementation that overrides the provided, default Networking
    // implementation.
    DecorateNetworking(Networking) (Networking, error)

NetworkingDecorator is an interface that provides a means of overriding the default Networking implementation.

type NeutronNetworking Uses

type NeutronNetworking struct {
    // contains filtered or unexported fields

NeutronNetworking is an implementation of Networking that uses the Neutron network APIs.

func (*NeutronNetworking) AllocatePublicIP Uses

func (n *NeutronNetworking) AllocatePublicIP(instId instance.Id) (*string, error)

AllocatePublicIP is part of the Networking interface.

func (*NeutronNetworking) CreatePort Uses

func (n *NeutronNetworking) CreatePort(name, networkID string, subnetID corenetwork.Id) (*neutron.PortV2, error)

CreatePort creates a port for a given network id with a subnet ID.

func (*NeutronNetworking) DefaultNetworks Uses

func (n *NeutronNetworking) DefaultNetworks() ([]nova.ServerNetworks, error)

DefaultNetworks is part of the Networking interface.

func (*NeutronNetworking) DeletePortByID Uses

func (n *NeutronNetworking) DeletePortByID(portID string) error

DeletePortByID attempts to remove a port using the given port ID.

func (*NeutronNetworking) NetworkInterfaces Uses

func (n *NeutronNetworking) NetworkInterfaces(ids []instance.Id) ([]corenetwork.InterfaceInfos, error)

func (*NeutronNetworking) ResolveNetwork Uses

func (n *NeutronNetworking) ResolveNetwork(name string, external bool) (string, error)

ResolveNetwork is part of the Networking interface.

func (*NeutronNetworking) Subnets Uses

func (n *NeutronNetworking) Subnets(instId instance.Id, subnetIds []corenetwork.Id) ([]corenetwork.SubnetInfo, error)

Subnets returns basic information about the specified subnets known by the provider for the specified instance or list of ids. subnetIds can be empty, in which case all known are returned.

type OpenstackCredentials Uses

type OpenstackCredentials struct{}

func (OpenstackCredentials) CredentialSchemas Uses

func (OpenstackCredentials) CredentialSchemas() map[cloud.AuthType]cloud.CredentialSchema

CredentialSchemas is part of the environs.ProviderCredentials interface.

func (OpenstackCredentials) DetectCredentials Uses

func (c OpenstackCredentials) DetectCredentials() (*cloud.CloudCredential, error)

DetectCredentials is part of the environs.ProviderCredentials interface.

func (OpenstackCredentials) FinalizeCredential Uses

func (OpenstackCredentials) FinalizeCredential(_ environs.FinalizeCredentialContext, args environs.FinalizeCredentialParams) (*cloud.Credential, error)

FinalizeCredential is part of the environs.ProviderCredentials interface.

type OpenstackRenderer Uses

type OpenstackRenderer struct{}

func (OpenstackRenderer) Render Uses

func (OpenstackRenderer) Render(cfg cloudinit.CloudConfig, os jujuos.OSType) ([]byte, error)

type OpenstackStorage Uses

type OpenstackStorage interface {
    GetVolume(volumeId string) (*cinder.Volume, error)
    GetVolumesDetail() ([]cinder.Volume, error)
    DeleteVolume(volumeId string) error
    CreateVolume(cinder.CreateVolumeVolumeParams) (*cinder.Volume, error)
    AttachVolume(serverId, volumeId, mountPoint string) (*nova.VolumeAttachment, error)
    DetachVolume(serverId, attachmentId string) error
    ListVolumeAttachments(serverId string) ([]nova.VolumeAttachment, error)
    SetVolumeMetadata(volumeId string, metadata map[string]string) (map[string]string, error)
    ListVolumeAvailabilityZones() ([]cinder.AvailabilityZone, error)

type ProviderConfigurator Uses

type ProviderConfigurator interface {
    // GetConfigDefaults sets some configuration default values, if any
    GetConfigDefaults() schema.Defaults

    // This method allows to adjust default RunServerOptions,
    // before new server is actually created.
    ModifyRunServerOptions(options *nova.RunServerOpts)

    // This method provides default cloud config.
    // This config can be different for different providers.
    GetCloudConfig(args environs.StartInstanceParams) (cloudinit.CloudConfig, error)

This interface is added to allow to customize OpenStack provider behaviour. This is used in other providers, that embeds OpenStack provider.

type SSLHostnameConfig Uses

type SSLHostnameConfig interface {
    SSLHostnameVerification() bool

SSLHostnameConfig defines the options for host name verification

Package openstack imports 62 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.