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

openstack

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func (p *Provider) Create(workerName, flavorName, location string, jobId int32) (string, error)

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.

func (*Provider) Delete

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

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) 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