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 ¶ added in v0.0.8
func GetGlobalConfigS3(input *GetGlobalConfigS3Input) (string, error)
GetGlobalConfigS3 fetch global config from S3 and put it in home dir
func NewAWSSession ¶ added in v0.0.9
NewAWSSession creates an AWS session with role assumed
Types ¶
type ASGFilterFunc ¶ added in v0.1.0
type ASGFilterFunc func(*autoscaling.Group) bool
ASGFilterFunc filters ASGs
type BootstrapConfig ¶ added in v0.1.0
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:instructure-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 ¶ added in v0.1.0
func LoadBootstrapConfig(name string) (*BootstrapConfig, error)
LoadBootstrapConfig loads a config from disk
func (BootstrapConfig) GetBootstrapper ¶ added in v0.1.0
func (c BootstrapConfig) GetBootstrapper() (b *Bootstrapper, err error)
GetBootstrapper gets a Bootstrapper from a configuration
func (BootstrapConfig) GetTemplateSource ¶ added in v0.1.0
func (c BootstrapConfig) GetTemplateSource() (t TemplateSource, err error)
GetTemplateSource gets a TemplateSource from a configuration
type BootstrapManifest ¶ added in v0.1.0
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 ¶ added in v0.1.1
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 ¶ added in v0.1.1
func NewBootstrapParameter(value string) *BootstrapParameter
NewBootstrapParameter - create a bootstrap parameter with the type string
func NewBootstrapParameterBool ¶ added in v0.1.1
func NewBootstrapParameterBool(value bool) *BootstrapParameter
NewBootstrapParameterBool - create a bootstrap parameter with the type bool
func (*BootstrapParameter) String ¶ added in v0.1.1
func (c *BootstrapParameter) String() string
type BootstrapParams ¶ added in v0.1.0
type BootstrapParams map[string]*BootstrapParameter
BootstrapParams represents user-provided parameters for a template
func (*BootstrapParams) LoadFromConfig ¶ added in v0.1.0
func (p *BootstrapParams) LoadFromConfig(c *BootstrapConfig) error
LoadFromConfig reads params from a given configuration
func (*BootstrapParams) LoadFromFlags ¶ added in v0.1.0
func (p *BootstrapParams) LoadFromFlags(s map[string]string) error
LoadFromFlags reads params from a collection of flag values
func (BootstrapParams) Validate ¶ added in v0.1.0
func (p BootstrapParams) Validate(m *BootstrapManifest) (errs []string, err error)
Validate validates the given parameters against a manifest
type Bootstrapper ¶ added in v0.1.0
type Bootstrapper struct { TemplateSource TrussDir string Template string }
Bootstrapper bootstraps a deployment
func NewBootstrapper ¶ added in v0.1.0
func NewBootstrapper(ts TemplateSource, trussDir, template string) *Bootstrapper
NewBootstrapper returns a new TemplateSource
func (Bootstrapper) Bootstrap ¶ added in v0.1.0
func (b Bootstrapper) Bootstrap(params *BootstrapParams) error
Bootstrap does the thing!
func (Bootstrapper) GetTemplateManifest ¶ added in v0.1.0
func (b Bootstrapper) GetTemplateManifest() *BootstrapManifest
GetTemplateManifest gets a template's manifest
type EnvironmentVars ¶ added in v0.0.8
type EnvironmentVars struct {
Kubeconfig string
}
EnvironmentVars key/value pairs of environment variables that should be set in the shell
func Env ¶ added in v0.0.8
func Env(input *EnvInput) (EnvironmentVars, error)
Env configures environment variables that should be set in the bash shell
func (*EnvironmentVars) BashFormat ¶ added in v0.0.8
func (environmentVars *EnvironmentVars) BashFormat(env string) string
BashFormat formats environment variables for bash
type GetGlobalConfigS3Input ¶ added in v0.0.8
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 ¶ added in v0.1.0
type GitTemplateSource struct { TemplateSource CloneURL string `default:"git@github.com:instructure-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 ¶ added in v0.1.0
func NewGitTemplateSource(cloneURL, directory, checkoutRef string) (*GitTemplateSource, error)
NewGitTemplateSource returns a new TemplateSource
func (GitTemplateSource) Cleanup ¶ added in v0.1.0
func (s GitTemplateSource) Cleanup()
Cleanup cleans up
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 ¶ added in v0.1.0
type LocalTemplateSource struct {
Directory string
}
LocalTemplateSource is a Local Filesystem Template Source
func NewLocalTemplateSource ¶ added in v0.1.0
func NewLocalTemplateSource(directory string) *LocalTemplateSource
NewLocalTemplateSource returns a new TemplateSource
func (LocalTemplateSource) Cleanup ¶ added in v0.1.0
func (s LocalTemplateSource) Cleanup()
Cleanup doesn't do anything
func (LocalTemplateSource) GetTemplateManifest ¶ added in v0.1.0
func (s LocalTemplateSource) GetTemplateManifest(t string) *BootstrapManifest
GetTemplateManifest gets the template's manifest
func (LocalTemplateSource) ListTemplates ¶ added in v0.1.0
func (s LocalTemplateSource) ListTemplates() ([]string, error)
ListTemplates returns a list of temlpates in the local directory
func (LocalTemplateSource) LocalDirectory ¶ added in v0.1.0
func (s LocalTemplateSource) LocalDirectory(template string) (string, error)
LocalDirectory returns a local directory for the template
type NetworkRouteProvider ¶ added in v0.0.10
type NetworkRouteProvider struct { Routes []string OpenConnect *OpenConnect }
NetworkRouteProvider provides routes by provisioning them directly with the OS
func (NetworkRouteProvider) Setup ¶ added in v0.0.10
func (n NetworkRouteProvider) Setup() error
Setup creates the routes
func (NetworkRouteProvider) Teardown ¶ added in v0.0.10
func (n NetworkRouteProvider) Teardown() error
Teardown destroys the routes
type OpenConnect ¶ added in v0.0.10
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 ¶ added in v0.0.10
func NewOpenConnect(user, server, authGroup string) *OpenConnect
NewOpenConnect returns a default OpenConnect instance
func (*OpenConnect) AddHook ¶ added in v0.0.10
func (c *OpenConnect) AddHook(k OpenConnectEvent, h OpenConnectHook)
AddHook adds an event hook
func (*OpenConnect) Start ¶ added in v0.0.10
func (c *OpenConnect) Start() error
Start interactively starts the tunnel
type OpenConnectEvent ¶ added in v0.0.10
type OpenConnectEvent int
OpenConnectEvent represents a connection event
const ( OpenConnectConnecting OpenConnectEvent = iota OpenConnectConnected OpenConnectEvent = iota OpenConnectDisconnected OpenConnectEvent = iota )
type OpenConnectHook ¶ added in v0.0.10
type OpenConnectHook func() error
OpenConnectHook is a function that can be invoked when an event occurs
type RefreshNodesCmd ¶ added in v0.1.0
type RefreshNodesCmd struct {
ASC autoscalingiface.AutoScalingAPI
}
RefreshNodesCmd is used to refresh Truss nodes
func NewRefreshNodesCmd ¶ added in v0.1.0
func NewRefreshNodesCmd(role, arn string) *RefreshNodesCmd
NewRefreshNodesCmd instantiates a RefreshNodesCmd
func (RefreshNodesCmd) GetFilteredAutoscalingGroups ¶ added in v0.1.0
func (c RefreshNodesCmd) GetFilteredAutoscalingGroups(ff ASGFilterFunc) ([]*autoscaling.Group, error)
GetFilteredAutoscalingGroups returns a filtered list of ASGs
func (RefreshNodesCmd) RefreshNodes ¶ added in v0.1.0
func (c RefreshNodesCmd) RefreshNodes(g *autoscaling.Group) error
RefreshNodes triggers an Instance Refresh on the provided ASG
type S3TemplateSource ¶ added in v0.1.0
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 ¶ added in v0.1.0
func NewS3TemplateSource(bucket, folder, region, role string) *S3TemplateSource
NewS3TemplateSource returns a new TemplateSource
func (*S3TemplateSource) Cleanup ¶ added in v0.1.0
func (s *S3TemplateSource) Cleanup()
Cleanup removes tmpDirs
func (S3TemplateSource) GetTemplateManifest ¶ added in v0.1.0
func (s S3TemplateSource) GetTemplateManifest(t string) *BootstrapManifest
GetTemplateManifest parses the template's manifest
func (S3TemplateSource) ListTemplates ¶ added in v0.1.0
func (s S3TemplateSource) ListTemplates() ([]string, error)
ListTemplates returns a list of temlpates in the template bucket
func (*S3TemplateSource) LocalDirectory ¶ added in v0.1.0
func (s *S3TemplateSource) LocalDirectory(template string) (string, error)
LocalDirectory returns a local cache of the S3 Template
type SecretConfig ¶ added in v0.0.4
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 ¶ added in v0.0.4
type SecretConfigList struct { Secrets []SecretConfig `yaml:"secrets"` TransitKeyName string `yaml:"transit-key-name"` }
SecretConfigList represents a list of named SecretConfigs
func SecretConfigListFromFile ¶ added in v0.0.4
func SecretConfigListFromFile(path string) (*SecretConfigList, error)
SecretConfigListFromFile reads a config file
func (SecretConfigList) Secret ¶ added in v0.0.5
func (l SecretConfigList) Secret(name, kubeconfig string) (SecretConfig, error)
Secret locates a secret by name and kubeconfig
func (SecretConfigList) SecretKubeconfigs ¶ added in v0.0.5
func (l SecretConfigList) SecretKubeconfigs(name string) []string
SecretKubeconfigs returns a list of kubeconfigs defined for a given secret
func (SecretConfigList) SecretNames ¶ added in v0.0.5
func (l SecretConfigList) SecretNames() []string
SecretNames returns a list of secret names provided in the list
type SecretDirConfig ¶ added in v0.1.0
type SecretDirConfig struct {
// contains filtered or unexported fields
}
SecretDirConfig represents a desired Vault synchronization
func (SecretDirConfig) Kubeconfig ¶ added in v0.1.0
func (s SecretDirConfig) Kubeconfig() string
Kubeconfig Kubeconfig
func (SecretDirConfig) VaultPath ¶ added in v0.1.0
func (s SecretDirConfig) VaultPath() string
VaultPath VaultPath
type SecretFileConfig ¶ added in v0.1.0
type SecretFileConfig struct {
// contains filtered or unexported fields
}
SecretFileConfig represents a desired Vault synchronization
func (SecretFileConfig) Kubeconfig ¶ added in v0.1.0
func (s SecretFileConfig) Kubeconfig() string
Kubeconfig Kubeconfig
func (SecretFileConfig) VaultPath ¶ added in v0.1.0
func (s SecretFileConfig) VaultPath() string
VaultPath VaultPath
type SecretsManager ¶ added in v0.0.4
type SecretsManager struct { *SecretConfigList VaultAuth VaultAuth Editor string }
SecretsManager syncrhonizes secrets between the filesystem and Vault
func NewSecretsManager ¶ added in v0.0.4
func NewSecretsManager(secretsFile string, editor string, vaultAuth VaultAuth) (*SecretsManager, error)
NewSecretsManager creates a new SecretsManager
func (SecretsManager) Edit ¶ added in v0.0.4
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 ¶ added in v0.1.0
func (m SecretsManager) EncryptSecret(secret SecretConfig) error
EncryptSecret on disk with cypher text from vault
func (SecretsManager) Pull ¶ added in v0.0.4
func (m SecretsManager) Pull(secret SecretConfig) error
Pull updates the file on disk with the vaules from Vault (destructive)
func (SecretsManager) PullAll ¶ added in v0.0.4
func (m SecretsManager) PullAll() error
PullAll pulls all environments
func (SecretsManager) Push ¶ added in v0.0.4
func (m SecretsManager) Push(secret SecretConfig) error
Push pushes secrets to Vaut
func (SecretsManager) PushAll ¶ added in v0.0.4
func (m SecretsManager) PushAll() error
PushAll pushes all secrets for all environments
func (SecretsManager) Vault ¶ added in v0.0.4
func (m SecretsManager) Vault(secret SecretConfig) (*VaultCmd, error)
Vault creates a proxied Vault client
func (SecretsManager) View ¶ added in v0.1.0
func (m SecretsManager) View(secret SecretConfig) (localContent string, remoteContent string, err error)
View Secret
type SshuttleRouteProvider ¶ added in v0.0.10
SshuttleRouteProvider provides routes by tunneling with sshuttle
func (SshuttleRouteProvider) Setup ¶ added in v0.0.10
func (n SshuttleRouteProvider) Setup() error
Setup creates the routes
func (SshuttleRouteProvider) Teardown ¶ added in v0.0.10
func (n SshuttleRouteProvider) Teardown() error
Teardown destroys the routes
type TemplateSource ¶ added in v0.1.0
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 ¶ added in v0.1.0
VaultWithToken wrapper for hashicorp vault with token for auth
func (*VaultCmd) ClosePortForward ¶ added in v0.0.4
ClosePortForward closes the port forward, if any
func (*VaultCmd) GetWrappingToken ¶ added in v0.1.0
GetWrappingToken gets a Vault wrapping token Caller is responsible for closing port
func (*VaultCmd) PortForward ¶ added in v0.0.4
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