opsroute

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientPool

type ClientPool struct {
	ClientPoolConfig
	sync.Mutex
	// contains filtered or unexported fields
}

ClientPool helps to manage connections and clients to remote ops centers

func NewClientPool

func NewClientPool(config ClientPoolConfig) *ClientPool

func (*ClientPool) GetService

func (p *ClientPool) GetService(link storage.OpsCenterLink) (ops.Operator, error)

type ClientPoolConfig

type ClientPoolConfig struct {
	Backend storage.Backend
	Devmode bool
}

type Router

type Router struct {
	RouterConfig
}

Router routes requests either to a local ops center or remote link based on the site status it is used in ops center mode to make sure we are using local gravity site state when possible

func NewRouter

func NewRouter(conf RouterConfig) (*Router, error)

NewRouter returns new router instance

func (*Router) ActivateSite

func (r *Router) ActivateSite(req ops.ActivateSiteRequest) error

func (*Router) CheckSiteStatus

func (r *Router) CheckSiteStatus(ctx context.Context, key ops.SiteKey) error

CheckSiteStatus runs app status hook and updates site status appropriately

func (*Router) CompleteFinalInstallStep

func (r *Router) CompleteFinalInstallStep(req ops.CompleteFinalInstallStepRequest) error

func (*Router) ConfigureNode

func (r *Router) ConfigureNode(req ops.ConfigureNodeRequest) error

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

func (*Router) ConfigurePackages

func (r *Router) ConfigurePackages(req ops.ConfigurePackagesRequest) error

ConfigurePackages packages configures packages for the specified install operation

func (*Router) CreateAPIKey

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

func (*Router) CreateAccount

func (r *Router) CreateAccount(req ops.NewAccountRequest) (*ops.Account, error)

func (*Router) CreateClusterGarbageCollectOperation

func (r *Router) CreateClusterGarbageCollectOperation(ctx context.Context, req ops.CreateClusterGarbageCollectOperationRequest) (*ops.SiteOperationKey, error)

CreateClusterGarbageCollectOperation creates a new garbage collection operation in the cluster

func (*Router) CreateClusterReconfigureOperation

func (r *Router) CreateClusterReconfigureOperation(ctx context.Context, req ops.CreateClusterReconfigureOperationRequest) (*ops.SiteOperationKey, error)

CreateClusterReconfigureOperation creates a new cluster reconfiguration operation.

func (*Router) CreateInstallToken

func (r *Router) CreateInstallToken(req ops.NewInstallTokenRequest) (*storage.InstallToken, error)

func (*Router) CreateLogEntry

func (r *Router) CreateLogEntry(key ops.SiteOperationKey, entry ops.LogEntry) error

func (*Router) CreateLogForwarder

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

CreateLogForwarder creates a new log forwarder

func (*Router) CreateOperationPlan

func (r *Router) CreateOperationPlan(key ops.SiteOperationKey, plan storage.OperationPlan) error

CreateOperationPlan saves the provided operation plan

func (*Router) CreateOperationPlanChange

func (r *Router) CreateOperationPlanChange(key ops.SiteOperationKey, change storage.PlanChange) error

CreateOperationPlanChange creates a new changelog entry for a plan

func (*Router) CreateProgressEntry

func (r *Router) CreateProgressEntry(key ops.SiteOperationKey, entry ops.ProgressEntry) error

func (*Router) CreateProvisioningToken

func (r *Router) CreateProvisioningToken(token storage.ProvisioningToken) error

func (*Router) CreateSite

func (r *Router) CreateSite(req ops.NewSiteRequest) (*ops.Site, error)

func (*Router) CreateSiteAppUpdateOperation

func (r *Router) CreateSiteAppUpdateOperation(ctx context.Context, req ops.CreateSiteAppUpdateOperationRequest) (*ops.SiteOperationKey, error)

func (*Router) CreateSiteExpandOperation

