Documentation
¶
Index ¶
- Constants
- Variables
- func AddSSHKey(opt SshKeyOptions) (*godo.Key, error)
- func AddTemplate(client *sftp.Client) error
- func Apply(name string) (*pb.ResourceResponse, error)
- func Await(id int) chan *godo.Droplet
- func CloudKitSSHKey() (*godo.Key, error)
- func Connect(addr string, key []byte) (*ssh.Client, *ssh.Session, error)
- func CreateDroplet(ctx context.Context, cfg *Config) (*godo.Droplet, error)
- func ExtractCredentials(client *sftp.Client) (*lnd.Credentials, error)
- func FetchNodeCert(client *sftp.Client) ([]byte, error)
- func GenerateAndAddSSHKey(name string)
- func GetDropletSize(size string) string
- func GetRegionName(region string) string
- func NewClient() *godo.Client
- func NewProvider(req *pb.CreateRequest) providers.Provider
- func Provision(ip string) ([]byte, error)
- func RecordDomain(ctx context.Context, cfg DomainConfig) error
- func RemoveKey(id int) error
- func RetryProvisioner(ip string) ([]byte, error)
- func SFTPClient(client *ssh.Client) (*sftp.Client, error)
- func SelectKeys() ([]godo.Key, error)
- func Start(client *ssh.Client, session *ssh.Session) (io.Writer, error)
- func ValidDropletSize(size string) bool
- func ValidRegion(region string) bool
- type Config
- type DomainConfig
- type Image
- type LND
- type Provider
- func (p *Provider) Annotate(id string, l labels.Labels) error
- func (p *Provider) Apply() error
- func (p *Provider) AwaitReadiness() chan error
- func (p *Provider) Cancel() error
- func (p *Provider) Clone() error
- func (p *Provider) ProbeReadiness() (bool, error)
- func (p *Provider) Read() error
- func (p *Provider) Select() (target.Selection, error)
- func (p *Provider) Stop() error
- func (p *Provider) Teardown() error
- type SshKeyOptions
Constants ¶
const ( PageSizeDefault = 200 InitPageDefault = 1 DefaultRegion = "nyc3" DefaultSize = "s-2vcpu-2gb" )
const ( LNDConfigBase = "/var/app/lnd/docker/lnd" LNDConfigPath = "/var/app/lnd/docker/lnd/lnd.conf" CredentialsPath = "/var/app/lnd/docker/lnd/data/chain/bitcoin/mainnet/admin.macaroon" )
const (
StartCommand = "chmod +x /var/app/lnd/docker/start-up.sh && /usr/bin/docker compose -f /var/app/lnd/docker/docker-compose.yml up -d"
)
Variables ¶
var AllDropletSizes = map[string]bool{ "s-1vcpu-512mb-10gb": true, "s-1vcpu-1gb": true, "s-1vcpu-1gb-amd": true, "s-1vcpu-1gb-intel": true, "s-1vcpu-2gb": true, "s-1vcpu-2gb-amd": true, "s-1vcpu-2gb-intel": true, "s-2vcpu-2gb": true, "s-2vcpu-2gb-amd": true, "s-2vcpu-2gb-intel": true, "s-2vcpu-4gb": true, "s-2vcpu-4gb-amd": true, "s-2vcpu-4gb-intel": true, "c-2": true, "c2-2vcpu-4gb": true, "s-4vcpu-8gb": true, "s-4vcpu-8gb-amd": true, "s-4vcpu-8gb-intel": true, "g-2vcpu-8gb": true, "gd-2vcpu-8gb": true, "m-2vcpu-16gb": true, "c-4": true, "c2-4vcpu-8gb": true, "s-8vcpu-16gb": true, "m3-2vcpu-16gb": true, "s-8vcpu-16gb-amd": true, "s-8vcpu-16gb-intel": true, "g-4vcpu-16gb": true, "so-2vcpu-16gb": true, "m6-2vcpu-16gb": true, "gd-4vcpu-16gb": true, "so1_5-2vcpu-16gb": true, "m-4vcpu-32gb": true, "c-8": true, "c2-8vcpu-16gb": true, "m3-4vcpu-32gb": true, "g-8vcpu-32gb": true, "so-4vcpu-32gb": true, "m6-4vcpu-32gb": true, "gd-8vcpu-32gb": true, "so1_5-4vcpu-32gb": true, "m-8vcpu-64gb": true, "c-16": true, "c2-16vcpu-32gb": true, "m3-8vcpu-64gb": true, "g-16vcpu-64gb": true, "so-8vcpu-64gb": true, "m6-8vcpu-64gb": true, "gd-16vcpu-64gb": true, "so1_5-8vcpu-64gb": true, "m-16vcpu-128gb": true, "c-32": true, "c2-32vcpu-64gb": true, "m3-16vcpu-128gb": true, "c-48": true, "m-24vcpu-192gb": true, "g-32vcpu-128gb": true, "so-16vcpu-128gb": true, "m6-16vcpu-128gb": true, "gd-32vcpu-128gb": true, "c2-48vcpu-96gb": true, "m3-24vcpu-192gb": true, "g-40vcpu-160gb": true, "so1_5-16vcpu-128gb": true, "m-32vcpu-256gb": true, "gd-40vcpu-160gb": true, "so-24vcpu-192gb": true, "m6-24vcpu-192gb": true, "m3-32vcpu-256gb": true, "so1_5-24vcpu-192gb": true, "so-32vcpu-256gb": true, "m6-32vcpu-256gb": true, "so1_5-32vcpu-256gb": true, }
var DropletSizes = map[string]string{
"default": "s-1vcpu-2gb",
"small": "s-1vcpu-2gb",
"medium": "s-1vcpu-2gb",
"large": "s-1vcpu-2gb",
}
droplet size mappings
var Regions = map[string]string{
"nyc1": "New York 1",
"nyc2": "New York 2",
"nyc3": "New York 3",
"ams1": "Amsterdam 1",
"sfo1": "San Francisco 1",
"sfo2": "San Francisco 2",
"sfo3": "San Francisco 3",
}
region mappings
Functions ¶
func AddTemplate ¶
func CloudKitSSHKey ¶
func ExtractCredentials ¶
func ExtractCredentials(client *sftp.Client) (*lnd.Credentials, error)
func GenerateAndAddSSHKey ¶
func GenerateAndAddSSHKey(name string)
GenerateAndAddSSHKey will generate a new ssh key and add it to the account
func GetDropletSize ¶
func GetRegionName ¶
func NewProvider ¶
func NewProvider(req *pb.CreateRequest) providers.Provider
NewProvider initializes a Provider with defaults
func Provision ¶
Provision uses ssh to connect to the new node place an lnd config with given parameters, start lnd and fetch the tls cert
func RecordDomain ¶
func RecordDomain(ctx context.Context, cfg DomainConfig) error
RecordDomain will take a domainConfiguration and create a domain record for the given domain.
func RetryProvisioner ¶
func SelectKeys ¶
Select keys will list all keys and filter based on the default tags
func ValidDropletSize ¶
func ValidRegion ¶
Types ¶
type Config ¶
type Config struct { ID int Name string Alias string Size string SSHKey string VPC string ImageID string // Configurations LND LND }
Config holds allowed values for an implemented resource provider. Any value outside of this config is unable to be modified during an experiment
type DomainConfig ¶
DomainConfig is a configuration for a domain record.
type Provider ¶
type Provider struct { // Config holds our internal configuration options // for the instance of the Provider Config Config }
Provider implements a Provider
func (*Provider) Annotate ¶
Annotate should implement applying labels or tags for a given resource type
func (*Provider) AwaitReadiness ¶
AwaitReadiness should be implemented to detect when a Provider has finished setting up a variant and can begin using it in an experiment
func (*Provider) ProbeReadiness ¶
ProbeReadiness checks that the provisioned resource is available and ready to be included in a live experiment
func (*Provider) Read ¶
Read fetches and stores the configuration for an existing elasticache cluster. What is read of the existing resource acts as the template/configuration to implement a clone via creating a new resource with the existing output as input for a variant