Documentation ¶
Index ¶
- Variables
- func GetGlobalConfigS3(input *GetGlobalConfigS3Input) (string, error)
- func NewAWSSession(region string, assumeRole string) *session.Session
- func Setup(dependencies *[]string) error
- func Wrap(input *WrapInput, bin string, arg ...string) error
- type ASGFilterFunc
- type BootstrapConfig
- type BootstrapManifest
- type BootstrapParameter
- type BootstrapParams
- type Bootstrapper
- type EnvInput
- type EnvironmentVars
- type GetGlobalConfigS3Input
- type GetKubeconfigCmd
- type GetKubeconfigS3Cmd
- type GitTemplateSource
- type KubectlCmd
- type LocalTemplateSource
- type NetworkRouteProvider
- type OpenConnect
- type OpenConnectEvent
- type OpenConnectHook
- type RefreshNodesCmd
- type S3TemplateSource
- type SecretConfig
- type SecretConfigList
- type SecretDirConfig
- type SecretFileConfig
- type SecretsManager
- func (m SecretsManager) Edit(secret SecretConfig) (bool, error)
- func (m SecretsManager) EncryptSecret(secret SecretConfig) error
- func (m SecretsManager) Pull(secret SecretConfig) error
- func (m SecretsManager) PullAll() error
- func (m SecretsManager) Push(secret SecretConfig) error
- func (m SecretsManager) PushAll() error
- func (m SecretsManager) Vault(secret SecretConfig) (*VaultCmd, error)
- func (m SecretsManager) View(secret SecretConfig) (localContent string, remoteContent string, err error)
- type SshuttleRouteProvider
- type TemplateSource
- type VaultAuth
- type VaultCmd
- func (vault *VaultCmd) ClosePortForward() error
- func (vault *VaultCmd) Decrypt(transitKeyName string, encrypted []byte) ([]byte, error)
- func (vault *VaultCmd) Encrypt(transitKeyName string, raw []byte) ([]byte, error)
- func (vault *VaultCmd) GetMap(vaultPath string) (map[string]interface{}, error)
- func (vault *VaultCmd) GetWrappingToken() (string, error)
- func (vault *VaultCmd) ListPath(vaultPath string) ([]string, error)
- func (vault *VaultCmd) PortForward() (string, error)
- func (vault *VaultCmd) Run(args []string) ([]byte, error)
- func (vault *VaultCmd) Write(vaultPath string, data map[string]interface{}) (*api.Secret, error)
- type WrapInput
Constants ¶
This section is empty.
Variables ¶
var ErrSecretFileConfigInvalidYaml = errors.New("Unable to parse secret as yaml or missing required root element `secrets`")
ErrSecretFileConfigInvalidYaml error if invalid yaml
Functions ¶
func GetGlobalConfigS3 ¶
func GetGlobalConfigS3(input *GetGlobalConfigS3Input) (string, error)
GetGlobalConfigS3 fetch global config from S3 and put it in home dir
func NewAWSSession ¶
NewAWSSession creates an AWS session with role assumed
Types ¶
type BootstrapConfig ¶
type BootstrapConfig struct { TemplateSource struct { Type string `default:"local"` Local struct { Directory string `default:"./bootstrap-templates"` } S3 struct { Bucket string `default:"truss-cli-global-config"` Region string `default:"us-east-2"` Prefix string `default:"bootstrap-templates"` Role string `default:"arn:aws:iam::127178877223:role/xacct/ops-admin"` } Git struct { CloneURL string `default:"git@github.com:get-bridge/truss-cli.git" yaml:"clone_url"` Directory string `default:"bootstrap-templates"` CheckoutRef string `yaml:"checkout_ref"` } } `yaml:"templateSource"` TrussDir string `default:"truss" yaml:"trussDir"` Template string `default:"default"` Params map[string]interface{} }
BootstrapConfig represetns a Bootstrap configuration
func LoadBootstrapConfig ¶
func LoadBootstrapConfig(name string) (*BootstrapConfig, error)
LoadBootstrapConfig loads a config from disk
func (BootstrapConfig) GetBootstrapper ¶
func (c BootstrapConfig) GetBootstrapper() (b *Bootstrapper, err error)
GetBootstrapper gets a Bootstrapper from a configuration
func (BootstrapConfig) GetTemplateSource ¶
func (c BootstrapConfig) GetTemplateSource() (t TemplateSource, err error)
GetTemplateSource gets a TemplateSource from a configuration
type BootstrapManifest ¶
type BootstrapManifest struct { Params []struct { Name string `yaml:"name"` Type string `yaml:"type"` Prompt string `yaml:"prompt"` Default interface{} `yaml:"default"` } `yaml:"params"` }
BootstrapManifest represents the manifest thingy
type BootstrapParameter ¶
type BootstrapParameter struct { Type string Value string PascalCase string CamelCase string KebabCase string SnakeCase string FlatCase string }
BootstrapParameter - struct to handle types and case conversions
func NewBootstrapParameter ¶
func NewBootstrapParameter(value string) *BootstrapParameter
NewBootstrapParameter - create a bootstrap parameter with the type string
func NewBootstrapParameterBool ¶
func NewBootstrapParameterBool(value bool) *BootstrapParameter
NewBootstrapParameterBool - create a bootstrap parameter with the type bool
func (*BootstrapParameter) String ¶
func (c *BootstrapParameter) String() string
type BootstrapParams ¶
type BootstrapParams map[string]*BootstrapParameter
BootstrapParams represents user-provided parameters for a template
func (*BootstrapParams) LoadFromConfig ¶
func (p *BootstrapParams) LoadFromConfig(c *BootstrapConfig) error
LoadFromConfig reads params from a given configuration
func (*BootstrapParams) LoadFromFlags ¶
func (p *BootstrapParams) LoadFromFlags(s map[string]string) error
LoadFromFlags reads params from a collection of flag values
func (BootstrapParams) Validate ¶
func (p BootstrapParams) Validate(m *BootstrapManifest) (errs []string, err error)
Validate validates the given parameters against a manifest
type Bootstrapper ¶
type Bootstrapper struct { TemplateSource TrussDir string Template string }
Bootstrapper bootstraps a deployment
func NewBootstrapper ¶
func NewBootstrapper(ts TemplateSource, trussDir, template string) *Bootstrapper
NewBootstrapper returns a new TemplateSource
func (Bootstrapper) Bootstrap ¶
func (b Bootstrapper) Bootstrap(params *BootstrapParams) error
Bootstrap does the thing!
func (Bootstrapper) GetTemplateManifest ¶
func (b Bootstrapper) GetTemplateManifest() *BootstrapManifest
GetTemplateManifest gets a template's manifest
type EnvironmentVars ¶
type EnvironmentVars struct {
Kubeconfig string
}
EnvironmentVars key/value pairs of environment variables that should be set in the shell
func Env ¶
func Env(input *EnvInput) (EnvironmentVars, error)
Env configures environment variables that should be set in the bash shell
func (*EnvironmentVars) BashFormat ¶
func (environmentVars *EnvironmentVars) BashFormat(env string) string
BashFormat formats environment variables for bash
type GetGlobalConfigS3Input ¶
type GetGlobalConfigS3Input struct { Bucket string Region string Key string Role string Dir string }
GetGlobalConfigS3Input input for GetGlobalConfigS3
type GetKubeconfigCmd ¶
type GetKubeconfigCmd interface {
Fetch() error
}
GetKubeconfigCmd command for managing kubeconfigs
func GetKubeconfigS3 ¶
func GetKubeconfigS3(awsRole string, bucket string, dest string, region string) GetKubeconfigCmd
GetKubeconfigS3 return command
type GetKubeconfigS3Cmd ¶
type GetKubeconfigS3Cmd struct {
// contains filtered or unexported fields
}
GetKubeconfigS3Cmd command for managing kubeconfigs
func (*GetKubeconfigS3Cmd) Fetch ¶
func (config *GetKubeconfigS3Cmd) Fetch() error
Fetch kubeconfigs
type GitTemplateSource ¶
type GitTemplateSource struct { TemplateSource CloneURL string `default:"git@github.com:get-bridge/truss-cli.git" yaml:"clone_url"` Directory string `default:"bootstrap-templates"` CheckoutRef string `yaml:"checkout_ref"` // contains filtered or unexported fields }
GitTemplateSource is a Local Filesystem Template Source
func NewGitTemplateSource ¶
func NewGitTemplateSource(cloneURL, directory, checkoutRef string) (*GitTemplateSource, error)
NewGitTemplateSource returns a new TemplateSource
type KubectlCmd ¶
type KubectlCmd struct {
// contains filtered or unexported fields
}
KubectlCmd wrapper for kubectl
func (*KubectlCmd) ClosePortForward ¶
func (kubectl *KubectlCmd) ClosePortForward() error
ClosePortForward sigterm kubectl port-forward
func (*KubectlCmd) PortForward ¶
func (kubectl *KubectlCmd) PortForward(port, listen, namespace, target string, timeoutSeconds int) error
PortForward kubectl port-forward
type LocalTemplateSource ¶
type LocalTemplateSource struct {
Directory string
}
LocalTemplateSource is a Local Filesystem Template Source
func NewLocalTemplateSource ¶
func NewLocalTemplateSource(directory string) *LocalTemplateSource
NewLocalTemplateSource returns a new TemplateSource
func (LocalTemplateSource) Cleanup ¶
func (s LocalTemplateSource) Cleanup()
Cleanup doesn't do anything
func (LocalTemplateSource) GetTemplateManifest ¶
func (s LocalTemplateSource) GetTemplateManifest(t string) *BootstrapManifest
GetTemplateManifest gets the template's manifest
func (LocalTemplateSource) ListTemplates ¶
func (s LocalTemplateSource) ListTemplates() ([]string, error)
ListTemplates returns a list of temlpates in the local directory
func (LocalTemplateSource) LocalDirectory ¶
func (s LocalTemplateSource) LocalDirectory(template string) (string, error)
LocalDirectory returns a local directory for the template
type NetworkRouteProvider ¶
type NetworkRouteProvider struct { Routes []string OpenConnect *OpenConnect }
NetworkRouteProvider provides routes by provisioning them directly with the OS
func (NetworkRouteProvider) Setup ¶
func (n NetworkRouteProvider) Setup() error
Setup creates the routes
func (NetworkRouteProvider) Teardown ¶
func (n NetworkRouteProvider) Teardown() error
Teardown destroys the routes
type OpenConnect ¶
type OpenConnect struct { User string Authgroup string Server string Env []string Script *string // contains filtered or unexported fields }
OpenConnect represents an OpenConnect Connection
func NewOpenConnect ¶
func NewOpenConnect(user, server, authGroup string) *OpenConnect
NewOpenConnect returns a default OpenConnect instance
func (*OpenConnect) AddHook ¶
func (c *OpenConnect) AddHook(k OpenConnectEvent, h OpenConnectHook)
AddHook adds an event hook
func (*OpenConnect) Start ¶
func (c *OpenConnect) Start() error
Start interactively starts the tunnel
type OpenConnectEvent ¶
type OpenConnectEvent int
OpenConnectEvent represents a connection event
const ( OpenConnectConnecting OpenConnectEvent = iota OpenConnectConnected OpenConnectEvent = iota OpenConnectDisconnected OpenConnectEvent = iota )
type OpenConnectHook ¶
type OpenConnectHook func() error
OpenConnectHook is a function that can be invoked when an event occurs
type RefreshNodesCmd ¶
type RefreshNodesCmd struct {
ASC autoscalingiface.AutoScalingAPI
}
RefreshNodesCmd is used to refresh Truss nodes
func NewRefreshNodesCmd ¶
func NewRefreshNodesCmd(region, arn string) *RefreshNodesCmd
NewRefreshNodesCmd instantiates a RefreshNodesCmd
func (RefreshNodesCmd) GetFilteredAutoscalingGroups ¶
func (c RefreshNodesCmd) GetFilteredAutoscalingGroups(ff ASGFilterFunc) ([]*autoscaling.Group, error)
GetFilteredAutoscalingGroups returns a filtered list of ASGs
func (RefreshNodesCmd) RefreshNodes ¶
func (c RefreshNodesCmd) RefreshNodes(g *autoscaling.Group) error
RefreshNodes triggers an Instance Refresh on the provided ASG
type S3TemplateSource ¶
type S3TemplateSource struct { Bucket string Folder string Region string Role string // contains filtered or unexported fields }
S3TemplateSource is an Amazon S3 Template Source
func NewS3TemplateSource ¶
func NewS3TemplateSource(bucket, folder, region, role string) *S3TemplateSource
NewS3TemplateSource returns a new TemplateSource
func (S3TemplateSource) GetTemplateManifest ¶
func (s S3TemplateSource) GetTemplateManifest(t string) *BootstrapManifest
GetTemplateManifest parses the template's manifest
func (S3TemplateSource) ListTemplates ¶
func (s S3TemplateSource) ListTemplates() ([]string, error)
ListTemplates returns a list of temlpates in the template bucket
func (*S3TemplateSource) LocalDirectory ¶
func (s *S3TemplateSource) LocalDirectory(template string) (string, error)
LocalDirectory returns a local cache of the S3 Template
type SecretConfig ¶
type SecretConfig interface { Name() string Kubeconfig() string VaultPath() string // contains filtered or unexported methods }
SecretConfig interface for secret config can be a file or directory or anything!
type SecretConfigList ¶
type SecretConfigList struct { Secrets []SecretConfig `yaml:"secrets"` TransitKeyName string `yaml:"transit-key-name"` }
SecretConfigList represents a list of named SecretConfigs
func SecretConfigListFromFile ¶
func SecretConfigListFromFile(path string) (*SecretConfigList, error)
SecretConfigListFromFile reads a config file
func (SecretConfigList) Secret ¶
func (l SecretConfigList) Secret(name, kubeconfig string) (SecretConfig, error)
Secret locates a secret by name and kubeconfig
func (SecretConfigList) SecretKubeconfigs ¶
func (l SecretConfigList) SecretKubeconfigs(name string) []string
SecretKubeconfigs returns a list of kubeconfigs defined for a given secret
func (SecretConfigList) SecretNames ¶
func (l SecretConfigList) SecretNames() []string
SecretNames returns a list of secret names provided in the list
type SecretDirConfig ¶
type SecretDirConfig struct {
// contains filtered or unexported fields
}
SecretDirConfig represents a desired Vault synchronization
func (SecretDirConfig) Kubeconfig ¶
func (s SecretDirConfig) Kubeconfig() string
Kubeconfig Kubeconfig
type SecretFileConfig ¶
type SecretFileConfig struct {
// contains filtered or unexported fields
}
SecretFileConfig represents a desired Vault synchronization
func (SecretFileConfig) Kubeconfig ¶
func (s SecretFileConfig) Kubeconfig() string
Kubeconfig Kubeconfig
func (SecretFileConfig) VaultPath ¶
func (s SecretFileConfig) VaultPath() string
VaultPath VaultPath
type SecretsManager ¶
type SecretsManager struct { *SecretConfigList VaultAuth VaultAuth Editor string }
SecretsManager syncrhonizes secrets between the filesystem and Vault
func NewSecretsManager ¶
func NewSecretsManager(secretsFile string, editor string, vaultAuth VaultAuth) (*SecretsManager, error)
NewSecretsManager creates a new SecretsManager
func (SecretsManager) Edit ¶
func (m SecretsManager) Edit(secret SecretConfig) (bool, error)
Edit edits an environments's secrets Returns true if $EDITOR wrote to the temp file
func (SecretsManager) EncryptSecret ¶
func (m SecretsManager) EncryptSecret(secret SecretConfig) error
EncryptSecret on disk with cypher text from vault
func (SecretsManager) Pull ¶
func (m SecretsManager) Pull(secret SecretConfig) error
Pull updates the file on disk with the vaules from Vault (destructive)
func (SecretsManager) PullAll ¶
func (m SecretsManager) PullAll() error
PullAll pulls all environments
func (SecretsManager) Push ¶
func (m SecretsManager) Push(secret SecretConfig) error
Push pushes secrets to Vaut
func (SecretsManager) PushAll ¶
func (m SecretsManager) PushAll() error
PushAll pushes all secrets for all environments
func (SecretsManager) Vault ¶
func (m SecretsManager) Vault(secret SecretConfig) (*VaultCmd, error)
Vault creates a proxied Vault client
func (SecretsManager) View ¶
func (m SecretsManager) View(secret SecretConfig) (localContent string, remoteContent string, err error)
View Secret
type SshuttleRouteProvider ¶
SshuttleRouteProvider provides routes by tunneling with sshuttle
func (SshuttleRouteProvider) Setup ¶
func (n SshuttleRouteProvider) Setup() error
Setup creates the routes
func (SshuttleRouteProvider) Teardown ¶
func (n SshuttleRouteProvider) Teardown() error
Teardown destroys the routes
type TemplateSource ¶
type TemplateSource interface { ListTemplates() ([]string, error) LocalDirectory(template string) (string, error) GetTemplateManifest(t string) *BootstrapManifest Cleanup() }
TemplateSource sources templates
type VaultAuth ¶
type VaultAuth interface { Login(data interface{}, port string) (token string, err error) LoadCreds() (data interface{}, err error) }
VaultAuth vault auth
func VaultAuthAWS ¶
VaultAuthAWS vault auth
type VaultCmd ¶
type VaultCmd struct {
// contains filtered or unexported fields
}
VaultCmd wrapper implementation for hashicorp vault
func VaultWithToken ¶
VaultWithToken wrapper for hashicorp vault with token for auth
func (*VaultCmd) ClosePortForward ¶
ClosePortForward closes the port forward, if any
func (*VaultCmd) GetWrappingToken ¶
GetWrappingToken gets a Vault wrapping token Caller is responsible for closing port
func (*VaultCmd) PortForward ¶
PortForward instantiates a port-forward for Vault
Source Files ¶
- aws.go
- bootstrapConfig.go
- bootstrapParameter.go
- bootstrapParams.go
- bootstrapTemplateSourceGit.go
- bootstrapTemplateSourceLocal.go
- bootstrapTemplateSourceS3.go
- bootstrapper.go
- encryptAndSaveToDisk.go
- env.go
- getGlobalConfigS3.go
- getKubeconfig.go
- getKubeconfigS3.go
- kubectl.go
- openconnect.go
- refreshNodes.go
- routeProviderNetwork.go
- routeProviderSshuttle.go
- secretConfig.go
- secretConfigList.go
- secretDirConfig.go
- secretFileConfig.go
- secretsManager.go
- setup.go
- vault.go
- vault_auth.go
- vault_auth_aws.go
- wrap.go