Help us shape the future of Go! Take the 2026 Go Developer Survey

openstack

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrphanVolume added in v0.10.0

type OrphanVolume struct {
	ID         string
	Name       string
	WorkerName string
	Region     string
	SizeGB     int
}

OrphanVolume is the shape the janitor consumes: enough to decide whether to delete, log the decision, and emit a worker_event.

type Provider

type Provider struct {
	C config.OpenstackConfig
	// Defaults used when arguments are empty
	DefaultRegion string // fallback region when Create() location is empty
	Image         string // name or ID (env OPENSTACK_IMAGE)
	NetworkID     string // tenant network ID (env OPENSTACK_NETWORK_ID)
	ExtNetworkID  string // external network ID for FIPs (env OPENSTACK_EXTNET_ID)
	Keypair       string // existing keypair name (env OPENSTACK_KEYPAIR)
	UserData      []byte // cloud-init content (from env or file)
	Name          string // provider name (e.g., "openstack.myconfig")
	// contains filtered or unexported fields
}

Provider implements basic OpenStack interactions. Fields are mostly optional; when empty, values are discovered via env or API lookups. Keep this struct very lightweight so it can be created easily in tests.

func NewFromConfig

func NewFromConfig(name string, cfg config.Config, c config.OpenstackConfig) (*Provider, error)

NewFromConfig constructs a Provider from YAML OpenstackConfig (no env required).

func NewFromEnv

func NewFromEnv() (*Provider, error)

NewFromEnv constructs a Provider using environment variables (non-fatal if some are missing).

func (*Provider) Create

Create boots a VM and attaches a floating IP when an external network is available. Returns the chosen public IP, or a private IP if no FIP could be allocated. When params.ExtraStorageGB > 0, also provisions a Cinder volume of that size, attaches it to the instance, and persists its ID on the result so the server can later detach+destroy it on delete.

func (*Provider) Delete

func (p *Provider) Delete(workerName, location string) error

func (*Provider) DeleteOrphanVolume added in v0.10.0

func (p *Provider) DeleteOrphanVolume(region, volumeID string) error

DeleteOrphanVolume destroys a single volume by ID, detaching any stale attachments first. Used by the orphan-volume janitor.

func (*Provider) List

func (p *Provider) List(location string) (map[string]string, error)

List returns a map of server name -> preferred IP (public if available, else private).

func (*Provider) ListOrphanVolumes added in v0.10.0

func (p *Provider) ListOrphanVolumes(region string, liveNames map[string]struct{}) ([]OrphanVolume, error)

ListOrphanVolumes returns every Cinder volume in region whose scitq_worker metadata is set but whose worker name is NOT in the liveNames set. The server's orphan-volume janitor passes the names of workers that are still live or recently-deleted (so we don't race with an in-flight Delete). Returned volumes are ready to be fed back into DeleteOrphanVolume one at a time.

func (*Provider) Restart

func (p *Provider) Restart(workerName, location string) error

Jump to

Keyboard shortcuts

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