Documentation
¶
Overview ¶
Package node ...
Index ¶
- func IsPublicIP(addr string) bool
- func ValidRegion(region string, regions []*Region) bool
- func ValidSKU(skuName string, skus []*SKU) bool
- type BillingType
- type CreateRequest
- type CustomDriver
- func (d *CustomDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *CustomDriver) DefaultUser() string
- func (d *CustomDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *CustomDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *CustomDriver) Provider() string
- func (d *CustomDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *CustomDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type DeleteRequest
- type DigitalOceanDriver
- func (d *DigitalOceanDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *DigitalOceanDriver) DefaultUser() string
- func (d *DigitalOceanDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *DigitalOceanDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *DigitalOceanDriver) Provider() string
- func (d *DigitalOceanDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *DigitalOceanDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type DreamHostDriver
- func (d *DreamHostDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *DreamHostDriver) DefaultUser() string
- func (d *DreamHostDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *DreamHostDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *DreamHostDriver) Provider() string
- func (d *DreamHostDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *DreamHostDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type Driver
- type GCPDriver
- func (d *GCPDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *GCPDriver) DefaultUser() string
- func (d *GCPDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *GCPDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *GCPDriver) Provider() string
- func (d *GCPDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *GCPDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type HeficedDriver
- func (d *HeficedDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *HeficedDriver) DefaultUser() string
- func (d *HeficedDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *HeficedDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *HeficedDriver) Provider() string
- func (d *HeficedDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *HeficedDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type HetznerDriver
- func (d *HetznerDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *HetznerDriver) DefaultUser() string
- func (d *HetznerDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *HetznerDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *HetznerDriver) Provider() string
- func (d *HetznerDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *HetznerDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type ListRequest
- type Networks
- type Node
- type NodeType
- type OVHDriver
- func (d *OVHDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *OVHDriver) DefaultUser() string
- func (d *OVHDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *OVHDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *OVHDriver) Provider() string
- func (d *OVHDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *OVHDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
- type Price
- type Region
- type Regions
- type RegionsRequest
- type SKU
- type SKUsRequest
- type ScalewayDriver
- func (d *ScalewayDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
- func (d *ScalewayDriver) DefaultUser() string
- func (d *ScalewayDriver) Delete(ctx context.Context, req *DeleteRequest) error
- func (d *ScalewayDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
- func (d *ScalewayDriver) Provider() string
- func (d *ScalewayDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
- func (d *ScalewayDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPublicIP ¶
func ValidRegion ¶
Types ¶
type BillingType ¶
type BillingType string
const ( Monthly BillingType = "monthly" Hourly BillingType = "hourly" Custom BillingType = "custom" )
type CreateRequest ¶
type CreateRequest struct {
User string
IPV4 string
Name string
Region string
SKU string
SSHKey string
// hourly(0) | monthly(1)
BillingType BillingType
Spot bool
}
CreateRequest ...
type CustomDriver ¶
type CustomDriver struct{}
func NewCustomDriver ¶
func NewCustomDriver() *CustomDriver
func (*CustomDriver) Create ¶
func (d *CustomDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
func (*CustomDriver) DefaultUser ¶
func (d *CustomDriver) DefaultUser() string
func (*CustomDriver) Delete ¶
func (d *CustomDriver) Delete(ctx context.Context, req *DeleteRequest) error
func (*CustomDriver) List ¶
func (d *CustomDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
func (*CustomDriver) Regions ¶
func (d *CustomDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
func (*CustomDriver) SKUs ¶
func (d *CustomDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
type DeleteRequest ¶
DeleteRequest ...
type DigitalOceanDriver ¶
type DigitalOceanDriver struct {
// contains filtered or unexported fields
}
DigitalOceanDriver ...
func NewDigitalOceanDriver ¶
func NewDigitalOceanDriver(token string) *DigitalOceanDriver
NewDigitalOceanDriver ...
func (*DigitalOceanDriver) Create ¶
func (d *DigitalOceanDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
Create ...
func (*DigitalOceanDriver) DefaultUser ¶
func (d *DigitalOceanDriver) DefaultUser() string
func (*DigitalOceanDriver) Delete ¶
func (d *DigitalOceanDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete ...
func (*DigitalOceanDriver) List ¶
func (d *DigitalOceanDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
List ...
func (*DigitalOceanDriver) Regions ¶
func (d *DigitalOceanDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
Regions ...
func (*DigitalOceanDriver) SKUs ¶
func (d *DigitalOceanDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
SKUs ...
type DreamHostDriver ¶
type DreamHostDriver struct {
// contains filtered or unexported fields
}
DreamHostDriver ...
func NewDreamHostDriver ¶
func NewDreamHostDriver(tenantID, tenantName, username, password string) (*DreamHostDriver, error)
NewDreamHostDriver ...
func (*DreamHostDriver) Create ¶
func (d *DreamHostDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
Create ...
func (*DreamHostDriver) DefaultUser ¶
func (d *DreamHostDriver) DefaultUser() string
func (*DreamHostDriver) Delete ¶
func (d *DreamHostDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete ...
func (*DreamHostDriver) List ¶
func (d *DreamHostDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
List ...
func (*DreamHostDriver) Regions ¶
func (d *DreamHostDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
Regions ...
func (*DreamHostDriver) SKUs ¶
func (d *DreamHostDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
SKUs ...
type Driver ¶
type Driver interface {
// Provider returns the name of the current provider configured
Provider() string
// Regions provides a list of available regions for the current credentials
Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
// SKUs returns a list of available machine specs and prices
SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
// Create provisions a new Node on the provider's service
Create(ctx context.Context, req *CreateRequest) (*Node, error)
// List returns existing nodes for the provider
List(ctx context.Context, req *ListRequest) ([]*Node, error)
// Delete allows for shutting down and deleting of a node
Delete(ctx context.Context, req *DeleteRequest) error
// DefaultUser returns the user allowed for connection and operations
DefaultUser() string
}
A Driver is defines the implementation of a third party driver such as DigitalOcean. The driver is used to facilitate provisioning and tearing down resources.
type GCPDriver ¶
type GCPDriver struct {
// contains filtered or unexported fields
}
func NewGCPDriver ¶
func (*GCPDriver) DefaultUser ¶
func (*GCPDriver) Delete ¶
func (d *GCPDriver) Delete(ctx context.Context, req *DeleteRequest) error
type HeficedDriver ¶
type HeficedDriver struct {
// contains filtered or unexported fields
}
HeficedDriver is a node driver which implements the Driver interface for the Heficed provider. More information can be found in the API docs. https://api.heficed.com/docs/swagger.html
func NewHeficedDriver ¶
func NewHeficedDriver(clientID, clientSecret, tenantID string) (*HeficedDriver, error)
NewHeficedDriver creates a HeficedDriver from oauth credentials. It uses the `oauth2` package and requires ["kronoscloud, "sshkeys"] scope. An error is returned if there is a problem creating the oauth token, or there is no provided `tenantID`.
func (*HeficedDriver) Create ¶
func (d *HeficedDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
Create provisions a new node based on the name which matches the spec definition in `heficedSpecsAlacart`. If the ssh public key provided in the request is not already existing, a new key entry is added. The order is then placed and waits for the machine to have an "running" status. An error is returned if there is a problem finding the template, finding or adding the ssh key, or placing the order.
func (*HeficedDriver) DefaultUser ¶
func (d *HeficedDriver) DefaultUser() string
DefaultUser used to log into the instances
func (*HeficedDriver) Delete ¶
func (d *HeficedDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete force stops the instance ID from the request, then cancels the instance immediately rather than at the end of the billing period.
func (*HeficedDriver) List ¶
func (d *HeficedDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
List returns a list of Node that current have a status of "running".
func (*HeficedDriver) Provider ¶
func (d *HeficedDriver) Provider() string
Provider returns the driver's provider name
func (*HeficedDriver) Regions ¶
func (d *HeficedDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
Regions returns a list of available regions for the current credentials
func (*HeficedDriver) SKUs ¶
func (d *HeficedDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
SKUs queries a list of templates and creates a set of machine sizes from predefined specs in `heficed.go`. The templates are determined by region provided in the `SKUsRequest` and quotes for each 'order' built are requested and added on to the resulting SKU.
type HetznerDriver ¶
type HetznerDriver struct {
// contains filtered or unexported fields
}
HetznerDriver ...
func (*HetznerDriver) Create ¶
func (d *HetznerDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
Create ...
func (*HetznerDriver) DefaultUser ¶
func (d *HetznerDriver) DefaultUser() string
func (*HetznerDriver) Delete ¶
func (d *HetznerDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete ...
func (*HetznerDriver) List ¶
func (d *HetznerDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
List ...
func (*HetznerDriver) Regions ¶
func (d *HetznerDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
Regions ...
func (*HetznerDriver) SKUs ¶
func (d *HetznerDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
SKUs ...
type Node ¶
type Node struct {
User string `json:"user,omitempty"`
Driver string `json:"driver,omitempty"`
ProviderName string `json:"provider_name,omitempty"`
ProviderID string `json:"provider_id,omitempty"`
Name string `json:"name,omitempty"`
Memory int `json:"memory,omitempty"`
CPUs int `json:"vcpus,omitempty"`
Disk int `json:"disk,omitempty"`
Networks *Networks `json:"networks,omitempty"`
Status bool `json:"status,omitempty"`
Region *Region `json:"region,omitempty"`
SKU *SKU `json:"sku,omitempty"`
WireguardPrivKey string `json:"wireguard_priv_key,omitempty"`
WireguardIPv4 string `json:"wireguard_ipv4,omitempty"`
StartedAt int64 `json:"started_at,omitempty"`
StoppedAt int64 `json:"stopped_at,omitempty"`
Type NodeType `json:"node_type,omitempty"`
}
Node represents a host
type NodeType ¶
type NodeType string
type OVHDriver ¶
type OVHDriver struct {
// contains filtered or unexported fields
}
OVHDriver ...
func NewOVHDriver ¶
NewOVHDriver ...
func (*OVHDriver) DefaultUser ¶
func (*OVHDriver) Delete ¶
func (d *OVHDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete ...
type SKU ¶
type SKU struct {
Name string
CPUs int
Memory int
Disk int
NetworkCap int
NetworkSpeed int
PriceMonthly *Price
PriceHourly *Price
}
SKU ...
type ScalewayDriver ¶
type ScalewayDriver struct {
// contains filtered or unexported fields
}
ScalewayDriver ...
func NewScalewayDriver ¶
func NewScalewayDriver(organizationID, accessKey, secretKey string) (*ScalewayDriver, error)
NewScalewayDriver ...
func (*ScalewayDriver) Create ¶
func (d *ScalewayDriver) Create(ctx context.Context, req *CreateRequest) (*Node, error)
Create ...
func (*ScalewayDriver) DefaultUser ¶
func (d *ScalewayDriver) DefaultUser() string
func (*ScalewayDriver) Delete ¶
func (d *ScalewayDriver) Delete(ctx context.Context, req *DeleteRequest) error
Delete ...
func (*ScalewayDriver) List ¶
func (d *ScalewayDriver) List(ctx context.Context, req *ListRequest) ([]*Node, error)
List ...
func (*ScalewayDriver) Regions ¶
func (d *ScalewayDriver) Regions(ctx context.Context, req *RegionsRequest) ([]*Region, error)
Regions ...
func (*ScalewayDriver) SKUs ¶
func (d *ScalewayDriver) SKUs(ctx context.Context, req *SKUsRequest) ([]*SKU, error)
SKUs ...