supervisor

package
v0.65.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWATClient added in v0.45.0

type AWATClient interface {
	CreateTranslation(translationRequest *awat.TranslationRequest) (*awat.TranslationStatus, error)
	GetTranslationStatus(translationID string) (*awat.TranslationStatus, error)
	GetTranslationStatusesByInstallation(installationID string) ([]*awat.TranslationStatus, error)
	GetAllTranslations() ([]*awat.TranslationStatus, error)

	GetTranslationReadyToImport(request *awat.ImportWorkRequest) (*awat.ImportStatus, error)
	GetImportStatusesByInstallation(installationID string) ([]*awat.ImportStatus, error)
	GetImportStatusesByTranslation(translationID string) ([]*awat.ImportStatus, error)
	ListImports() ([]*awat.ImportStatus, error)
	GetImportStatus(importID string) (*awat.ImportStatus, error)

	CompleteImport(completed *awat.ImportCompletedWorkRequest) error
	ReleaseLockOnImport(importID string) error
}

AWATClient is the programmatic interface to the AWAT API.

type BackupProvisioner added in v0.44.0

type BackupProvisioner interface {
	TriggerBackup(backupMeta *model.InstallationBackup, cluster *model.Cluster, installation *model.Installation) (*model.S3DataResidence, error)
	CheckBackupStatus(backupMeta *model.InstallationBackup, cluster *model.Cluster) (int64, error)
	CleanupBackupJob(backup *model.InstallationBackup, cluster *model.Cluster) error
}

BackupProvisioner provisions backup jobs on a cluster.

type BackupSupervisor added in v0.44.0

type BackupSupervisor struct {
	// contains filtered or unexported fields
}

BackupSupervisor finds backup pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewBackupSupervisor added in v0.44.0

func NewBackupSupervisor(
	store installationBackupStore,
	backupOperator BackupProvisioner,
	aws aws.AWS,
	instanceID string,
	logger log.FieldLogger) *BackupSupervisor

NewBackupSupervisor creates a new BackupSupervisor.

func (*BackupSupervisor) Do added in v0.44.0

func (s *BackupSupervisor) Do() error

Do looks for work to be done on any pending backups and attempts to schedule the required work.

func (*BackupSupervisor) Shutdown added in v0.44.0

