Documentation ¶
Index ¶
- Variables
- func AllProviderNames() []string
- func FanOut(list List, action func(Provider, List) error) error
- func FindActiveAccounts() (map[string]string, error)
- func ForProvider(named string, action func(Provider) error) error
- func ProvidersParallel(named []string, action func(Provider) error) error
- func ProvidersSequential(named []string, action func(Provider) error) error
- type CreateOpts
- type List
- type Provider
- type ProviderFlags
- type VM
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadNetwork = errors.New("could not determine network information") ErrInvalidName = errors.New("invalid VM name") ErrNoExpiration = errors.New("could not determine expiration") )
Error values for VM.Error
var Providers = map[string]Provider{}
Providers contains all known Provider instances. This is initialized by subpackage init() functions.
Functions ¶
func AllProviderNames ¶
func AllProviderNames() []string
AllProviderNames returns the names of all known vm Providers. This is useful with the ProvidersSequential or ProvidersParallel methods.
func FanOut ¶
FanOut collates a collection of VMs by their provider and invoke the callbacks in parallel.
func FindActiveAccounts ¶
FindActiveAccount queries the active providers for the name of the user account.
func ForProvider ¶
ForProvider resolves the Provider with the given name and executes the action.
func ProvidersParallel ¶
ProvidersParallel concurrently executes actions for each named Provider.
Types ¶
type CreateOpts ¶
type CreateOpts struct { UseLocalSSD bool Lifetime time.Duration GeoDistributed bool VMProviders []string }
CreateOpts is the set of options when creating VMs.
type List ¶
type List []VM
func (List) ProviderIDs ¶
ProviderIDs extracts all ProviderID values from the List.
type Provider ¶
type Provider interface { CleanSSH() error ConfigSSH() error Create(names []string, opts CreateOpts) error Delete(vms List) error Extend(vms List, lifetime time.Duration) error // Return the account name associated with the provider FindActiveAccount() (string, error) // Returns a hook point for extending top-level roachprod tooling flags Flags() ProviderFlags List() (List, error) // The name of the Provider, which will also surface in the top-level Providers map. Name() string }
A Provider is a source of virtual machines running on some hosting platform.
type ProviderFlags ¶
type ProviderFlags interface { // Configures a FlagSet with any options relevant to the `create` command. ConfigureCreateFlags(*pflag.FlagSet) // Configures a FlagSet with any options relevant to cluster manipulation // commands (`create`, `destroy`, `list`, `sync` and `gc`). ConfigureClusterFlags(*pflag.FlagSet) }
A hook point for Providers to supply additional, provider-specific flags to various roachprod commands. In general, the flags should be prefixed with the provider's name to prevent collision between similar options.
If a new command is added (perhaps `roachprod enlarge`) that needs additional provider- specific flags, add a similarly-named method `ConfigureEnlargeFlags` to mix in the additional flags.
type VM ¶
type VM struct { Name string `json:"name"` CreatedAt time.Time `json:"created_at"` // If non-empty, indicates that some or all of the data in the VM instance // is not present or otherwise invalid. Errors []error `json:"errors"` Lifetime time.Duration `json:"lifetime"` // The provider-internal DNS name for the VM instance DNS string `json:"dns"` // The name of the cloud provider that hosts the VM instance Provider string `json:"provider"` // The provider-specific id for the instance. This may or may not be the same as Name, depending // on whether or not the cloud provider automatically assigns VM identifiers. ProviderID string `json:"provider_id"` PrivateIP string `json:"private_ip"` PublicIP string `json:"public_ip"` // The username that should be used to connect to the VM. RemoteUser string `json:"remote_user"` // The VPC value defines an equivalency set for VMs that can route // to one another via private IP addresses. We use this later on // when determining whether or not cluster member should advertise // their public or private IP. VPC string `json:"vpc"` MachineType string `json:"machine_type"` Zone string `json:"zone"` }
A VM is an abstract representation of a specific machine instance. This type is used across the various cloud providers supported by roachprod.