compute

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdoptMachineResources added in v0.10.0

func AdoptMachineResources(scope *scope.WithLogger, resolved *infrav1.ResolvedMachineSpec, resources *infrav1.MachineResources) error

func HashInstanceSpec added in v0.7.0

func HashInstanceSpec(computeInstance *InstanceSpec) (string, error)

func InstanceTags added in v0.10.0

func InstanceTags(spec *infrav1.OpenStackMachineSpec, openStackCluster *infrav1.OpenStackCluster) []string

InstanceTags returns the tags that should be applied to an instance. The tags are a deduplicated combination of the tags specified in the OpenStackMachineSpec and the ones specified on the OpenStackCluster.

func ResolveMachineSpec added in v0.10.0

func ResolveMachineSpec(scope *scope.WithLogger, spec *infrav1.OpenStackMachineSpec, resolved *infrav1.ResolvedMachineSpec, clusterResourceName, baseName string, openStackCluster *infrav1.OpenStackCluster, managedSecurityGroup *string) (changed bool, err error)

ResolveMachineSpec is responsible for populating a ResolvedMachineSpec from an OpenStackMachineSpec and any external dependencies. The result contains no external dependencies, and does not require any complex logic on creation. Note that we only set the fields in ResolvedMachineSpec that are not set yet. This is ok because: - OpenStackMachine is immutable, so we can't change the spec after the machine is created. - the bastion is mutable, but we delete the bastion when the spec changes, so the bastion status will be empty.

Types

type InstanceIdentifier added in v0.5.0

type InstanceIdentifier struct {
	ID   string
	Name string
}

InstanceIdentifier describes an instance which has not necessarily been fetched.

type InstanceNetworkStatus added in v0.5.0

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

InstanceNetworkStatus represents the network status of an OpenStack instance as used by CAPO. Therefore it may use more context than just data which was returned by OpenStack.

func (*InstanceNetworkStatus) Addresses added in v0.5.0

func (ns *InstanceNetworkStatus) Addresses() []corev1.NodeAddress

Addresses returns a list of NodeAddresses containing all addresses which will be reported on the OpenStackMachine object.

func (*InstanceNetworkStatus) FloatingIP added in v0.5.0

func (ns *InstanceNetworkStatus) FloatingIP(networkName string) string

FloatingIP returns the first listed floating ip of an instance for the given network name.

func (*InstanceNetworkStatus) IP added in v0.5.0

func (ns *InstanceNetworkStatus) IP(networkName string) string

IP returns the first listed ip of an instance for the given network name.

type InstanceSpec added in v0.5.0

type InstanceSpec struct {
	Name                   string
	ImageID                string
	Flavor                 string
	SSHKeyName             string
	UserData               string
	Metadata               map[string]string
	ConfigDrive            bool
	FailureDomain          string
	RootVolume             *infrav1.RootVolume
	AdditionalBlockDevices []infrav1.AdditionalBlockDevice
	ServerGroupID          string
	Trunk                  bool
	Tags                   []string
}

InstanceSpec defines the fields which can be set on a new OpenStack instance.

type InstanceStatus added in v0.5.0

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

InstanceStatus represents instance data which has been returned by OpenStack.

func NewInstanceStatusFromServer added in v0.5.0

func NewInstanceStatusFromServer(server *clients.ServerExt, logger logr.Logger) *InstanceStatus

func (*InstanceStatus) AvailabilityZone added in v0.5.0

func (is *InstanceStatus) AvailabilityZone() string

func (*InstanceStatus) ID added in v0.5.0

func (is *InstanceStatus) ID() string

func (*InstanceStatus) InstanceIdentifier added in v0.5.0

func (is *InstanceStatus) InstanceIdentifier() *InstanceIdentifier

InstanceIdentifier returns an InstanceIdentifier object for an InstanceStatus.

func (*InstanceStatus) Name added in v0.5.0

func (is *InstanceStatus) Name() string

func (*InstanceStatus) NetworkStatus added in v0.5.0

func (is *InstanceStatus) NetworkStatus() (*InstanceNetworkStatus, error)

NetworkStatus returns an InstanceNetworkStatus object for an InstanceStatus.

func (*InstanceStatus) SSHKeyName added in v0.5.0

func (is *InstanceStatus) SSHKeyName() string

func (*InstanceStatus) State added in v0.5.0

func (is *InstanceStatus) State() infrav1.InstanceState

func (*InstanceStatus) UpdateBastionStatus added in v0.10.0

func (is *InstanceStatus) UpdateBastionStatus(openStackCluster *infrav1.OpenStackCluster)

BastionStatus updates BastionStatus in openStackCluster.

type Service

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

func NewService

func NewService(scope *scope.WithLogger) (*Service, error)

NewService returns an instance of the compute service.

func (*Service) CreateInstance added in v0.3.5

func (s *Service) CreateInstance(eventObject runtime.Object, instanceSpec *InstanceSpec, portIDs []string) (*InstanceStatus, error)

func (*Service) DeleteInstance added in v0.3.5

func (s *Service) DeleteInstance(eventObject runtime.Object, instanceStatus *InstanceStatus) error

func (*Service) DeleteVolumes added in v0.10.0

func (s *Service) DeleteVolumes(instanceName string, rootVolume *infrav1.RootVolume, additionalBlockDevices []infrav1.AdditionalBlockDevice) error

DeleteVolumes deletes any cinder volumes which were created for the instance. Note that this need only be called when the server was not successfully created. If the server was created the volume will have been added with DeleteOnTermination=true, and will be automatically cleaned up with the server. We don't pass InstanceSpec here because we only require instance name, rootVolume, and additionalBlockDevices, and resolving the whole InstanceSpec introduces unnecessary failure modes.

func (*Service) GetAvailabilityZones added in v0.3.0

func (s *Service) GetAvailabilityZones() ([]availabilityzones.AvailabilityZone, error)

func (*Service) GetImageID added in v0.10.0

func (s *Service) GetImageID(image infrav1.ImageParam) (string, error)

Helper function for getting image ID from name, ID, or tags.

func (*Service) GetInstanceStatus added in v0.5.0

func (s *Service) GetInstanceStatus(resourceID string) (instance *InstanceStatus, err error)

func (*Service) GetInstanceStatusByName added in v0.5.0

func (s *Service) GetInstanceStatusByName(eventObject runtime.Object, name string) (instance *InstanceStatus, err error)

func (*Service) GetManagementPort added in v0.5.0

func (s *Service) GetManagementPort(openStackCluster *infrav1.OpenStackCluster, instanceStatus *InstanceStatus) (*ports.Port, error)

GetManagementPort returns the port which is used for management and external traffic. Cluster floating IPs must be associated with this port.

func (*Service) GetServerGroupID added in v0.10.0

func (s *Service) GetServerGroupID(serverGroupParam *infrav1.ServerGroupParam) (string, error)

GetServerGroupID looks up a server group using the passed filter and returns its ID. It'll return an error when server group is not found or there are multiple.

Jump to

Keyboard shortcuts

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