opsservice

package
v0.0.0-...-3bfe646 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 94 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DirectUpgradeVersions contains gravity versions where there's a direct
	// upgrade path to the current gravity version.
	//
	// Specified versions are treated as a minimum version of the respective
	// release line from which the direct upgrade is possible.
	//
	// For instance, if the version is 5.2.10, the current version can upgrade
	// directly from 5.2.10, 5.2.11 and so on.
	DirectUpgradeVersions = Versions{

		semver.New("7.1.0"),
		semver.New("8.0.0"),

		semver.New("9.0.0"),
	}

	// UpgradeViaVersions maps older gravity versions to versions that can be
	// used as an intermediate step when upgrading to the current version.
	//
	// Specified versions are treated as described above.
	//
	// This version does not currently support upgrades via intermediate
	// runtimes.
	UpgradeViaVersions = map[*semver.Version]Versions{}
)

Functions

func DeleteClusterCertificate

func DeleteClusterCertificate(client *kubernetes.Clientset) error

DeleteClusterCertificate deletes cluster certificate

func ExistingCluster

func ExistingCluster(domain string, cluster map[string]string) string

ExistingCluster returns combined addresses of all the existing servers as reported by etcd member add

func FQDN

func FQDN(domain, hostname, ip string) string

FQDN returns a fully qualified domain name from specified parameter

func GetAuthGateway

func GetAuthGateway(client *kubernetes.Clientset, identity users.Identity) (storage.AuthGateway, error)

GetAuthGateway returns auth gateway configuration

func GetClusterCertificate

func GetClusterCertificate(client *kubernetes.Clientset) ([]byte, []byte, error)

GetClusterCertificate returns certificate and private key data stored in a secret inside the cluster

The method is supposed to be called from within deployed Kubernetes cluster

func GetClusterMetrics

GetClusterMetrics retrieves all cluster metrics from the provided client.

func GetMounts

func GetMounts(m schema.Manifest, server storage.Server) ([]storage.Mount, error)

GetMounts returns a list of server mounts

func NewConfigurationConfigMap

func NewConfigurationConfigMap(config []byte) *v1.ConfigMap

NewConfigurationConfigMap creates the backing ConfigMap to host cluster configuration

func NewEnvironmentConfigMap

func NewEnvironmentConfigMap(data map[string]string) *v1.ConfigMap

NewEnvironmentConfigMap creates the backing ConfigMap to host cluster runtime environment variables

func PackageSuffix

func PackageSuffix(node remoteServer, clusterName string) string

PackageSuffix returns a new package suffix used in package names from the specified node address and given cluster name

func PlanetCertAuthorityPackage

func PlanetCertAuthorityPackage(repository string) loc.Locator

PlanetCertAuthorityPackage returns the name of the planet CA package

func ReadCertAuthorityPackage

func ReadCertAuthorityPackage(packages pack.PackageService, clusterName string) (utils.TLSArchive, error)

ReadCertAuthorityPackage returns the certificate authority package for the specified cluster

func UpdateClusterCertificate

func UpdateClusterCertificate(client *kubernetes.Clientset, req ops.UpdateCertificateRequest) error

UpdateClusterCertificate updates the cluster certificate and private key

The method is supposed to be called from within deployed Kubernetes cluster

func UpsertAuthGateway

func UpsertAuthGateway(client *kubernetes.Clientset, identity users.Identity, gw storage.AuthGateway) error

UpsertAuthGateway updates auth gateway configuration.

func ValidateServers

func ValidateServers(ctx context.Context, operator ops.Operator, req ops.ValidateServersRequest) error

ValidateServers executes preflight checks and returns formatted error if any of the checks fail.

Types

type AgentPeerStore

type AgentPeerStore struct {
	log.FieldLogger
	// contains filtered or unexported fields
}

AgentPeerStore manages groups of agents based on operation context. Implements rpcserver.PeerStore

func NewAgentPeerStore

func NewAgentPeerStore(backend storage.Backend, users users.Users,
	teleport ops.TeleportProxyService, log log.FieldLogger) *AgentPeerStore

NewAgentPeerStore creates a new instance of this agent peer store

func (*AgentPeerStore) NewPeer

func (r *AgentPeerStore) NewPeer(ctx context.Context, req pb.PeerJoinRequest, peer rpcserver.Peer) error

NewPeer adds a new peer

func (*AgentPeerStore) RemovePeer

func (r *AgentPeerStore) RemovePeer(ctx context.Context, req pb.PeerLeaveRequest, peer rpcserver.Peer) error

RemovePeer removes the specified peer from the store

type AgentService

type AgentService struct {
	log.FieldLogger
	rpcserver.Server
	// contains filtered or unexported fields
}

AgentService is a controller for install agents. Implements ops.AgentService

func NewAgentService

func NewAgentService(server rpcserver.Server, peerStore *AgentPeerStore, advertiseAddr string,
	log log.FieldLogger) *AgentService