func (r *Router) CreateSiteExpandOperation(ctx context.Context, req ops.CreateSiteExpandOperationRequest) (*ops.SiteOperationKey, error)

func (*Router) CreateSiteInstallOperation

func (r *Router) CreateSiteInstallOperation(ctx context.Context, req ops.CreateSiteInstallOperationRequest) (*ops.SiteOperationKey, error)

func (*Router) CreateSiteShrinkOperation

func (r *Router) CreateSiteShrinkOperation(ctx context.Context, req ops.CreateSiteShrinkOperationRequest) (*ops.SiteOperationKey, error)

func (*Router) CreateSiteUninstallOperation

func (r *Router) CreateSiteUninstallOperation(ctx context.Context, req ops.CreateSiteUninstallOperationRequest) (*ops.SiteOperationKey, error)

func (*Router) CreateUpdateConfigOperation

func (r *Router) CreateUpdateConfigOperation(ctx context.Context, req ops.CreateUpdateConfigOperationRequest) (*ops.SiteOperationKey, error)

CreateUpdateConfigOperation creates a new operation to update cluster configuration

func (*Router) CreateUpdateEnvarsOperation

func (r *Router) CreateUpdateEnvarsOperation(ctx context.Context, req ops.CreateUpdateEnvarsOperationRequest) (*ops.SiteOperationKey, error)

CreateUpdateEnvarsOperation creates a new operation to update cluster runtime environment variables

func (*Router) CreateUser

func (r *Router) CreateUser(req ops.NewUserRequest) error

func (*Router) CreateUserInvite

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

CreateUserInvite creates a new invite token for a user.

func (*Router) CreateUserReset

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

CreateUserReset creates a new reset token for a user.

func (*Router) DeactivateSite

func (r *Router) DeactivateSite(req ops.DeactivateSiteRequest) error

func (*Router) DeleteAPIKey

func (r *Router) DeleteAPIKey(ctx context.Context, userEmail, token string) error

func (*Router) DeleteAlert

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

DeleteAlert deletes the monitoring alert specified with name

func (*Router) DeleteAlertTarget

func (r *Router) DeleteAlertTarget(ctx context.Context, key ops.SiteKey) error

DeleteAlertTarget deletes the cluster monitoring alert target

func (*Router) DeleteClusterCertificate

func (r *Router) DeleteClusterCertificate(ctx context.Context, key ops.SiteKey) error

DeleteClusterCertificate deletes the cluster certificate

func (*Router) DeleteGithubConnector

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

DeleteGithubConnector deletes a Github connector by name

func (*Router) DeleteLocalUser

func (r *Router) DeleteLocalUser(name string) error

func (*Router) DeleteLogForwarder

func (r *Router) DeleteLogForwarder(ctx context.Context, key ops.SiteKey, forwarderName string) error

DeleteLogForwarder deletes a log forwarder

func (*Router) DeleteSMTPConfig

func (r *Router) DeleteSMTPConfig(ctx context.Context, key ops.SiteKey) error

DeleteSMTPConfig deletes the cluster SMTP configuration

func (*Router) DeleteSite

func (r *Router) DeleteSite(siteKey ops.SiteKey) error

func (*Router) DeleteSiteOperation

func (r *Router) DeleteSiteOperation(key ops.SiteOperationKey) error

func (*Router) DeleteUser

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

DeleteUser deletes a user by name

func (*Router) DeleteUserInvite

func (r *Router) DeleteUserInvite(ctx context.Context, req ops.DeleteUserInviteRequest) error

DeleteUserInvite deletes the specified user invite.

func (*Router) EmitAuditEvent

func (r *Router) EmitAuditEvent(ctx context.Context, req ops.AuditEventRequest) error

EmitAuditEvent saves the provided event in the audit log.

func (*Router) GetAPIKeys

func (r *Router) GetAPIKeys(userEmail string) ([]storage.APIKey, error)

func (*Router) GetAccount

func (r *Router) GetAccount(accountID string) (*ops.Account, error)

func (*Router) GetAccounts

func (r *Router) GetAccounts() ([]ops.Account, error)

func (*Router) GetAlertTargets

func (r *Router) GetAlertTargets(key ops.SiteKey) ([]storage.AlertTarget, error)

GetAlertTargets returns a list of monitoring alert targets

func (*Router) GetAlerts

func (r *Router) GetAlerts(key ops.SiteKey) ([]storage.Alert, error)

GetAlerts returns a list of monitoring alerts

func (*Router) GetAppInstaller

func (r *Router) GetAppInstaller(req ops.AppInstallerRequest) (io.ReadCloser, error)

func (*Router) GetApplicationEndpoints

func (r *Router) GetApplicationEndpoints(key ops.SiteKey) ([]ops.Endpoint, error)

func (*Router) GetAuthGateway

func (r *Router) GetAuthGateway(key ops.SiteKey) (storage.AuthGateway, error)

GetAuthGateway returns auth gateway configuration.

func (*Router) GetClusterAgent

func (r *Router) GetClusterAgent(req ops.ClusterAgentRequest) (*storage.LoginEntry, error)

func (*Router) GetClusterAuthPreference

func (r *Router) GetClusterAuthPreference(key ops.SiteKey) (teleservices.AuthPreference, error)

GetClusterAuthPreference returns cluster authentication preference

func (*Router) GetClusterCertificate

func (r *Router) GetClusterCertificate(key ops.SiteKey, withSecrets bool) (*ops.ClusterCertificate, error)

GetClusterCertificate returns the cluster certificate

func (*Router) GetClusterConfiguration

func (r *Router) GetClusterConfiguration(key ops.SiteKey) (clusterconfig.Interface, error)

GetClusterConfiguration retrieves the cluster configuration

func (*Router) GetClusterEnvironmentVariables

func (r *Router) GetClusterEnvironmentVariables(key ops.SiteKey) (storage.EnvironmentVariables, error)

GetClusterEnvironmentVariables retrieves the cluster runtime environment variables

func (*Router) GetClusterMetrics

func (r *Router) GetClusterMetrics(ctx context.Context, req ops.ClusterMetricsRequest) (*ops.ClusterMetricsResponse, error)

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

func (*Router) GetClusterNodes

func (r *Router) GetClusterNodes(key ops.SiteKey) ([]ops.Node, error)

GetClusterNodes returns a real-time information about cluster nodes

func (*Router) GetCurrentUser

func (r *Router) GetCurrentUser() (storage.User, error)

func (*Router) GetCurrentUserInfo

func (r *Router) GetCurrentUserInfo() (*ops.UserInfo, error)

func (*Router) GetExpandToken

func (r *Router) GetExpandToken(key ops.SiteKey) (*storage.ProvisioningToken, error)

func (*Router) GetGithubConnector

func (r *Router) 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 (*Router) GetGithubConnectors

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

GetGithubConnectors returns all Github connectors

Returned connectors exclude client secret unless withSecrets is true.

func (*Router) GetLocalOperator

func (r *Router) GetLocalOperator() ops.Operator

func (*Router) GetLocalSite

func (r *Router) GetLocalSite(ctx context.Context) (*ops.Site, error)

func (*Router) GetLocalUser

func (r *Router) GetLocalUser(key ops.SiteKey) (storage.User, error)

func (*Router) GetLogForwarders

func (r *Router) GetLogForwarders(key ops.SiteKey) ([]storage.LogForwarder, error)

GetLogForwarders returns a list of configured log forwarders

func (*Router) GetOperationPlan

func (r *Router) GetOperationPlan(key ops.SiteOperationKey) (*storage.OperationPlan, error)

GetOperationPlan returns plan for the specified operation

func (*Router) GetPersistentStorage

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

GetPersistentStorage retrieves cluster persistent storage configuration.

func (*Router) GetSMTPConfig

func (r *Router) GetSMTPConfig(key ops.SiteKey) (storage.SMTPConfig, error)

GetSMTPConfig returns the cluster SMTP configuration

func (*Router) GetSite

func (r *Router) GetSite(siteKey ops.SiteKey) (*ops.Site, error)

func (*Router) GetSiteByDomain

func (r *Router) GetSiteByDomain(domainName string) (*ops.Site, error)

func (*Router) GetSiteExpandOperationAgentReport

func (r *Router) GetSiteExpandOperationAgentReport(ctx context.Context, key ops.SiteOperationKey) (*ops.AgentReport, error)

func (*Router) GetSiteInstallOperationAgentReport

func (r *Router) GetSiteInstallOperationAgentReport(ctx context.Context, key ops.SiteOperationKey) (*ops.AgentReport, error)

func (*Router) GetSiteInstructions

func (r *Router) GetSiteInstructions(tokenID string, serverProfile string, params url.Values) (string, error)

func (*Router) GetSiteOperation

func (r *Router) GetSiteOperation(key ops.SiteOperationKey) (*ops.SiteOperation, error)

func (*Router) GetSiteOperationLogs

func (r *Router) GetSiteOperationLogs(key ops.SiteOperationKey) (io.ReadCloser, error)

func (*Router) GetSiteOperationProgress

func (r *Router) GetSiteOperationProgress(key ops.SiteOperationKey) (*ops.ProgressEntry, error)

func (*Router) GetSiteOperations

func (r *Router) GetSiteOperations(key ops.SiteKey, f ops.OperationsFilter) (ops.SiteOperations, error)

func (*Router) GetSiteReport

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

func (*Router) GetSites

func (r *Router) GetSites(accountID string) ([]ops.Site, error)

func (*Router) GetTrustedClusterToken

func (r *Router) GetTrustedClusterToken(key ops.SiteKey) (storage.Token, error)

func (*Router) GetUser

func (r *Router) GetUser(key ops.SiteKey, name string) (teleservices.User, error)

GetUser returns a user by name

func (*Router) GetUserInvites

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

GetUserInvites returns all active user invites.

func (*Router) GetUsers

func (r *Router) GetUsers(key ops.SiteKey) ([]teleservices.User, error)

GetUsers returns all users

func (*Router) GetVersion

func (r *Router) GetVersion(ctx context.Context) (*proto.Version, error)

GetVersion returns the gravity binary version information.

func (*Router) ListReleases

func (r *Router) ListReleases(req ops.ListReleasesRequest) ([]storage.Release, error)

ListReleases returns all currently installed application releases in a cluster.

func (*Router) PickClient

func (r *Router) PickClient(siteName string) (ops.Operator, error)

PickClient picks active client based on its state - if the site is installed, it picks remote tunnel HTTP client, otherwise it picks local ops center service

func (*Router) PickOperationClient

func (r *Router) PickOperationClient(siteName string) (ops.Operator, error)

PickOperationClient selects an appropriate operator service to perform a site operation

func (*Router) RemoteClient

func (r *Router) RemoteClient(siteName string) (ops.Operator, error)

func (*Router) ResetUserPassword

func (r *Router) ResetUserPassword(req ops.ResetUserPasswordRequest) (string, error)

func (*Router) ResumeShrink

func (r *Router) ResumeShrink(key ops.SiteKey) (*ops.SiteOperationKey, error)

func (*Router) RotatePlanetConfig

func (r *Router) RotatePlanetConfig(req ops.RotatePlanetConfigRequest) (*ops.RotatePackageResponse, error)

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

func (*Router) RotateSecrets

func (r *Router) RotateSecrets(req ops.RotateSecretsRequest) (*ops.RotatePackageResponse, error)

RotateSecrets rotates secrets package for the server specified in the request

func (*Router) RotateTeleportConfig

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

func (*Router) SetOperationState

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

func (*Router) SignSSHKey

