Documentation
¶
Index ¶
- type Cluster
- type ClusterSpec
- type Config
- func (c *Config) DeleteCluster(name string) error
- func (c *Config) DeleteContext(name string) error
- func (c *Config) DeleteUser(name string) error
- func (cfg *Config) GetClientFromContext(secretsvc secretservice.SecretService, ...) (*api.Client, error)
- func (c *Config) GetClusterByName(name string) *Cluster
- func (c *Config) GetContextByName(name string) *Context
- func (cfg *Config) GetDefaultClient(namespace, url, token, cert, key, cacert string) (*api.Client, error)
- func (cfg *Config) GetServiceFromContext(ctx *Context, configfile, namespace string) (secretservice.SecretService, error)
- func (cfg *Config) GetSession(secretsvc secretservice.SecretService, configfile, contextName string, ...) (*Session, error)
- func (c *Config) GetUserByName(name string) *User
- func (c *Config) SaveConfig(filename string) error
- func (c *Config) SetAppRoleUser(name string, roleID string, secretID string) (*User, error)
- func (c *Config) SetCertUser(name string, clientCert string, clientCertData string, clientKey string, ...) (*User, error)
- func (c *Config) SetCluster(name string, certAuth string, certAuthData string, insecureSkipTLSVerify bool, ...) (*Cluster, error)
- func (c *Config) SetContext(name string, cluster string, namespace string, session *Session, user string) (*Context, error)
- func (c *Config) SetSession(token string, duration *int64, renewable *bool, expireSkewFactor int64) *Session
- func (c *Config) SetUserPassUser(name string, username string, password string) (*User, error)
- func (cfg *Config) StopSession(configfile, contextName string) error
- func (c *Config) String() string
- type Context
- type ContextSpec
- type Session
- type User
- type UserSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { Name string `mapstructure:"name" json:"name" yaml:"name"` ClusterSpec `mapstructure:"cluster" json:"cluster" yaml:"cluster"` }
Cluster is a cluster definition with a name
type ClusterSpec ¶
type ClusterSpec struct { CertAuth string `mapstructure:"certificate-authority" json:"certificate-authority" yaml:"certificate-authority"` CertAuthData string `` /* 139-byte string literal not displayed */ InsecureSkipTLSVerify bool `` /* 133-byte string literal not displayed */ Server string `mapstructure:"server" json:"server" yaml:"server"` }
type Config ¶
type Config struct { APIVersion string `mapstructure:"apiVersion" json:"apiVersion" yaml:"apiVersion"` Kind string `mapstructure:"kind" json:"kind" yaml:"kind"` Contexts []*Context `mapstructure:"contexts" json:"contexts" yaml:"contexts"` Clusters []*Cluster `mapstructure:"clusters" json:"clusters" yaml:"clusters"` CurrentContext string `mapstructure:"current-context" json:"current-context" yaml:"current-context"` Users []*User `mapstructure:"users" json:"users" yaml:"users"` }
Config defines config options
func (*Config) DeleteCluster ¶
DeleteCluster will delete the named cluster
func (*Config) DeleteContext ¶
DeleteContext will delete the named cluster
func (*Config) DeleteUser ¶
DeleteUser will delete the named cluster
func (*Config) GetClientFromContext ¶
func (cfg *Config) GetClientFromContext(secretsvc secretservice.SecretService, configfile, contextName, namespace string) (*api.Client, error)
GetClientFromContext gets user/cluster/namespace info from context
func (*Config) GetClusterByName ¶
GetClusterByName returns a named cluster
func (*Config) GetContextByName ¶
GetContextByName returns a named cluster
func (*Config) GetDefaultClient ¶
func (cfg *Config) GetDefaultClient(namespace, url, token, cert, key, cacert string) (*api.Client, error)
GetDefaultClient attempt to login ot vault
func (*Config) GetServiceFromContext ¶
func (cfg *Config) GetServiceFromContext(ctx *Context, configfile, namespace string) (secretservice.SecretService, error)
GetServiceFromContext gets user/cluster/namespace info from context
func (*Config) GetSession ¶
func (cfg *Config) GetSession(secretsvc secretservice.SecretService, configfile, contextName string, forceNewSession bool) (*Session, error)
GetSession will return an existing session or create a new one and save the config
func (*Config) GetUserByName ¶
GetUserByName returns a named cluster
func (*Config) SaveConfig ¶
SaveConfig writes yaml to a file
func (*Config) SetAppRoleUser ¶
SetAppRoleUser will create a new user or update an existing user
func (*Config) SetCertUser ¶
func (c *Config) SetCertUser(name string, clientCert string, clientCertData string, clientKey string, clientKeyData string, ) (*User, error)
SetCertUser will create a new user or update an existing user
func (*Config) SetCluster ¶
func (c *Config) SetCluster(name string, certAuth string, certAuthData string, insecureSkipTLSVerify bool, server string, ) (*Cluster, error)
SetCluster returns a new Cluster
func (*Config) SetContext ¶
func (c *Config) SetContext(name string, cluster string, namespace string, session *Session, user string) (*Context, error)
SetContext will create a new context or update an existing context
func (*Config) SetSession ¶
func (c *Config) SetSession(token string, duration *int64, renewable *bool, expireSkewFactor int64) *Session
SetSession Builds a session object expireSkewFactor in seconds
func (*Config) SetUserPassUser ¶
SetUserPassUser will create a new user or update an existing user
func (*Config) StopSession ¶
StopSession will return an existing session or create a new one and save the config
type Context ¶
type Context struct { Name string `mapstructure:"name" json:"name" yaml:"name"` ContextSpec `mapstructure:"context" json:"context" yaml:"context"` }
Context a context with a name +k8s:deepcopy-gen=true
type ContextSpec ¶
type ContextSpec struct { Cluster string `mapstructure:"cluster" json:"cluster" yaml:"cluster"` InventoryPath string `mapstructure:"inventoryPath" json:"inventoryPath" yaml:"inventoryPath"` Namespace string `mapstructure:"namespace" json:"namespace" yaml:"namespace"` Session `mapstructure:"session,omitempty" json:"session,omitempty" yaml:"session,omitempty"` User string `mapstructure:"user" json:"user" yaml:"user"` }
ContextSpec consist of a user paired with a cluster, namespace
type Session ¶
type Session struct { Token string `mapstructure:"token,omitempty" json:"token,omitempty" yaml:"token,omitempty"` LeaseDuration *int64 `mapstructure:"lease-duration,omitempty" json:"lease-duration,omitempty" yaml:"lease-duration,omitempty"` Expires *int64 `mapstructure:"expires,omitempty" json:"expires,omitempty" yaml:"expires,omitempty"` Renewable *bool `mapstructure:"renewable,omitempty" json:"renewable,omitempty" yaml:"renewable,omitempty"` }
Session is a Token and its metadata
type User ¶
type User struct { Name string `mapstructure:"name" json:"name" yaml:"name"` UserSpec `mapstructure:"user" json:"user" yaml:"user"` }
User is a user with a name
type UserSpec ¶
type UserSpec struct { ClientCert string `mapstructure:"client-certificate" json:"client-certificate" yaml:"client-certificate"` ClientCertData string `` /* 130-byte string literal not displayed */ ClientKey string `mapstructure:"client-key" json:"client-key" yaml:"client-key"` ClientKeyData string `mapstructure:"client-key-data,omitempty" json:"client-key-data,omitempty" yaml:"client-key-data,omitempty"` Password string `mapstructure:"password" json:"password" yaml:"password"` Username string `mapstructure:"username" json:"username" yaml:"username"` RoleID string `mapstructure:"roleID" json:"roleID" yaml:"roleID"` SecretID string `mapstructure:"secretID" json:"secretID" yaml:"secretID"` IgnoreNamespaceOnAuth bool `mapstructure:"ignore-namespace-on-auth" json:"ignore-namespace-on-auth" yaml:"ignore-namespace-on-auth"` }
UserSpec a user with credentials