Documentation ¶
Index ¶
- func AgentAddr(addr string) string
- func ClientCredentials(packages pack.PackageService) (credentials.TransportCredentials, error)
- func ClientCredentialsFromDir(secretsDir string) (credentials.TransportCredentials, error)
- func ClientCredentialsFromKeyPairs(keys, caKeys authority.TLSKeyPair) (credentials.TransportCredentials, error)
- func Credentials(packages pack.PackageService) (server credentials.TransportCredentials, ...)
- func CredentialsFromDir(secretsDir string) (server credentials.TransportCredentials, ...)
- func CredentialsFromPackage(packages pack.PackageService, secretsPackage loc.Locator) (tls utils.TLSArchive, err error)
- func DeployAgents(ctx context.Context, req DeployAgentsRequest) error
- func GenerateAgentCredentials(hosts []string, commonName string, longLivedClient bool) (archive utils.TLSArchive, err error)
- func GenerateAgentCredentialsPackage(packages pack.PackageService, pkgTemplate loc.Locator, ...) (secretsLocator *loc.Locator, err error)
- func InitCredentials(packages pack.PackageService) (*loc.Locator, error)
- func LoadCredentialsData(packages pack.PackageService) (env *pack.PackageEnvelope, rc io.ReadCloser, err error)
- func ServerCredentials(packages pack.PackageService) (credentials.TransportCredentials, error)
- func ServerCredentialsFromDir(secretsDir string) (credentials.TransportCredentials, error)
- func ServerCredentialsFromKeyPairs(keys, caKeys authority.TLSKeyPair) (credentials.TransportCredentials, error)
- func ShutdownAgents(ctx context.Context, servers []string, logger log.FieldLogger, ...) error
- func UpsertCredentials(packages pack.PackageService) (*loc.Locator, error)
- func UpsertCredentialsFromData(packages pack.PackageService, r io.Reader, labels map[string]string) error
- func ValidateCredentials(archive utils.TLSArchive, now time.Time) error
- type AgentRepository
- type AgentStatus
- type DeployAgentsRequest
- type DeployServer
- type RemoteRunner
- type StatusList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentAddr ¶
AgentAddr returns a complete agent address for specified address addr. If addr already contains a port, the address is returned unaltered, otherwise, a default RPC agent port is added
func ClientCredentials ¶
func ClientCredentials(packages pack.PackageService) (credentials.TransportCredentials, error)
ClientCredentials reads client credentials from specified package service
func ClientCredentialsFromDir ¶
func ClientCredentialsFromDir(secretsDir string) (credentials.TransportCredentials, error)
ClientCredentialsFromDir loads the client agent credentials from the specified location
func ClientCredentialsFromKeyPairs ¶
func ClientCredentialsFromKeyPairs(keys, caKeys authority.TLSKeyPair) (credentials.TransportCredentials, error)
ClientCredentialsFromKeyPairs loads agent client credentials from the specified set of key pairs
func Credentials ¶
func Credentials(packages pack.PackageService) (server credentials.TransportCredentials, client credentials.TransportCredentials, err error)
Credentials returns both server and client credentials read from the specified package service
func CredentialsFromDir ¶
func CredentialsFromDir(secretsDir string) (server credentials.TransportCredentials, client credentials.TransportCredentials, err error)
CredentialsFromDir returns both server and client credentials read from the specified secrets dir
func CredentialsFromPackage ¶
func CredentialsFromPackage(packages pack.PackageService, secretsPackage loc.Locator) (tls utils.TLSArchive, err error)
CredentialsFromPackage reads the specified package as a package with credentials
func DeployAgents ¶
func DeployAgents(ctx context.Context, req DeployAgentsRequest) error
DeployAgents uses teleport to discover cluster nodes, distribute and run RPC agents across the local cluster. One of the master nodes is selected to control the automatic update operation specified with req.LeaderParams.
func GenerateAgentCredentials ¶
func GenerateAgentCredentials(hosts []string, commonName string, longLivedClient bool) (archive utils.TLSArchive, err error)
GenerateAgentCredentials creates client/server credentials archive. hosts lists additional hosts to add to the generated certificates.
func GenerateAgentCredentialsPackage ¶
func GenerateAgentCredentialsPackage(packages pack.PackageService, pkgTemplate loc.Locator, archive utils.TLSArchive) (secretsLocator *loc.Locator, err error)
GenerateAgentCredentialsPackage creates or updates a package in packages with client/server credentials. pkgTemplate specifies the naming template for the resulting package
func InitCredentials ¶
func InitCredentials(packages pack.PackageService) (*loc.Locator, error)
InitCredentials creates a package with RPC secrets in the specified package service
func LoadCredentialsData ¶
func LoadCredentialsData(packages pack.PackageService) (env *pack.PackageEnvelope, rc io.ReadCloser, err error)
LoadCredentialsData returns an io.Reader into the credentials package. Caller is responsible for closing the returned reader
func ServerCredentials ¶
func ServerCredentials(packages pack.PackageService) (credentials.TransportCredentials, error)
ServerCredentials reads server credentials from the specified package service
func ServerCredentialsFromDir ¶
func ServerCredentialsFromDir(secretsDir string) (credentials.TransportCredentials, error)
ServerCredentialsFromDir loads server agent credentials from the specified location
func ServerCredentialsFromKeyPairs ¶
func ServerCredentialsFromKeyPairs(keys, caKeys authority.TLSKeyPair) (credentials.TransportCredentials, error)
ServerCredentialsFromKeyPairs loads server agent credentials from the specified set of key pairs
func ShutdownAgents ¶
func ShutdownAgents(ctx context.Context, servers []string, logger log.FieldLogger, rpc AgentRepository) error
ShutdownAgents takes IP host addresses to send Shutdown() RPC request
func UpsertCredentials ¶
func UpsertCredentials(packages pack.PackageService) (*loc.Locator, error)
UpsertCredentials creates or updates RPC secrets package in the specified package service
func UpsertCredentialsFromData ¶
func UpsertCredentialsFromData(packages pack.PackageService, r io.Reader, labels map[string]string) error
UpsertCredentialsFromData creates or updates RPC credentials from the specified data
func ValidateCredentials ¶
func ValidateCredentials(archive utils.TLSArchive, now time.Time) error
ValidateCredentials checks the credentials from the specified archive for validity
Types ¶
type AgentRepository ¶
type AgentRepository interface { // RemoteRunner provides an interface for executing remote commands. RemoteRunner // GetClient returns a client to the remote server specified with addr. GetClient(ctx context.Context, addr string) (rpcclient.Interface, error) }
AgentRepository provides an interface for creating clients for remote RPC agents and executing commands on them.
type AgentStatus ¶
type AgentStatus struct { // Hostname specifies the hostname of the node running the agent. Hostname string // Address specifies the IP address of the node running the agent. Address string // Status indicates the current status of the agent. An agent is `Deployed` // if the gravity-agent service is active. The agent is `Offline` if it // fails to respond to the status request. Status string // Version describes gravity agent version. Version string // Error contains an error that might have occurred when requesting agent status. Error error }
AgentStatus contains a gravity agent's status information.
type DeployAgentsRequest ¶
type DeployAgentsRequest struct { // GravityPackage specifies the gravity binary package to use // as the main process GravityPackage loc.Locator // ClusterState is the cluster state ClusterState storage.ClusterState // Servers lists the servers to deploy Servers []DeployServer // SecretsPackage specifies the package with RPC credentials SecretsPackage loc.Locator // Proxy telekube proxy for remote execution Proxy *teleclient.ProxyClient // FieldLogger defines the logger to use logrus.FieldLogger // LeaderParams defines which parameters to pass to the leader agent process. // The leader agent specifies the agent that executes an operation. LeaderParams string // Leader is the node where the leader agent should be launched // // If not set, the first master node will serve as a leader Leader *storage.Server // NodeParams defines which parameters to pass to the regular agent process. NodeParams string // Progress is the progress reporter. Progress utils.Progress }
DeployAgentsRequest defines the extent of configuration necessary to deploy agents on the local cluster.
func (*DeployAgentsRequest) CheckAndSetDefaults ¶
func (r *DeployAgentsRequest) CheckAndSetDefaults() error
CheckAndSetDefaults validates the request to deploy agents and sets defaults.
type DeployServer ¶
type DeployServer struct { // Role specifies the server's service role Role schema.ServiceRole // AdvertiseIP specifies the address the server is available on AdvertiseIP string // Hostname specifies the server's hostname Hostname string // NodeAddr is the server's address in teleport context NodeAddr string }
DeployServer describes an agent to deploy on every node during update.
Agents come in two flavors: passive or controller. Once an agent cluster has been built, an agent will be selected to control the update (i.e. give commands to other agents) if the process is automatic.
func NewDeployServer ¶
func NewDeployServer(node storage.Server) DeployServer
NewDeployServer creates a new instance of DeployServer
type RemoteRunner ¶
type RemoteRunner interface { io.Closer // Run executes a command on a remote node. Run(ctx context.Context, server storage.Server, command ...string) error // CanExecute determines whether the runner can execute a command // on the specified remote node. CanExecute(context.Context, storage.Server) error }
RemoteRunner provides an interface for executing remote commands.
type StatusList ¶
type StatusList []AgentStatus
StatusList is a list of AgentStatus.
func CollectAgentStatus ¶
func CollectAgentStatus(ctx context.Context, servers storage.Servers, rpc AgentRepository) StatusList
CollectAgentStatus collects the status from the specified agents.
func (StatusList) AgentsActive ¶
func (r StatusList) AgentsActive() bool
AgentsActive returns true if all gravity agents are active.
func (StatusList) String ¶
func (r StatusList) String() string
String returns the StatusList as a string.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
inprocess
Package inprocess implements in-process network connections and corresponding dialing/listening.
|
Package inprocess implements in-process network connections and corresponding dialing/listening. |
proxy
Package proxy implements a simple network proxy for tests
|
Package proxy implements a simple network proxy for tests |