func (s *BackupSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the backup supervisor.

func (*BackupSupervisor) Supervise added in v0.44.0

func (s *BackupSupervisor) Supervise(backup *model.InstallationBackup)

Supervise schedules the required work on the given backup.

type ClusterInstallationSupervisor

type ClusterInstallationSupervisor struct {
	// contains filtered or unexported fields
}

ClusterInstallationSupervisor finds cluster installations pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewClusterInstallationSupervisor

func NewClusterInstallationSupervisor(store clusterInstallationStore, clusterInstallationProvisioner clusterInstallationProvisioner, aws aws.AWS, eventsProducer eventProducer, instanceID string, logger log.FieldLogger, metrics *metrics.CloudMetrics) *ClusterInstallationSupervisor

NewClusterInstallationSupervisor creates a new ClusterInstallationSupervisor.

func (*ClusterInstallationSupervisor) Do

Do looks for work to be done on any pending cluster installations and attempts to schedule the required work.

func (*ClusterInstallationSupervisor) Shutdown added in v0.20.0

func (s *ClusterInstallationSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the cluster installation supervisor.

func (*ClusterInstallationSupervisor) Supervise

func (s *ClusterInstallationSupervisor) Supervise(clusterInstallation *model.ClusterInstallation)

Supervise schedules the required work on the given cluster installation.

type ClusterSupervisor

type ClusterSupervisor struct {
	// contains filtered or unexported fields
}

ClusterSupervisor finds clusters pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewClusterSupervisor

func NewClusterSupervisor(store clusterStore, clusterProvisioner clusterProvisioner, aws aws.AWS, eventProducer eventProducer, instanceID string, logger log.FieldLogger) *ClusterSupervisor

NewClusterSupervisor creates a new ClusterSupervisor.

func (*ClusterSupervisor) Do

func (s *ClusterSupervisor) Do() error

Do looks for work to be done on any pending clusters and attempts to schedule the required work.

func (*ClusterSupervisor) Shutdown added in v0.20.0

func (s *ClusterSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the cluster supervisor.

func (*ClusterSupervisor) Supervise

func (s *ClusterSupervisor) Supervise(cluster *model.Cluster)

Supervise schedules the required work on the given cluster.

type DBMigrationSupervisor added in v0.45.0

type DBMigrationSupervisor struct {
	// contains filtered or unexported fields
}

DBMigrationSupervisor finds pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewInstallationDBMigrationSupervisor added in v0.45.0

func NewInstallationDBMigrationSupervisor(
	store installationDBMigrationStore,
	aws aws.AWS,
	dbProvider databaseProvider,
	instanceID string,
	provisioner dbMigrationCIProvisioner,
	eventsProducer eventProducer,
	logger log.FieldLogger) *DBMigrationSupervisor

NewInstallationDBMigrationSupervisor creates a new DBMigrationSupervisor.

func (*DBMigrationSupervisor) Do added in v0.45.0

func (s *DBMigrationSupervisor) Do() error

Do looks for work to be done on any pending backups and attempts to schedule the required work.

func (*DBMigrationSupervisor) Shutdown added in v0.45.0

func (s *DBMigrationSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the supervisor.

func (*DBMigrationSupervisor) Supervise added in v0.45.0

Supervise schedules the required work on the given backup.

type DNSManager added in v0.59.0

type DNSManager struct {
	// contains filtered or unexported fields
}

DNSManager wraps multiple InstallationDNSProviders.

func NewDNSManager added in v0.59.0

func NewDNSManager() *DNSManager

NewDNSManager creates new DNSManager without any providers.

func (*DNSManager) AddProvider added in v0.59.0

func (dm *DNSManager) AddProvider(provider InstallationDNSProvider)

AddProvider adds InstallationDNSProvider to the DNSManager.

func (*DNSManager) CreateDNSRecords added in v0.59.0

func (dm *DNSManager) CreateDNSRecords(customerDNSName []string, dnsEndpoints []string, logger logrus.FieldLogger) error

CreateDNSRecords creates DNS records with all registered providers.

func (*DNSManager) DeleteDNSRecords added in v0.59.0

func (dm *DNSManager) DeleteDNSRecords(customerDNSName []string, logger logrus.FieldLogger) error

DeleteDNSRecords deletes DNS record from all registered providers.

func (*DNSManager) IsValid added in v0.59.0

func (dm *DNSManager) IsValid() error

IsValid verifies if DNS providers are registered with DNSManager.

type Doer

type Doer interface {
	Do() error
	Shutdown()
}

Doer describes an action to be done.

type GroupSupervisor added in v0.18.0

type GroupSupervisor struct {
	// contains filtered or unexported fields
}

GroupSupervisor finds installations belonging to groups that need to have their configuration reconciled to match a new group configuration setting.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewGroupSupervisor added in v0.18.0

func NewGroupSupervisor(store groupStore, eventsProducer eventProducer, instanceID string, logger log.FieldLogger) *GroupSupervisor

NewGroupSupervisor creates a new GroupSupervisor.

func (*GroupSupervisor) Do added in v0.18.0

func (s *GroupSupervisor) Do() error

Do looks for work to be done on any pending groups and attempts to schedule the required work.

func (*GroupSupervisor) Shutdown added in v0.20.0

func (s *GroupSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the group supervisor.

func (*GroupSupervisor) Supervise added in v0.18.0

func (s *GroupSupervisor) Supervise(group *model.Group)

Supervise schedules the required work on the given group.

type ImportSupervisor added in v0.45.0

type ImportSupervisor struct {
	ID string
	// contains filtered or unexported fields
}

ImportSupervisor is a supervisor which performs Workspace Imports from ready Imports produced by the AWAT. It periodically queries the AWAT for Imports waiting to be performed and then performs imports serially

func NewImportSupervisor added in v0.45.0

func NewImportSupervisor(awsClient toolsAWS.AWS, awat AWATClient, store importStore, provisioner importProvisioner, eventsProducer eventProducer, logger logrus.FieldLogger) *ImportSupervisor

NewImportSupervisor creates a new Import Supervisor

func (*ImportSupervisor) Do added in v0.45.0

func (s *ImportSupervisor) Do() error

Do checks to see if there is an Import that is ready to be imported, and if so, does that. Otherwise, it does nothing.

func (*ImportSupervisor) Shutdown added in v0.45.0

func (s *ImportSupervisor) Shutdown()

Shutdown is called when the ImportSupervisor is stopped. TODO change Shutdown from a no-op to allowing it to unlock ongoing Imports so that they are detected as interrupted by the AWAT and can be re-served to another Provisioner instance as a cleaner retry pattern

type InstallationDBRestorationSupervisor added in v0.45.0

type InstallationDBRestorationSupervisor struct {
	// contains filtered or unexported fields
}

InstallationDBRestorationSupervisor finds pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewInstallationDBRestorationSupervisor added in v0.45.0

func NewInstallationDBRestorationSupervisor(
	store installationDBRestorationStore,
	aws aws.AWS,
	restoreOperator restoreOperator,
	eventsProducer eventProducer,
	instanceID string,
	logger log.FieldLogger) *InstallationDBRestorationSupervisor

NewInstallationDBRestorationSupervisor creates a new InstallationDBRestorationSupervisor.

func (*InstallationDBRestorationSupervisor) Do added in v0.45.0

Do looks for work to be done on any pending restoration operations and attempts to schedule the required work.

func (*InstallationDBRestorationSupervisor) Shutdown added in v0.45.0

Shutdown performs graceful shutdown tasks for the supervisor.

func (*InstallationDBRestorationSupervisor) Supervise added in v0.45.0

Supervise schedules the required work on the given restoration.

type InstallationDNSProvider added in v0.59.0

type InstallationDNSProvider interface {
	CreateDNSRecords(customerDNSName []string, dnsEndpoints []string, logger log.FieldLogger) error
	DeleteDNSRecords(customerDNSName []string, logger log.FieldLogger) error
}

InstallationDNSProvider is an interface over DNS provider.

type InstallationDeletionSupervisor added in v0.60.0

type InstallationDeletionSupervisor struct {
	// contains filtered or unexported fields
}

InstallationDeletionSupervisor finds installations pending deletion and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewInstallationDeletionSupervisor added in v0.60.0

func NewInstallationDeletionSupervisor(
	instanceID string,
	deletionPendingTime time.Duration,
	currentlyUpdatingLimit int64,
	store installationDeletionStore,
	eventsProducer eventProducer,
	logger log.FieldLogger) *InstallationDeletionSupervisor

NewInstallationDeletionSupervisor creates a new InstallationDeletionSupervisor.

func (*InstallationDeletionSupervisor) Do added in v0.60.0

Do looks for work to be done on any pending installations and attempts to schedule the required work.

func (*InstallationDeletionSupervisor) Shutdown added in v0.60.0

func (s *InstallationDeletionSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the installation deletion supervisor.

func (*InstallationDeletionSupervisor) Supervise added in v0.60.0

func (s *InstallationDeletionSupervisor) Supervise(installation *model.Installation)

Supervise schedules the required work on the given installation.

type InstallationSupervisor

type InstallationSupervisor struct {
	// contains filtered or unexported fields
}

InstallationSupervisor finds installations pending work and effects the required changes.

The degree of parallelism is controlled by a weighted semaphore, intended to be shared with other clients needing to coordinate background jobs.

func NewInstallationSupervisor

func NewInstallationSupervisor(
	store installationStore,
	installationProvisioner installationProvisioner,
	aws aws.AWS,
	instanceID string,
	keepDatabaseData,
	keepFilestoreData bool,
	scheduling InstallationSupervisorSchedulingOptions,
	resourceUtil *utils.ResourceUtil,
	logger log.FieldLogger,
	metrics *metrics.CloudMetrics,
	eventsProducer eventProducer,
	forceCRUpgrade bool,
	dnsProvider InstallationDNSProvider,
	disableDNSUpdates bool) *InstallationSupervisor

NewInstallationSupervisor creates a new InstallationSupervisor.

func (*InstallationSupervisor) Do

func (s *InstallationSupervisor) Do() error

Do looks for work to be done on any pending installations and attempts to schedule the required work.

func (*InstallationSupervisor) Shutdown added in v0.20.0

func (s *InstallationSupervisor) Shutdown()

Shutdown performs graceful shutdown tasks for the installation supervisor.

func (*InstallationSupervisor) Supervise

func (s *InstallationSupervisor) Supervise(installation *model.Installation)

Supervise schedules the required work on the given installation.

type InstallationSupervisorCache added in v0.54.1

type InstallationSupervisorCache struct {
	// contains filtered or unexported fields
}

InstallationSupervisorCache contains configuration and cached data for cluster resources.

type InstallationSupervisorSchedulingOptions added in v0.35.0

type InstallationSupervisorSchedulingOptions struct {
	BalanceInstallations               bool
	ClusterResourceThresholdCPU        int
	ClusterResourceThresholdMemory     int
	ClusterResourceThresholdPodCount   int
	ClusterResourceThresholdScaleValue int
}

InstallationSupervisorSchedulingOptions are the various options that control how installation scheduling occurs.

func NewInstallationSupervisorSchedulingOptions added in v0.35.0

func NewInstallationSupervisorSchedulingOptions(balanceInstallations bool, clusterResourceThreshold, thresholdCPUOverride, thresholdMemoryOverride, thresholdPodCountOverride, clusterResourceThresholdScaleValue int) InstallationSupervisorSchedulingOptions

NewInstallationSupervisorSchedulingOptions creates a new InstallationSupervisorSchedulingOptions.

func (*InstallationSupervisorSchedulingOptions) Validate added in v0.59.0

Validate validates InstallationSupervisorSchedulingOptions.

type MultiDoer

type MultiDoer []Doer

MultiDoer is a slice of doers.

func (MultiDoer) Do

func (md MultiDoer) Do() error

Do executes each doer in turn, returning the first error.

func (MultiDoer) Shutdown added in v0.20.0

func (md MultiDoer) Shutdown()

Shutdown tells each doer to perform shutdown tasks.

type Provisioner added in v0.64.0

type Provisioner interface {
	BackupProvisioner
	// contains filtered or unexported methods
}

Provisioner groups different provisioner interfaces.

type Route53DNSProvider added in v0.59.0

type Route53DNSProvider struct {
	// contains filtered or unexported fields
}

Route53DNSProvider wraps route53 function calls to implement InstallationDNSProvider interface.

func NewRoute53DNSProvider added in v0.59.0

func NewRoute53DNSProvider(aws aws.AWS) *Route53DNSProvider

NewRoute53DNSProvider creates Route53 Installation DNS Provider.

func (*Route53DNSProvider) CreateDNSRecords added in v0.59.0

func (r *Route53DNSProvider) CreateDNSRecords(customerDNSName []string, dnsEndpoints []string, logger logrus.FieldLogger) error

CreateDNSRecords creates or updates Route53 CNAME records.

func (*Route53DNSProvider) DeleteDNSRecords added in v0.59.0

func (r *Route53DNSProvider) DeleteDNSRecords(customerDNSName []string, logger logrus.FieldLogger) error

DeleteDNSRecords deletes Route53 CNAME records.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler schedules a doer for periodic, serial execution.

func NewScheduler

func NewScheduler(doer Doer, period time.Duration) *Scheduler

NewScheduler creates a new scheduler.

If the period is zero, the scheduler is never run, even if manually run. Otherwise, the period specifies how long to wait after its last successful execution.

func (*Scheduler) Close

func (s *Scheduler) Close() error

Close waits for any active doer to finish, terminates the main thread of the scheduler, and ensures the doer is no longer invoked.

func (*Scheduler) Do

func (s *Scheduler) Do() error

Do requests an execution of the scheduled doer.

The scheduler will never be run if the period is 0. If already running, the doer will be run again when done. Multiple calls to Notify while the doer is running will only trigger a single additional execution. Do never blocks.

Jump to

Keyboard shortcuts

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