NewAgentService returns a new agent service

func (*AgentService) AbortAgents

func (r *AgentService) AbortAgents(ctx context.Context, key ops.SiteOperationKey) error

AbortAgents shuts down remote agents and cleans up state

func (*AgentService) CheckBandwidth

CheckBandwidth executes the bandwidth test in the agent cluster

func (*AgentService) CheckDisks

CheckDisks executes disk performance test on the specified node

func (*AgentService) CheckPorts

CheckPorts executes the ports pingpong network test in the agent cluster

func (*AgentService) CompleteAgents

func (r *AgentService) CompleteAgents(ctx context.Context, key ops.SiteOperationKey) error

CompleteAgents shuts down remote agents after a successfully completed operation

func (*AgentService) Exec

func (r *AgentService) Exec(ctx context.Context, key ops.SiteOperationKey, addr string, args []string, stdout, stderr io.Writer) error

Exec executes command on a remote server that is identified by meeting point and agent's address addr

func (*AgentService) ExecNoLog

func (r *AgentService) ExecNoLog(ctx context.Context, key ops.SiteOperationKey, addr string, args []string, stdout, stderr io.Writer) error

ExecNoLog executes the command specified with args on a remote server given with addr. It streams the process's output to the given writer out. Underlying remote call output is not logged

func (*AgentService) GetServerInfos

func (r *AgentService) GetServerInfos(ctx context.Context, key ops.SiteOperationKey) (checks.ServerInfos, error)

GetServerInfos collects system information from all agents given with addrs

func (*AgentService) ServerAddr

func (r *AgentService) ServerAddr() string

ServerAddr returns the address the install server is listening on

func (*AgentService) StopAgents

func (r *AgentService) StopAgents(ctx context.Context, key ops.SiteOperationKey) error

StopAgents shuts down remote agents

func (*AgentService) Validate

func (r *AgentService) Validate(ctx context.Context, key ops.SiteOperationKey, addr string,
	manifest schema.Manifest, profileName string) ([]*agentpb.Probe, error)

Validate executes preflight checks on the node specified with addr using the specified manifest.

func (*AgentService) Wait

func (r *AgentService) Wait(ctx context.Context, key ops.SiteOperationKey, numAgents int) error

Wait blocks until the specified number of agents have connected for the the given operation. Context can be used for canceling the operation.

type CloudProvider

type CloudProvider interface {
}

CloudProvider defines an interface to customize certain aspects of deployment

type Command

type Command struct {
	// Args is a slice of command arguments
	Args []string
	// Description is a user friendly description of this command
	Description string
	// Retry indicates whether the command should be retried upon failure
	Retry bool
}

Command is a command to execute, includes arguments and user-facing description

func Cmd

func Cmd(args []string, format string, formatArgs ...interface{}) Command

Cmd returns new instance of command with user facing description

func RetryCmd

func RetryCmd(args []string, format string, formatArgs ...interface{}) Command

RetryCmd returns a new command that should be retried upon failure

func (Command) Run

func (c Command) Run(ctx operationContext, runner remoteRunner, server remoteServer) (out []byte, err error)

Run runs the command on the specified server using the provided runner

type Config

type Config struct {
	// StateDir is for some state is stored locally for now
	StateDir string

	// Backend is a storage backend
	Backend storage.Backend

	// Leader specifies the leader campaign implementation
	Leader storage.Leader

	// Agents service controls install agents that run on the hosts
	Agents *AgentService

	// Clients provides access to clients for remote clusters such as operator or apps
	Clients *clients.ClusterClients

	// Packages service controls release and remote access to software
	// packages
	Packages pack.PackageService

	// Apps service manages application packages
	Apps appservice.Applications

	// TeleportProxyService is a teleport proxy service
	TeleportProxy ops.TeleportProxyService

	// AuthClient is teleport auth server client.
	AuthClient *auth.Client

	// Tunnel is a reverse tunnel server providing access to remote sites
	Tunnel reversetunnel.Server

	// Users service provides access to users
	Users users.Identity

	// Metrics provides interface for cluster metrics collection.
	Metrics monitoring.Metrics

	// Clock is used to mock time in tests
	Clock timetools.TimeProvider

	// Devmode sets/removes some insecure flags acceptable for development
	Devmode bool

	// Local flag indicates whether the process is running in the local gravity site mode
	Local bool

	// Wizard flag indicates whether the process is running in wizard install mode
	Wizard bool

	// Proxy lets this ops center service communicate with other serices
	Proxy ops.Proxy

	// SNIHost if set, sets a base SNI host for APIServer
	SNIHost string

	// SeedConfig defines optional OpsCenter configuration to start with
	SeedConfig ops.SeedConfig

	// ProcessID uniquely identifies gravity process
	ProcessID string

	// PublicAddr is the operator service public advertise address
	PublicAddr teleutils.NetAddr

	// InstallLogFiles is a list of additional install log files
	// to add to install and expand operations for local troubleshooting
	InstallLogFiles []string

	// LogForwarders allows to manage log forwarders via Kubernetes config maps
	LogForwarders LogForwardersControl

	// OpenEBS provides access to managing OpenEBS in the cluster.
	OpenEBS OpenEBSControl

	// Client specifies an optional kubernetes client
	Client *kubernetes.Clientset

	// AuditLog is used to submit events to the audit log
	AuditLog teleevents.IAuditLog
}

Config holds configuration parameters for operator service

func (*Config) CheckAndSetDefaults

func (cfg *Config) CheckAndSetDefaults() error

func (*Config) CheckRelaxed

func (cfg *Config) CheckRelaxed() error

type LogForwardersControl

type LogForwardersControl interface {
	// Get returns a list of log forwarders from config map
	Get() ([]storage.LogForwarder, error)
	// Replace replaces all log forwarders in config map with the provided ones
	Replace([]storage.LogForwarder) error
	// Create adds a new log forwarder in config map
	Create(storage.LogForwarder) error
	// Update updates an existing log forwarder in config map
	Update(storage.LogForwarder) error
	// Delete deletes log forwarder from config map
	Delete(string) error
	// Reload forces log collector to reload forwarder configuration
	Reload() error
}

LogForwardersControl defines methods for managing log forwarders in Kubernetes, mostly so implementation can be substituted in tests w/o Kubernetes

func NewLogForwardersControl

func NewLogForwardersControl(client *kubernetes.Clientset) LogForwardersControl

NewLogForwardersControl returns a default Kubernetes-managed log forwarder controller

type OpenEBSConfig

type OpenEBSConfig struct {
	// Client is the Kubernetes client.
	Client *kubernetes.Clientset
	// Namespace is the namespace where OpenEBS components reside.
	Namespace string
	// ConfigMapName is the name of the config map with node device manager configuration.
	ConfigMapName string
	// DaemonSetName is the name of the node device manager daemon set.
	DaemonSetName string
}

OpenEBSConfig is the OpenEBS controller configuration.

func (*OpenEBSConfig) CheckAndSetDefaults

func (c *OpenEBSConfig) CheckAndSetDefaults() error

CheckAndSetDefaults validates the config and sets defaults.

type OpenEBSControl

type OpenEBSControl interface {
	// GetNDMConfig returns node device manager configuration.
	GetNDMConfig() (*storage.NDMConfig, error)
	// UpdateNDMConfig updates node device manager configuration.
	UpdateNDMConfig(*storage.NDMConfig) error
	// RestartNDM restarts node device manager pods.
	RestartNDM() error
}

OpenEBSControl provides interface for managing OpenEBS in the cluster.

func NewOpenEBSControl

func NewOpenEBSControl(config OpenEBSConfig) (OpenEBSControl, error)

NewOpenEBSControl returns a new OpenEBS controller for the provided client.

type Operator

type Operator struct {

	// FieldLogger allows this operator to log messages
	log.FieldLogger
	// contains filtered or unexported fields
}

Operator implements Operator interface

func New

func New(cfg Config) (*Operator, error)

New creates an instance of the Operator service

func NewLocalOperator

func NewLocalOperator(cfg Config) (*Operator, error)

NewLocalOperator creates an instance of the operator service that is used in a restricted context to allow access to the up-to-date APIs (i.e. during update)

func (*Operator) ActivateSite

func (o *Operator) ActivateSite(req ops.ActivateSiteRequest) error

ActivateSite moves site to the active state and, if requested, starts an application.

func (*Operator) CheckSiteStatus

func (o *Operator) CheckSiteStatus(ctx context.Context, key ops.SiteKey) error

CheckSiteStatus runs application status hook and updates cluster status appropriately

func (*Operator) CompleteFinalInstallStep

func (o *Operator) CompleteFinalInstallStep(req ops.CompleteFinalInstallStepRequest) error

CompleteFinalInstallStep marks the site as having completed the mandatory last installation step

func (*Operator) ConfigureNode

func (o *Operator) ConfigureNode(req ops.ConfigureNodeRequest) error

ConfigureNode prepares the node for the upgrade, for example updates necessary directories permissions and creates missing ones

func (*Operator) ConfigurePackages

func (o *Operator) ConfigurePackages(req ops.ConfigurePackagesRequest) error

ConfigurePackages packages configures packages for the specified install operation

func (*Operator) CreateAPIKey

func (o *Operator) CreateAPIKey(ctx context.Context, req ops.NewAPIKeyRequest) (*storage.APIKey, error)

func (*Operator) CreateAccount

func (o *Operator) CreateAccount(req ops.NewAccountRequest) (*ops.Account, error)

func (*Operator) CreateClusterGarbageCollectOperation

func (o *Operator) CreateClusterGarbageCollectOperation(ctx context.Context, r ops.CreateClusterGarbageCollectOperationRequest) (*ops.SiteOperationKey, error)

CreateClusterGarbageCollectOperation creates a new garbage collection operation in the cluster

func (*Operator) CreateClusterReconfigureOperation

func (o *Operator) CreateClusterReconfigureOperation(ctx context.Context, req ops.CreateClusterReconfigureOperationRequest) (*ops.SiteOperationKey, error)

CreateClusterReconfigureOperation creates a new cluster reconfiguration operation.

func (*Operator) CreateInstallToken

func (o *Operator) CreateInstallToken(req ops.NewInstallTokenRequest) (*storage.InstallToken, error)

CreateInstallToken creates a new install token for the specified request. If the token already exists, it returns an existing token

func (*Operator) CreateLogEntry

func (o *Operator) CreateLogEntry(key ops.SiteOperationKey, entry ops.LogEntry) error

CreateLogEntry appends the provided log entry to the operation's log file

func (*Operator) CreateLogForwarder

func (o *Operator) CreateLogForwarder(ctx context.Context, key ops.SiteKey, forwarder storage.LogForwarder) error

CreateLogForwarder creates a new log forwarder

func (*Operator) CreateOperationPlan

func (o *Operator) CreateOperationPlan(key ops.SiteOperationKey, plan storage.OperationPlan) error

CreateOperationPlan saves the provided operation plan

func (*Operator) CreateOperationPlanChange

func (o *Operator) CreateOperationPlanChange(key ops.SiteOperationKey, change storage.PlanChange) error

CreateOperationPlanChange creates a new changelog entry for a plan

func (*Operator) CreateProgressEntry

func (o *Operator) CreateProgressEntry(key ops.SiteOperationKey, entry ops.ProgressEntry) error

func (*Operator) CreateProvisioningToken

func (o *Operator) CreateProvisioningToken(token storage.ProvisioningToken) error

func (*Operator) CreateSite

func (o *Operator) CreateSite(r ops.NewSiteRequest) (*ops.Site, error)

func (*Operator) CreateSiteAppUpdateOperation

func (o *Operator) CreateSiteAppUpdateOperation(ctx context.Context, r ops.CreateSiteAppUpdateOperationRequest) (*ops.SiteOperationKey, error)

func (*Operator) CreateSiteExpandOperation

func (o *Operator) CreateSiteExpandOperation(ctx context.Context, r ops.CreateSiteExpandOperationRequest) (*ops.SiteOperationKey, error)

func (*Operator) CreateSiteInstallOperation

func (o *Operator) CreateSiteInstallOperation(ctx context.Context, r ops.CreateSiteInstallOperationRequest) (*ops.SiteOperationKey, error)

func (*Operator) CreateSiteShrinkOperation

func (o *Operator) CreateSiteShrinkOperation(ctx context.Context, r ops.CreateSiteShrinkOperationRequest) (*ops.SiteOperationKey, error)

func (*Operator) CreateSiteUninstallOperation

func (o *Operator) CreateSiteUninstallOperation(ctx context.Context, r ops.CreateSiteUninstallOperationRequest) (*ops.SiteOperationKey, error)

func (*Operator) CreateUpdateConfigOperation

func (o *Operator) CreateUpdateConfigOperation(ctx context.Context, req ops.CreateUpdateConfigOperationRequest) (*ops.SiteOperationKey, error)

CreateUpdateConfigOperation creates a new operation to update cluster configuration

func (*Operator) CreateUpdateEnvarsOperation

func (o *Operator) CreateUpdateEnvarsOperation(ctx context.Context, r ops.CreateUpdateEnvarsOperationRequest) (*ops.SiteOperationKey, error)

CreateUpdateEnvarsOperation creates a new operation to update cluster environment variables

func (*Operator) CreateUser

func (o *Operator) CreateUser(req ops.NewUserRequest) error

func (*Operator) CreateUserInvite

func (o *Operator) CreateUserInvite(ctx context.Context, req ops.CreateUserInviteRequest) (*storage.UserToken, error)

CreateUserInvite creates a new invite token for a user.

func (*Operator) CreateUserReset

func (o *Operator) CreateUserReset(ctx context.Context, req ops.CreateUserResetRequest) (*storage.UserToken, error)

CreateUserReset creates a new reset token for a user.

func (*Operator) DeactivateSite

func (o *Operator) DeactivateSite(req ops.DeactivateSiteRequest) error

DeactivateSite puts the site in the degraded state and, if requested, stops an application.

func (*Operator) DeleteAPIKey

func (o *Operator) DeleteAPIKey(ctx context.Context, userEmail, token string) error

func (*Operator) DeleteAlert

func (o *Operator) DeleteAlert(ctx context.Context, key ops.SiteKey, name string) error

DeleteAlert deletes the specified monitoring alert

func (*Operator) DeleteAlertTarget

func (o *Operator) DeleteAlertTarget(ctx context.Context, key ops.SiteKey) error

DeleteAlertTarget deletes the cluster monitoring alert target

func (*Operator) DeleteClusterCertificate

func (o *Operator) DeleteClusterCertificate(ctx context.Context, key ops.SiteKey) error

DeleteClusterCertificate deletes cluster certificate

func (*Operator) DeleteGithubConnector

func (o *Operator) DeleteGithubConnector(ctx context.Context, key ops.SiteKey, name string) error

DeleteGithubConnector deletes a Github connector by name

func (*Operator) DeleteLocalUser

func (o *Operator) DeleteLocalUser(email string) error

func (*Operator) DeleteLogForwarder

func (o *Operator) DeleteLogForwarder(ctx context.Context, key ops.SiteKey, name string) error

DeleteLogForwarder deletes a log forwarder

func (*Operator) DeleteSMTPConfig

func (o *Operator) DeleteSMTPConfig(ctx context.Context, key ops.SiteKey) error

DeleteSMTPConfig deletes the cluster SMTP configuration

func (*Operator) DeleteSite

func (o *Operator) DeleteSite(key ops.SiteKey) error

func (*Operator) DeleteSiteOperation

func (o *Operator) DeleteSiteOperation(key ops.SiteOperationKey) (err error)

DeleteSiteOperation removes an unstarted operation and resets site state to active

func (*Operator) DeleteUser

func (o *Operator) DeleteUser(ctx context.Context, key ops.SiteKey, name string) error

DeleteUser deletes a user by name

func (*Operator) DeleteUserInvite

func (o *Operator) DeleteUserInvite(ctx context.Context, req ops.DeleteUserInviteRequest) error

DeleteUserInvite deletes the specified user invite.

func (*Operator) EmitAuditEvent

func (o *Operator) EmitAuditEvent(ctx context.Context, req ops.AuditEventRequest) error

EmitAuditEvent saves the provided event in the audit log.

func (*Operator) GetAPIKeys

func (o *Operator) GetAPIKeys(userEmail string) ([]storage.APIKey, error)

func (*Operator) GetAccount

func (o *Operator) GetAccount(accountID string) (*ops.Account, error)

func (*Operator) GetAccounts

func (o *Operator) GetAccounts() ([]ops.Account, error)

func (*Operator) GetAlertTargets

func (o *Operator) GetAlertTargets(key ops.SiteKey) (targets []storage.AlertTarget, err error)

GetAlertTargets returns a list of configured monitoring alert targets

func (*Operator) GetAlerts

func (o *Operator) GetAlerts(key ops.SiteKey) (alerts []storage.Alert, err error)

GetAlerts returns a list of configured monitoring alerts

func (*Operator) GetAppInstaller

func (o *Operator) GetAppInstaller(req ops.AppInstallerRequest) (io.ReadCloser, error)

GetAppInstaller returns an installer tarball for application specified with locator

func (*Operator) GetApplicationEndpoints

func (o *Operator) GetApplicationEndpoints(key ops.SiteKey) ([]ops.Endpoint, error)

GetApplicationEndpoints returns a list of application endpoints for a deployed site

func (*Operator) GetAuthGateway

func (o *Operator) GetAuthGateway(key ops.SiteKey) (storage.AuthGateway, error)

GetAuthGateway returns auth gateway configuration

func (*Operator) GetClusterAgent

func (o *Operator) GetClusterAgent(req ops.ClusterAgentRequest) (*storage.LoginEntry, error)

func (*Operator) GetClusterAuthPreference

func (o *Operator) GetClusterAuthPreference(key ops.SiteKey) (teleservices.AuthPreference, error)

GetClusterAuthPreference returns cluster authentication preference

func (*Operator) GetClusterCertificate

func (o *Operator) GetClusterCertificate(key ops.SiteKey, withSecrets bool) (*ops.ClusterCertificate, error)

GetClusterCertificate returns the cluster certificate

func (*Operator) GetClusterConfiguration

func (o *Operator) GetClusterConfiguration(key ops.SiteKey) (config clusterconfig.Interface, err error)

GetClusterConfiguration retrieves the cluster configuration

func (*Operator) GetClusterEnvironmentVariables

func (o *Operator) GetClusterEnvironmentVariables(key ops.SiteKey) (env storage.EnvironmentVariables, err error)

GetClusterEnvironmentVariables retrieves the cluster environment variables

func (*Operator) GetClusterMetrics

func (o *Operator) GetClusterMetrics(ctx context.Context, req ops.ClusterMetricsRequest) (*ops.ClusterMetricsResponse, error)

GetClusterMetrics returns basic CPU/RAM metrics for the specified cluster.

func (*Operator) GetClusterNodes

func (o *Operator) GetClusterNodes(key ops.SiteKey) ([]ops.Node, error)

GetClusterNodes returns a real-time information about cluster nodes

func (*Operator) GetConfig

func (o *Operator) GetConfig() Config

GetConfig returns config operator was initialized with

func (*Operator) GetCurrentUser

func (o *Operator) GetCurrentUser() (storage.User, error)

func (*Operator) GetCurrentUserInfo

func (o *Operator) GetCurrentUserInfo() (*ops.UserInfo, error)

func (*Operator) GetExpandToken

func (o *Operator) GetExpandToken(key ops.SiteKey) (*storage.ProvisioningToken, error)

func (*Operator) GetGithubConnector

func (o *Operator) GetGithubConnector(key ops.SiteKey, name string, withSecrets bool) (teleservices.GithubConnector, error)

GetGithubConnector returns a Github connector by name

Returned connector exclude client secret unless withSecrets is true.

func (*Operator) GetGithubConnectors

func (o *Operator) GetGithubConnectors(key ops.SiteKey, withSecrets bool) ([]teleservices.GithubConnector, error)

GetGithubConnectors returns all Github connectors

Returned connectors exclude client secret unless withSecrets is true.

func (*Operator) GetKubeClient

func (o *Operator) GetKubeClient() (*kubernetes.Clientset, error)

GetKubeClient lazy initializes K8s client

func (*Operator) GetLocalSite

func (o *Operator) GetLocalSite(context.Context) (*ops.Site, error)

GetLocalSite returns local cluster record for this Ops Center

func (*Operator) GetLocalUser

func (o *Operator) GetLocalUser(key ops.SiteKey) (storage.User, error)

GetLocalUser returns local gravity site admin

func (*Operator) GetLogForwarders

func (o *Operator) GetLogForwarders(key ops.SiteKey) ([]storage.LogForwarder, error)

GetLogForwarders returns a list of configured log forwarders

func (*Operator) GetOperationPlan

func (o *Operator) GetOperationPlan(key ops.SiteOperationKey) (*storage.OperationPlan, error)

GetOperationPlan returns plan for the specified operation

func (*Operator) GetPersistentStorage

func (o *Operator) GetPersistentStorage(ctx context.Context, key ops.SiteKey) (storage.PersistentStorage, error)

GetPersistentStorage retrieves the current persistent storage configuration.

func (*Operator) GetSMTPConfig

func (o *Operator) GetSMTPConfig(key ops.SiteKey) (storage.SMTPConfig, error)

GetSMTPConfig returns the cluster SMTP configuration

func (*Operator) GetSite

func (o *Operator) GetSite(key ops.SiteKey) (*ops.Site, error)

func (*Operator) GetSiteByDomain

func (o *Operator) GetSiteByDomain(domainName string) (*ops.Site, error)

func (*Operator) GetSiteExpandOperationAgentReport

func (o *Operator) GetSiteExpandOperationAgentReport(ctx context.Context, key ops.SiteOperationKey) (*ops.AgentReport, error)

func (*Operator) GetSiteInstallOperationAgentReport

func (o *Operator) GetSiteInstallOperationAgentReport(ctx context.Context, key ops.SiteOperationKey) (*ops.AgentReport, error)

func (*Operator) GetSiteInstructions

func (o *Operator) GetSiteInstructions(tokenID string, serverProfile string, params url.Values) (string, error)

GetSiteInstructions returns shell script with instructions to execute for particular install agent. params are optional URL query parameters that can specify additional configuration attributes.

func (*Operator) GetSiteOperation

func (o *Operator) GetSiteOperation(key ops.SiteOperationKey) (*ops.SiteOperation, error)

GetSiteOperation returns the operation information based on it's key

func (*Operator) GetSiteOperationLogs

func (o *Operator) GetSiteOperationLogs(key ops.SiteOperationKey) (io.ReadCloser, error)

func (*Operator) GetSiteOperationProgress

func (o *Operator) GetSiteOperationProgress(key ops.SiteOperationKey) (*ops.ProgressEntry, error)

func (*Operator) GetSiteOperations

func (o *Operator) GetSiteOperations(key ops.SiteKey, f ops.OperationsFilter) (ops.SiteOperations, error)

func (*Operator) GetSiteReport

func (o *Operator) GetSiteReport(ctx context.Context, req ops.GetClusterReportRequest) (io.ReadCloser, error)

func (*Operator) GetSites

func (o *Operator) GetSites(accountID string) ([]ops.Site, error)

func (*Operator) GetTrustedClusterToken

func (o *Operator) GetTrustedClusterToken(key ops.SiteKey) (storage.Token, error)

func (*Operator) GetUser

func (o *Operator) GetUser(key ops.SiteKey, name string) (teleservices.User, error)

GetUser returns a user by name

func (*Operator) GetUserInvites

func (o *Operator) GetUserInvites(ctx context.Context, key ops.SiteKey) ([]storage.UserInvite, error)

GetUserInvites returns all active user invites.

func (*Operator) GetUsers

func (o *Operator) GetUsers(key ops.SiteKey) ([]teleservices.User, error)

GetUsers returns all users

func (*Operator) GetVersion

func (o *Operator) GetVersion(ctx context.Context) (*proto.Version, error)

GetVersion returns the gravity binary version information.

func (*Operator) ListReleases

func (o *Operator) ListReleases(req ops.ListReleasesRequest) ([]storage.Release, error)

ListReleases returns all currently installed application releases.

func (*Operator) Lock

func (o *Operator) Lock()

Lock locks the operator mutex

func (*Operator) RemoteOpsClient

func (o *Operator) RemoteOpsClient(cluster teleservices.TrustedCluster) (*opsclient.Client, error)

RemoteOpsClient returns remote Ops Center client using the provided trusted cluster token for authentication

func (*Operator) ResetUserPassword

func (o *Operator) ResetUserPassword(req ops.ResetUserPasswordRequest) (string, error)

ResetUserPassword resets the user password and returns the new one

func (*Operator) ResumeShrink

func (o *Operator) ResumeShrink(key ops.SiteKey) (*ops.SiteOperationKey, error)

ResumeShrink resumes the started shrink operation if the node being shrunk gave up its leadership

func (*Operator) RotatePlanetConfig

func (o *Operator) RotatePlanetConfig(req ops.RotatePlanetConfigRequest) (*ops.RotatePackageResponse, error)

RotatePlanetConfig rotates planet configuration package for the server specified in the request

func (*Operator) RotateSecrets

func (o *Operator) RotateSecrets(req ops.RotateSecretsRequest) (resp *ops.RotatePackageResponse, err error)

RotateSecrets rotates secrets package for the server specified in the request

func (*Operator) RotateTeleportConfig

func (o *Operator) RotateTeleportConfig(req ops.RotateTeleportConfigRequest) (masterConfig *ops.RotatePackageResponse, nodeConfig *ops.RotatePackageResponse, err error)

RotateTeleportConfig generates teleport configuration for the server specified in the provided request

func (*Operator) SetKubeClient

func (o *Operator) SetKubeClient(client *kubernetes.Clientset)

SetKubeClient sets Kubernetes client for this operator.

func (*Operator) SetOperationState

func (o *Operator) SetOperationState(ctx context.Context, key ops.SiteOperationKey, req ops.SetOperationStateRequest) error

func (*Operator) SignSSHKey

func (o *Operator) SignSSHKey(req ops.SSHSignRequest) (*ops.SSHSignResponse, error)

SignSSHKey signs SSH Public Key with teleport's certificate

func (*Operator) SignTLSKey

func (o *Operator) SignTLSKey(req ops.TLSSignRequest) (*ops.TLSSignResponse, error)

SignTLSKey signs X509 Public Key with X509 certificate authority of this site

func (*Operator) SiteExpandOperationStart

func (o *Operator) SiteExpandOperationStart(key ops.SiteOperationKey) error

func (*Operator) SiteInstallOperationStart

func (o *Operator) SiteInstallOperationStart(key ops.SiteOperationKey) error

func (*Operator) StepDown

func (o *Operator) StepDown(key ops.SiteKey) error

StepDown asks the process to pause its leader election heartbeat so it can give up its leadership

func (*Operator) StreamOperationLogs

func (o *Operator) StreamOperationLogs(key ops.SiteOperationKey, reader io.Reader) error

StreamOperationLogs appends the logs from the provided reader to the specified operation (user-facing) log file

func (*Operator) Unlock

func (o *Operator) Unlock()

Unlock unlocks the operator mutex

func (*Operator) UpdateAlert

func (o *Operator) UpdateAlert(ctx context.Context, key ops.SiteKey, alert storage.Alert) error

UpdateAlert updates the specified monitoring alert

func (*Operator) UpdateAlertTarget

func (o *Operator) UpdateAlertTarget(ctx context.Context, key ops.SiteKey, target storage.AlertTarget) error

UpdateAlertTarget updates the cluster monitoring alert target

func (*Operator) UpdateClusterCertificate

func (o *Operator) UpdateClusterCertificate(ctx context.Context, req ops.UpdateCertificateRequest) (*ops.ClusterCertificate, error)

UpdateClusterCertificate updates the cluster certificate

func (*Operator) UpdateClusterConfiguration

func (o *Operator) UpdateClusterConfiguration(req ops.UpdateClusterConfigRequest) error

UpdateClusterConfiguration updates the cluster configuration to the value given in the specified request

func (*Operator) UpdateClusterEnvironmentVariables

func (o *Operator) UpdateClusterEnvironmentVariables(req ops.UpdateClusterEnvironRequest) error

UpdateClusterEnvironmentVariables updates the cluster runtime environment variables from the specified request

func (*Operator) UpdateExpandOperationState

func (o *Operator) UpdateExpandOperationState(key ops.SiteOperationKey, req ops.OperationUpdateRequest) error

UpdateExpandOperationState updates the state of an expand operation

func (*Operator) UpdateInstallOperationState

func (o *Operator) UpdateInstallOperationState(key ops.SiteOperationKey, req ops.OperationUpdateRequest) error

UpdateInstallOperationState updates the state of an install operation

