installer

package
v0.0.0-...-1d4c075 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2016 License: BSD-3-Clause Imports: 62 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClusterNotFoundError = errors.New("Cluster not found")
View Source
var DefaultInstanceType = "m4.large"
View Source
var DisallowedEC2InstanceTypes = []string{"t1.micro", "t2.micro", "t2.small", "m1.small"}
View Source
var StackNotFoundError = errors.New("Stack does not exist")

Functions

func ServeHTTP

func ServeHTTP() error

Types

type AWSCluster

type AWSCluster struct {
	ClusterID    string     `json:"cluster_id" ql:"index xCluster"`
	StackID      string     `json:"stack_id"`
	StackName    string     `json:"stack_name"`
	ImageID      string     `json:"image_id,omitempty"`
	Region       string     `json:"region"`
	InstanceType string     `json:"instance_type"`
	VpcCIDR      string     `json:"vpc_cidr"`
	SubnetCIDR   string     `json:"subnet_cidr"`
	DNSZoneID    string     `json:"dns_zone_id"`
	DeletedAt    *time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func (*AWSCluster) Base

func (c *AWSCluster) Base() *BaseCluster

func (*AWSCluster) Delete

func (c *AWSCluster) Delete()

func (*AWSCluster) FindCredentials

func (c *AWSCluster) FindCredentials() (aws.CredentialsProvider, error)

func (*AWSCluster) Run

func (c *AWSCluster) Run()

func (*AWSCluster) SetBase

func (c *AWSCluster) SetBase(base *BaseCluster)

func (*AWSCluster) SetCreds

func (c *AWSCluster) SetCreds(creds *Credential) error

func (*AWSCluster) SetDefaultsAndValidate

func (c *AWSCluster) SetDefaultsAndValidate() error

func (*AWSCluster) Type

func (c *AWSCluster) Type() string

type AzureCluster

type AzureCluster struct {
	ClusterID      string     `json:"cluster_id" ql:"index xCluster"`
	SubscriptionID string     `json:"subscription_id"`
	Region         string     `json:"region"`
	Size           string     `json:"size"`
	DeletedAt      *time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func (*AzureCluster) Base

func (c *AzureCluster) Base() *BaseCluster

func (*AzureCluster) Delete

func (c *AzureCluster) Delete()

func (*AzureCluster) Run

func (c *AzureCluster) Run()

func (*AzureCluster) SetBase

func (c *AzureCluster) SetBase(base *BaseCluster)

func (*AzureCluster) SetCreds

func (c *AzureCluster) SetCreds(creds *Credential) error

func (*AzureCluster) SetDefaultsAndValidate

func (c *AzureCluster) SetDefaultsAndValidate() error

func (*AzureCluster) Type

func (c *AzureCluster) Type() string

type BareCluster

type BareCluster struct {
	Targets []*TargetServer
	Base    *BaseCluster
	// contains filtered or unexported fields
}

func (*BareCluster) InstallFlynn

func (c *BareCluster) InstallFlynn() error

type BaseCluster

type BaseCluster struct {
	ID                  string            `json:"id"`
	CredentialID        string            `json:"credential_id"`
	Type                string            `json:"type"`                    // enum(aws, digital_ocean, azure, ssh)
	State               string            `json:"state" ql:"index xState"` // enum(starting, error, running, deleting)
	Name                string            `json:"name" ql:"-"`
	NumInstances        int64             `json:"num_instances"`
	ControllerKey       string            `json:"controller_key,omitempty"`
	ControllerPin       string            `json:"controller_pin,omitempty"`
	DashboardLoginToken string            `json:"dashboard_login_token,omitempty"`
	Domain              *Domain           `json:"domain" ql:"-"`
	CACert              string            `json:"ca_cert"`
	SSHKey              *sshkeygen.SSHKey `json:"-" ql:"-"`
	SSHKeyName          string            `json:"ssh_key_name,omitempty"`
	SSHUsername         string            `json:"-" ql:"-"`
	DiscoveryToken      string            `json:"discovery_token"`
	InstanceIPs         []string          `json:"instance_ips,omitempty" ql:"-"`
	DeletedAt           *time.Time        `json:"deleted_at,omitempty"`
	HasBackup           bool              `json:"has_backup,omitempty" ql:"-"`
	// contains filtered or unexported fields
}

func (*BaseCluster) Abort

func (c *BaseCluster) Abort()

func (*BaseCluster) ChoicePrompt

func (c *BaseCluster) ChoicePrompt(choice Choice) (string, error)

func (*BaseCluster) ClusterConfig

func (c *BaseCluster) ClusterConfig() *cfg.Cluster

func (*BaseCluster) CredentialPrompt

func (c *BaseCluster) CredentialPrompt(msg string) string

func (*BaseCluster) DashboardLoginMsg

func (c *BaseCluster) DashboardLoginMsg() (string, error)

func (*BaseCluster) FindCredentials

func (c *BaseCluster) FindCredentials() (*Credential, error)

func (*BaseCluster) HandleAuthenticationFailure

func (c *BaseCluster) HandleAuthenticationFailure(cluster Cluster, err error) bool

func (*BaseCluster) IsAborted

func (c *BaseCluster) IsAborted() bool

func (*BaseCluster) IsRestoringBackup

func (c *BaseCluster) IsRestoringBackup() bool

func (*BaseCluster) MarkDeleted

func (c *BaseCluster) MarkDeleted() (err error)

func (*BaseCluster) NewBackupReceiver

func (c *BaseCluster) NewBackupReceiver(backup io.Reader, size int) *ClusterBackupReceiver

func (*BaseCluster) PromptFileInput

func (c *BaseCluster) PromptFileInput(msg string) (int, io.Reader, chan<- error)

func (*BaseCluster) PromptInput

func (c *BaseCluster) PromptInput(msg string) string

func (*BaseCluster) PromptProtectedInput

func (c *BaseCluster) PromptProtectedInput(msg string) string

func (*BaseCluster) ReceiveBackup

func (c *BaseCluster) ReceiveBackup(backup io.Reader, size int) error

func (*BaseCluster) SendError

func (c *BaseCluster) SendError(err error)

func (*BaseCluster) SendLog

func (c *BaseCluster) SendLog(description string)

func (*BaseCluster) SendProgress

func (c *BaseCluster) SendProgress(event *ProgressEvent)

func (*BaseCluster) SetDefaultsAndValidate

func (c *BaseCluster) SetDefaultsAndValidate() error

func (*BaseCluster) StackAddCmd

func (c *BaseCluster) StackAddCmd() (string, error)

func (*BaseCluster) YesNoPrompt

func (c *BaseCluster) YesNoPrompt(msg string) bool

type Choice

type Choice struct {
	Message string         `json:"message"`
	Options []ChoiceOption `json:"options"`
}

type ChoiceOption

type ChoiceOption struct {
	Type  int    `json:"type"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Cluster

type Cluster interface {
	Base() *BaseCluster
	SetDefaultsAndValidate() error
	Run()
	Delete()
	Type() string
	SetBase(*BaseCluster)
	SetCreds(*Credential) error
}

type ClusterBackupReceiver

type ClusterBackupReceiver struct {
	// contains filtered or unexported fields
}

func (*ClusterBackupReceiver) Close

func (cbr *ClusterBackupReceiver) Close() error

func (*ClusterBackupReceiver) Error

func (cbr *ClusterBackupReceiver) Error() error

func (*ClusterBackupReceiver) Read

func (cbr *ClusterBackupReceiver) Read(p []byte) (int, error)

func (*ClusterBackupReceiver) UploadComplete

func (cbr *ClusterBackupReceiver) UploadComplete(err error)

func (*ClusterBackupReceiver) Wait

func (cbr *ClusterBackupReceiver) Wait() error

type Credential

type Credential struct {
	ID         string             `json:"id"`
	Secret     string             `json:"secret"`
	Name       string             `json:"name"`
	Type       string             `json:"type"`     // enum(aws, digital_ocean, azure)
	Endpoint   string             `json:"endpoint"` // token endpoint
	OAuthCreds []*OAuthCredential `json:"oauth_creds,omitempty" ql:"-"`
	DeletedAt  *time.Time         `json:"deleted_at,omitempty"`
}

type DigitalOceanCluster

type DigitalOceanCluster struct {
	ClusterID      string     `json:"cluster_id" ql:"index xCluster"`
	Region         string     `json:"region"`
	Size           string     `json:"size"`
	KeyFingerprint string     `json:"key_fingerprint"`
	DropletIDs     []int64    `json:"droplet_ids" ql:"-"`
	DeletedAt      *time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func (*DigitalOceanCluster) Base

func (c *DigitalOceanCluster) Base() *BaseCluster

func (*DigitalOceanCluster) Delete

func (c *DigitalOceanCluster) Delete()

func (*DigitalOceanCluster) Run

func (c *DigitalOceanCluster) Run()

func (*DigitalOceanCluster) SetBase

func (c *DigitalOceanCluster) SetBase(base *BaseCluster)

func (*DigitalOceanCluster) SetCreds

func (c *DigitalOceanCluster) SetCreds(creds *Credential) error

func (*DigitalOceanCluster) SetDefaultsAndValidate

func (c *DigitalOceanCluster) SetDefaultsAndValidate() error

func (*DigitalOceanCluster) Type

func (c *DigitalOceanCluster) Type() string

type DigitalOceanDroplet

type DigitalOceanDroplet struct {
	ClusterID string     `json:"cluster_id" ql:"index xCluster"`
	ID        int64      `json:"id"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

type Domain

type Domain struct {
	ClusterID string     `json:"-"`
	Name      string     `json:"domain"`
	Token     string     `json:"token"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func AllocateDomain

func AllocateDomain() (*Domain, error)

func (*Domain) Configure

func (d *Domain) Configure(nameservers []string) error

func (*Domain) ConfigureIPAddresses

func (d *Domain) ConfigureIPAddresses(ips []string) error

func (*Domain) Status

func (d *Domain) Status() (string, error)

type Event

type Event struct {
	ID           string       `json:"id"`
	Timestamp    time.Time    `json:"timestamp"`
	Type         string       `json:"type"`
	ClusterID    string       `json:"cluster_id,omitempty"`
	Cluster      *BaseCluster `json:"cluster,omitempty" ql:"-"`
	ResourceType string       `json:"resource_type,omitempty"`
	ResourceID   string       `json:"resource_id,omitempty"`
	Resource     interface{}  `json:"resource,omitempty" ql:"-"`
	Description  string       `json:"description,omitempty"`
	DeletedAt    *time.Time   `json:"deleted_at,omitempty"`
}

func (*Event) EventID

func (event *Event) EventID() string

type Installer

type Installer struct {
	// contains filtered or unexported fields
}

func NewInstaller

func NewInstaller(l log.Logger) *Installer

func (*Installer) ClusterDeleted

func (i *Installer) ClusterDeleted(id string)

func (*Installer) DeleteCluster

func (i *Installer) DeleteCluster(id string) error

func (*Installer) DeleteCredentials

func (i *Installer) DeleteCredentials(id string) error

func (*Installer) FindAWSCluster

func (i *Installer) FindAWSCluster(id string) (*AWSCluster, error)

func (*Installer) FindAzureCluster

func (i *Installer) FindAzureCluster(id string) (*AzureCluster, error)

func (*Installer) FindBaseCluster

func (i *Installer) FindBaseCluster(id string) (*BaseCluster, error)

func (*Installer) FindCluster

func (i *Installer) FindCluster(id string) (cluster Cluster, err error)

func (*Installer) FindCredentials

func (i *Installer) FindCredentials(id string) (*Credential, error)

func (*Installer) FindDigitalOceanCluster

func (i *Installer) FindDigitalOceanCluster(id string) (*DigitalOceanCluster, error)

func (*Installer) FindSSHCluster

func (i *Installer) FindSSHCluster(id string) (*SSHCluster, error)

func (*Installer) GetEventsSince

func (i *Installer) GetEventsSince(eventID string) []*Event

func (*Installer) LaunchCluster

func (i *Installer) LaunchCluster(c Cluster) error

func (*Installer) ListAzureRegions

func (i *Installer) ListAzureRegions(creds *Credential) (interface{}, error)

func (*Installer) ListDigitalOceanRegions

func (i *Installer) ListDigitalOceanRegions(creds *Credential) (interface{}, error)

func (*Installer) SaveCluster

func (i *Installer) SaveCluster(c Cluster) error

func (*Installer) SaveCredentials

func (i *Installer) SaveCredentials(creds *Credential) error

func (*Installer) SendEvent

func (i *Installer) SendEvent(event *Event)

func (*Installer) Subscribe

func (i *Installer) Subscribe(eventChan chan *Event, lastEventID string) *Subscription

func (*Installer) Unsubscribe

func (i *Installer) Unsubscribe(sub *Subscription)

type InstanceIPs

type InstanceIPs struct {
	ClusterID string `ql:"index xCluster"`
	IP        string
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

type OAuthCredential

type OAuthCredential struct {
	ClientID     string     `json:"client_id"` // ClientID == Credential.ID
	AccessToken  string     `json:"access_token"`
	RefreshToken string     `json:"refresh_token"`
	ExpiresAt    *time.Time `json:"expires_at"`
	Scope        string     `json:"scope"`
	DeletedAt    *time.Time `json:"deleted_at,omitempty"`
}

type ProgressEvent

type ProgressEvent struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Percent     int    `json:"percent"`
}

type Prompt

type Prompt struct {
	ID        string     `json:"id"`
	Type      PromptType `json:"type,omitempty"`
	Message   string     `json:"message,omitempty"`
	Yes       bool       `json:"yes,omitempty"`
	Input     string     `json:"input,omitempty"`
	File      io.Reader  `json:"-" ql:"-"`
	FileSize  int        `json:"-" ql:"-"`
	Resolved  bool       `json:"resolved,omitempty"`
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
	// contains filtered or unexported fields
}

func (*Prompt) Resolve

func (prompt *Prompt) Resolve(res *Prompt) error

type PromptType

type PromptType string
var (
	PromptTypeYesNo          PromptType = "yes_no"
	PromptTypeChoice         PromptType = "choice"
	PromptTypeCredential     PromptType = "credential"
	PromptTypeInput          PromptType = "input"
	PromptTypeProtectedInput PromptType = "protected_input"
	PromptTypeFile           PromptType = "file"
)

type SSHCluster

type SSHCluster struct {
	ClusterID   string          `json:"cluster_id" ql:"index xCluster"`
	DeletedAt   *time.Time      `json:"deleted_at,omitempty"`
	SSHLogin    string          `json:"ssh_login"`
	Targets     []*TargetServer `json:"targets" ql:"-"`
	TargetsJSON string          `json:"-"`
	// contains filtered or unexported fields
}

func (*SSHCluster) Base

func (c *SSHCluster) Base() *BaseCluster

func (*SSHCluster) Delete

func (c *SSHCluster) Delete()

func (*SSHCluster) Run

func (c *SSHCluster) Run()

func (*SSHCluster) SetBase

func (c *SSHCluster) SetBase(base *BaseCluster)

func (*SSHCluster) SetCreds

func (c *SSHCluster) SetCreds(creds *Credential) error

func (*SSHCluster) SetDefaultsAndValidate

func (c *SSHCluster) SetDefaultsAndValidate() error

func (*SSHCluster) Type

func (c *SSHCluster) Type() string

type StackEventSort

type StackEventSort []cloudformation.StackEvent

func (StackEventSort) Len

func (e StackEventSort) Len() int

func (StackEventSort) Less

func (e StackEventSort) Less(i, j int) bool

func (StackEventSort) Swap

func (e StackEventSort) Swap(i, j int)

type Subscription

type Subscription struct {
	LastEventID string
	EventChan   chan *Event
	DoneChan    chan struct{}
	// contains filtered or unexported fields
}

func (*Subscription) SendEvents

func (sub *Subscription) SendEvents(i *Installer)

type TargetServer

type TargetServer struct {
	IP        string            `json:"ip"`
	Port      string            `json:"port"`
	User      string            `json:"user"`
	SSHConfig *ssh.ClientConfig `json:"-"`
	SSHClient *ssh.Client       `json:"-"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL