Documentation
¶
Index ¶
- type OrphanVolume
- type Provider
- func (p *Provider) Create(params providers.CreateParams) (providers.CreateResult, error)
- func (p *Provider) Delete(workerName, location string) error
- func (p *Provider) DeleteOrphanVolume(region, volumeID string) error
- func (p *Provider) List(location string) (map[string]string, error)
- func (p *Provider) ListOrphanVolumes(region string, liveNames map[string]struct{}) ([]OrphanVolume, error)
- func (p *Provider) Restart(workerName, location string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrphanVolume ¶ added in v0.10.0
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 ¶
NewFromConfig constructs a Provider from YAML OpenstackConfig (no env required).
func NewFromEnv ¶
NewFromEnv constructs a Provider using environment variables (non-fatal if some are missing).
func (*Provider) Create ¶
func (p *Provider) Create(params providers.CreateParams) (providers.CreateResult, 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. 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) DeleteOrphanVolume ¶ added in v0.10.0
DeleteOrphanVolume destroys a single volume by ID, detaching any stale attachments first. Used by the orphan-volume janitor.
func (*Provider) List ¶
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.