func (*Operator) UpdateLogForwarder

func (o *Operator) UpdateLogForwarder(ctx context.Context, key ops.SiteKey, forwarder storage.LogForwarder) error

UpdateLogForwarder updates an existing log forwarder

func (*Operator) UpdateLogForwarders

func (o *Operator) UpdateLogForwarders(key ops.SiteKey, forwarders []storage.LogForwarderV1) error

UpdateLogForwarders replaces the list of active log forwarders TODO(r0mant,alexeyk) this is a legacy method used only by UI, alexeyk to remove it when refactoring resources and use upsert/delete instead

func (*Operator) UpdatePersistentStorage

func (o *Operator) UpdatePersistentStorage(ctx context.Context, req ops.UpdatePersistentStorageRequest) error

UpdatePersistentStorage updates cluster persistent storage configuration.

func (*Operator) UpdateSMTPConfig

func (o *Operator) UpdateSMTPConfig(ctx context.Context, key ops.SiteKey, config storage.SMTPConfig) error

UpdateSMTPConfig updates the cluster SMTP configuration

func (*Operator) UpdateUser

func (o *Operator) UpdateUser(ctx context.Context, req ops.UpdateUserRequest) error

UpdateUser updates the specified user information.

func (*Operator) UpsertAuthGateway

func (o *Operator) UpsertAuthGateway(ctx context.Context, key ops.SiteKey, gw storage.AuthGateway) error

UpsertAuthGateway updates auth gateway configuration.

func (*Operator) UpsertClusterAuthPreference

func (o *Operator) UpsertClusterAuthPreference(ctx context.Context, key ops.SiteKey, auth teleservices.AuthPreference) error

UpsertClusterAuthPreference updates cluster authentication preference

func (*Operator) UpsertGithubConnector

func (o *Operator) UpsertGithubConnector(ctx context.Context, key ops.SiteKey, connector teleservices.GithubConnector) error

UpsertGithubConnector creates or updates a Github connector

func (*Operator) UpsertUser

func (o *Operator) UpsertUser(ctx context.Context, key ops.SiteKey, user teleservices.User) error

UpsertUser creates or updates a user

func (*Operator) ValidateDomainName

func (o *Operator) ValidateDomainName(domainName string) error

func (*Operator) ValidateRemoteAccess

func (*Operator) ValidateServers

ValidateServers runs preflight checks before the installation and returns failed probes.

type ProvisionedServer

type ProvisionedServer struct {
	storage.Server
	Profile schema.NodeProfile
}

ProvisionedServer has all information we need to set up the server

func (*ProvisionedServer) Address

func (s *ProvisionedServer) Address() string

Address returns the address this server is accessible on Address implements remoteServer.Address

func (*ProvisionedServer) AgentName

func (s *ProvisionedServer) AgentName(domain string) string

AgentName returns a unique agent name for this server. The name of the agent is used to refer to this server in the cluster.

func (*ProvisionedServer) Debug

func (s *ProvisionedServer) Debug() string

Debug provides a reference to the specified server useful for logging Debug implements remoteServer.Debug

func (*ProvisionedServer) EtcdMemberName

func (s *ProvisionedServer) EtcdMemberName(domain string) string

EtcdMemberName returns generated unique etcd member name for this server

func (*ProvisionedServer) FQDN

func (s *ProvisionedServer) FQDN(domain string) string

FQDN returns this server's fully qualified domain name

func (*ProvisionedServer) HostName

func (s *ProvisionedServer) HostName() string

HostName returns the hostname of this server. HostName implements remoteServer.HostName

func (*ProvisionedServer) InGravity

func (s *ProvisionedServer) InGravity(dir ...string) string

InGravity returns a directory within gravity state dir on this server

func (*ProvisionedServer) IsMaster

func (s *ProvisionedServer) IsMaster() bool

IsMaster determines whether this server is a master

func (*ProvisionedServer) String

func (s *ProvisionedServer) String() string

String returns a text description of this server

func (*ProvisionedServer) UnqualifiedName

func (s *ProvisionedServer) UnqualifiedName(clusterName string) string

UnqualifiedName returns unqualified name - without cluster name

type TestServices

type TestServices struct {
	appservice.TestServices
	// Agents is the RPC agents service
	Agents *AgentService
	// AgentServer is the RPC agent server
	AgentServer rpcserver.Server
	// Operator is the ops service
	Operator *Operator
	// Users is the users service
	Users users.Identity
	// Dir is the temporary directory where all data is stored
	Dir string
	// Clock provides time interface
	Clock clockwork.Clock
}

TestServices contains a set of services that are used in tests

func SetupTestServices

func SetupTestServices(c *check.C) TestServices

SetupTestServices initializes backend and package and application services that can be used in tests

type Versions

type Versions []*semver.Version

Versions represents a list of semvers.

func (Versions) String

func (v Versions) String() string

String returns string representation of versions, indicating that these versions are treated as minimum patch versions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL