compute

package
v0.11.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 33 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdoptServerResources added in v0.11.0

func AdoptServerResources(scope *scope.WithLogger, resolved *infrav1alpha1.ResolvedServerSpec, resources *infrav1alpha1.ServerResources) 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 ResolveServerSpec added in v0.11.0

func ResolveServerSpec(ctx context.Context, scope *scope.WithLogger, k8sClient client.Client, openStackServer *infrav1alpha1.OpenStackServer) (bool, bool, error)

ResolveServerSpec is responsible for populating a ResolvedServerSpec 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 ResolvedServerSpec that are not set yet. This is ok because OpenStackServer is immutable, so we can't change the spec after the machine is created.

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
	FlavorID                      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
	SchedulerAdditionalProperties []infrav1.SchedulerHintAdditionalProperty
}

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 *servers.Server, 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) GetFlavorID added in v0.11.0

func (s *Service) GetFlavorID(flavorID, flavorName *string) (string, error)

Helper to resolve a flavor ID. TODO: needs a breaking CRD change so it works like images.

func (*Service) GetImageID added in v0.10.0

func (s *Service) GetImageID(ctx context.Context, k8sClient client.Client, namespace string, 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