Documentation ¶
Index ¶
- Constants
- Variables
- func AskForValue(parameter string) (value string)
- func DefaultSession() (awssession *session.Session, err error)
- func FetchFileS3(s3Meta S3Meta, filePath string) (err error)
- func GitContent(repo string, path string) (content []byte, err error)
- func PingEndpoint(address string) (err error)
- func RetryUntil(thing func() (err error), timeoutMinutes int) (elapsed time.Duration, err error)
- func SSHAgent() ssh.AuthMethod
- func SplitRepoPath(uri string) (repo, path string)
- func StringInSlice(a string, list []string) bool
- type Account
- type OnpremConfig
- type OnpremDetails
- type OpsServer
- func (s *OpsServer) DeleteStack(accountNumber string, stackName string) (err error)
- func (s *OpsServer) GetDetails(accountNum string, stackName string) (deets OnpremDetails, err error)
- func (s *OpsServer) GetInstances() (instances []OnpremDetails, err error)
- func (s *OpsServer) GetStack(accountNumber string, stackName string) (stack *Stack, err error)
- func (s *OpsServer) InstanceCaHandler(c *gin.Context)
- func (s *OpsServer) InstanceDeleteHandler(c *gin.Context)
- func (s *OpsServer) InstancesHandler(c *gin.Context)
- func (s *OpsServer) Run() (err error)
- func (s *OpsServer) Serve(urlPrefix string, efs embed.FS) gin.HandlerFunc
- func (s *OpsServer) SingleInstanceHandler(c *gin.Context)
- type S3Meta
- type SimpleCFTemplate
- type SshProgClient
- type Stack
- func (s *Stack) Create(stageOnly bool) (err error)
- func (s *Stack) CreateCFStackInput() (input cloudformation.CreateStackInput, err error)
- func (s *Stack) CreateConfig() (content string, err error)
- func (s *Stack) Created() (created *time.Time, err error)
- func (s *Stack) Delete() (err error)
- func (s *Stack) Destroy() (err error)
- func (s *Stack) Exists() (exists bool)
- func (s *Stack) Init() (id string, err error)
- func (s *Stack) KotsInstall(sshClient *SshProgClient) (err error)
- func (s *Stack) ListStacks() (stacks []*cloudformation.Stack, err error)
- func (s *Stack) LookupAmiID() (id string, err error)
- func (s *Stack) LookupNetwork() (vpcID string, subnetID string, err error)
- func (s *Stack) LookupZoneID() (id string, err error)
- func (s *Stack) Outputs() (outputs []*cloudformation.Output, err error)
- func (s *Stack) Params() (parameters []*cloudformation.Parameter, err error)
- func (s *Stack) PollEndpoint(address string) (err error)
- func (s *Stack) PollKotsadm(sshClient *SshProgClient) (err error)
- func (s *Stack) PollKotsadmConsole(address string) (err error)
- func (s *Stack) PrintOutputs(outputs []*cloudformation.Output)
- func (s *Stack) StageConfig(sshClient *SshProgClient) (err error)
- func (s *Stack) StageLicense(sshClient *SshProgClient) (err error)
- func (s *Stack) Status() (status string, err error)
- func (s *Stack) TrustCA(host string) (err error)
- type StackConfig
Constants ¶
const ACCOUNT_ENV_VAR = "AWS_ACCOUNT_CREDENTIALS"
const AWS_ID_ENV_VAR = "AWS_ACCESS_KEY_ID"
AWS_ID_ENV_VAR Default AWS SDK env var for AWS_ACCESS_KEY_ID
const AWS_REGION_ENV_VAR = "AWS_REGION"
AWS_REGION_ENV_VAR Default AWS SDK env var for AWS_REGION
const AWS_SECRET_ENV_VAR = "AWS_SECRET_ACCESS_KEY"
AWS_SECRET_ENV_VAR Default AWS SDK env var for AWS_SECRET_ACCESS_KEY
const BETA_TEMPLATE_URL = "https://orion-ptt-system-beta.s3.amazonaws.com/orion-ptt-system.yaml"
BETA_TEMPLATE_URL S3 URL for CloudFormation Template
const CONFIG_FILE_TEMPLATE = `` /* 299-byte string literal not displayed */
CONFIG_FILE_TEMPLATE Blank default config file template for the 'config' command.
const DEFAULT_CONFIG_FILE = ".orion-ptt-system.json"
DEFAULT_CONFIG_FILE Default config file name.
const DEFAULT_INSTANCE_NAME = "orion-ptt-system"
DEFAULT_INSTANCE_NAME Default name for EC2 instance
const DEFAULT_INSTANCE_TYPE = "m5.2xlarge"
DEFAULT_INSTANCE_TYPE Default instance type
const DEFAULT_NETWORK_CONFIG_FILE = ".orion-ptt-system-network.json"
const DEFAULT_TEMPLATE_FILE = ".orion-ptt-system.tmpl"
const DEFAULT_TEMPLATE_URL = "https://orion-ptt-system.s3.amazonaws.com/orion-ptt-system.yaml"
DEFAULT_TEMPLATE_URL S3 URL for CloudFormation Template
const DEFAULT_VOLUME_SIZE = 50
DEFAULT_VOLUME_SIZE Default EBS Volume size in Gigs.
const ERR_SSH_GENERAL = "SSH error. Is your ssh-agent running? Keys loaded? Can't bootstrap Orion PTT System without it."
const ERR_TO_MANY_STACKS = "Multiple stacks of supplied name found"
ERR_TO_MANY_STACKS Error thrown when more than one stack of a given name is found. Should be impossible.
Variables ¶
var TESTING bool
Functions ¶
func AskForValue ¶
AskForValue Asks the user for any value not found in the config file.
func DefaultSession ¶
DefaultSession creates a default AWS session from local config path.
func FetchFileS3 ¶
FetchFileS3 fetches the config template from an s3 url.
func PingEndpoint ¶
func RetryUntil ¶
RetryUntil takes a function, and calls it every 20 seconds until it succeeds. Useful for polling endpoints in k8s that will eventually start working. Returns an error if the provided timeoutMinutes elapses. Otherwise returns the elapsed duration from start to finish.
func SSHAgent ¶
func SSHAgent() ssh.AuthMethod
SSHAgent is a programmatic client that talks to the ssh agent.
func SplitRepoPath ¶
func StringInSlice ¶
StringInSlice returns true if the given string is in the given slice
Types ¶
type OnpremConfig ¶
type OnpremDetails ¶
type OnpremDetails struct { Account string `json:"account" binding:"required"` Kubernetes string `json:"kubernetes" binding:"required"` Kotsadm string `json:"kotsadm" binding:"required"` CFStatus string `json:"cfstatus" binding:"required"` Name string `json:"name" binding:"required"` Address string `json:"address" binding:"required"` Datastore string `json:"datastore" binding:"required"` EventStream string `json:"eventstream" binding:"required"` Media string `json:"media" binding:"required"` Login string `json:"login" binding:"required"` Api string `json:"api" binding:"required"` CDN string `json:"cdn" binding:"required"` CA string `json:"ca" binding:"required"` Created string `json:"created" binding:"required"` Uptime string `json:"uptime" binding:"required"` }
type OpsServer ¶
func (*OpsServer) DeleteStack ¶
func (*OpsServer) GetDetails ¶
func (s *OpsServer) GetDetails(accountNum string, stackName string) (deets OnpremDetails, err error)
func (*OpsServer) GetInstances ¶
func (s *OpsServer) GetInstances() (instances []OnpremDetails, err error)
func (*OpsServer) GetStack ¶
GetStack retrieves a configured stack object for a given account and name based on credentials we have available.
func (*OpsServer) InstanceCaHandler ¶
InstanceCaHandler fetches the CA cert for a specific instance and sends it back to the client.
func (*OpsServer) InstanceDeleteHandler ¶
InstanceDeleteHandler deletes a specific instance
func (*OpsServer) InstancesHandler ¶
InstancesHandler returns json with all instances, though the instances themselves will only have account numbers and names. Details need to be fetched later. This is done to speed response time on the webpage.
func (*OpsServer) SingleInstanceHandler ¶
SingleInstanceHandler returns details for a particular instance.
type S3Meta ¶
S3Meta a struct for holding metadata for S3 Objects. There's probably already a struct that holds this, but this is all I need.
type SimpleCFTemplate ¶
type SimpleCFTemplate struct {
Description string `yaml:"Description"`
}
type SshProgClient ¶
type SshProgClient struct { Host string Port int Config *ssh.ClientConfig }
SshProgClient is an ssh client designed to do remote commands or RPC's
func NewSshProgClient ¶
func NewSshProgClient(host string, port int, config *ssh.ClientConfig) (client *SshProgClient)
NewSshProgClient creates a client for the given host, port, and config.
func SshClient ¶
func SshClient(hostname string, port int, username string) (client *SshProgClient, err error)
SshClient generates an SSH client for talking to the provisioning server
func (*SshProgClient) RpcCall ¶
func (c *SshProgClient) RpcCall(input []byte, stdout, stderr io.Writer) (err error)
RpcCall flings bytes at a remote server over SSH to STDIN, and receives whatever that server decides to send back on STDOUT and STDERR. What you send it, and what you do with the reply is between you and the server.
type Stack ¶
type Stack struct { Config *StackConfig AwsSession *session.Session AutoRollback bool }
Stack Programmatic representation of an Orion PTT System CloudFormation stack.
func NewStack ¶
func NewStack(config *StackConfig, awsSession *session.Session, autorollback bool) (stack *Stack, err error)
NewStack Creates a new programmatic representation of a Stack. Creates the object/interface. Doesn't actually create it in AWS until you call Init().
func (*Stack) Create ¶
Create Instantiates an instance of the Orion PTT System in AWS via CloudFormation
func (*Stack) CreateCFStackInput ¶
func (s *Stack) CreateCFStackInput() (input cloudformation.CreateStackInput, err error)
func (*Stack) CreateConfig ¶
CreateConfig Creates an orion-ptt-system kots config file from a local template. The template itself is not distributed with this package to avoid leaking sensitive information. To get one, you'll have to purchase an Orion PTT System license.
func (*Stack) KotsInstall ¶
func (s *Stack) KotsInstall(sshClient *SshProgClient) (err error)
func (*Stack) ListStacks ¶
func (s *Stack) ListStacks() (stacks []*cloudformation.Stack, err error)
ListStacks Queries the CF Yaml, and AWS, returning a list of stacks with a description that matches the description in the yaml template.
func (*Stack) LookupAmiID ¶
func (*Stack) LookupNetwork ¶
LookupNetwork looks up VPC and subnetID based on allowable subnets supplied by config file. Returns first match. Basically a crude means of detecting which VPC we're running in.
func (*Stack) LookupZoneID ¶
func (*Stack) Outputs ¶
func (s *Stack) Outputs() (outputs []*cloudformation.Output, err error)
Outputs Fetches stack outputs from AWS
func (*Stack) Params ¶
func (s *Stack) Params() (parameters []*cloudformation.Parameter, err error)
Params Fetches stack parameters from AWS.
func (*Stack) PollEndpoint ¶
func (*Stack) PollKotsadm ¶
func (s *Stack) PollKotsadm(sshClient *SshProgClient) (err error)
func (*Stack) PollKotsadmConsole ¶
func (*Stack) PrintOutputs ¶
func (s *Stack) PrintOutputs(outputs []*cloudformation.Output)
func (*Stack) StageConfig ¶
func (s *Stack) StageConfig(sshClient *SshProgClient) (err error)
func (*Stack) StageLicense ¶
func (s *Stack) StageLicense(sshClient *SshProgClient) (err error)
type StackConfig ¶
type StackConfig struct { StackName string `json:"stack_name"` KeyName string `json:"key_name"` DNSDomain string `json:"dns_domain"` InstanceType string `json:"instance_type"` Username string `json:"user_name"` LicenseFile string `json:"license_file"` ConfigTemplate string `json:"config_template"` KotsadmPassword string `json:"kotsadm_password"` AMIName string `json:"ami_name"` Beta bool SubnetIDs []string `json:"subnet_ids"` }
StackConfig Config information for an Orion PTT System CloudFormation stack.
func LoadConfig ¶
func LoadConfig(configPath string) (config *StackConfig, err error)
LoadConfig Loads a config file from the filesystem.
func (*StackConfig) AskForMissingParams ¶
func (c *StackConfig) AskForMissingParams(keyNeeded bool) (err error)
AskForMissingParams Examines the config object and calls AskForValue() on any misisng value.