func (r *Router) SignSSHKey(req ops.SSHSignRequest) (*ops.SSHSignResponse, error)

SignSSHKey signs SSH Public Key with SSH user certificate authority of this site

func (*Router) SignTLSKey

func (r *Router) SignTLSKey(req ops.TLSSignRequest) (*ops.TLSSignResponse, error)

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

func (*Router) SiteExpandOperationStart

func (r *Router) SiteExpandOperationStart(key ops.SiteOperationKey) error

func (*Router) SiteInstallOperationStart

func (r *Router) SiteInstallOperationStart(key ops.SiteOperationKey) error

func (*Router) StepDown

func (r *Router) StepDown(key ops.SiteKey) error

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

func (*Router) StreamOperationLogs

func (r *Router) 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 (*Router) UpdateAlert

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

UpdateAlert updates the specified monitoring alert

func (*Router) UpdateAlertTarget

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

UpdateAlertTarget updates the cluster monitoring alert target

func (*Router) UpdateClusterCertificate

func (r *Router) UpdateClusterCertificate(ctx context.Context, req ops.UpdateCertificateRequest) (*ops.ClusterCertificate, error)

UpdateClusterCertificate updates the cluster certificate

func (*Router) UpdateClusterConfiguration

func (r *Router) UpdateClusterConfiguration(req ops.UpdateClusterConfigRequest) error

UpdateClusterConfiguration updates the cluster configuration from the specified request

func (*Router) UpdateClusterEnvironmentVariables

func (r *Router) UpdateClusterEnvironmentVariables(req ops.UpdateClusterEnvironRequest) error

UpdateClusterEnvironmentVariables updates the cluster runtime environment variables from the specified request

func (*Router) UpdateExpandOperationState

func (r *Router) UpdateExpandOperationState(key ops.SiteOperationKey, req ops.OperationUpdateRequest) error

func (*Router) UpdateInstallOperationState

func (r *Router) UpdateInstallOperationState(key ops.SiteOperationKey, req ops.OperationUpdateRequest) (err error)

func (*Router) UpdateLogForwarder

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

UpdateLogForwarder updates an existing log forwarder

func (*Router) UpdatePersistentStorage

func (r *Router) UpdatePersistentStorage(ctx context.Context, req ops.UpdatePersistentStorageRequest) error

UpdatePersistentStorage updates persistent storage configuration.

func (*Router) UpdateSMTPConfig

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

UpdateSMTPConfig updates the cluster SMTP configuration

func (*Router) UpdateUser

func (r *Router) UpdateUser(ctx context.Context, req ops.UpdateUserRequest) error

UpdateUser updates the specified user information.

func (*Router) UpsertAuthGateway

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

UpsertAuthGateway updates auth gateway configuration.

func (*Router) UpsertClusterAuthPreference

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

UpsertClusterAuthPreference updates cluster authentication preference

func (*Router) UpsertGithubConnector

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

UpsertGithubConnector creates or updates a Github connector

func (*Router) UpsertUser

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

UpsertUser creates or updates a user

func (*Router) ValidateDomainName

func (r *Router) ValidateDomainName(domainName string) error

func (*Router) ValidateRemoteAccess

func (*Router) ValidateServers

ValidateServers runs pre-installation checks

func (*Router) WizardClient

func (r *Router) WizardClient(clusterName string) (ops.Operator, error)

WizardClient returns the operator client for an install wizard process that keeps a reverse tunnel to this Ops Center

If this process is install wizard itself, then local operator is returned.

type RouterConfig

type RouterConfig struct {
	// Backend is a storage backend
	Backend storage.Backend
	// Local is local ops service
	Local *opsservice.Operator
	// Wizard is true if this is an install wizard process
	Wizard bool
	// Clients provides access to clients for remote clusters such as operator or apps
	Clients *clients.ClusterClients
}

RouterConfig specifies config parameters for Router

Jump to

Keyboard shortcuts

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