Documentation
¶
Overview ¶
Package migration provides functionality for data migration operations in Kubernetes. This package includes components for creating, running, and monitoring Kubernetes jobs that perform data import and migration tasks.
Index ¶
- Variables
- func IsFinalMigration(ctx context.Context) bool
- func Run(ctx context.Context, finalTimestampStr, regularCron string, ...) error
- func SetFinalMigration(ctx context.Context) context.Context
- func SetTriggerFQDNChange(ctx context.Context) context.Context
- func SetTriggerFQDNChangeFromEnv(ctx context.Context) context.Context
- func TriggerFQDNChange(ctx context.Context) bool
- type BackupSchedule
- type Component
- type Configuration
- type Dogu
- type DoguConfig
- type DoguExport
- type DoguStarter
- type DoguStopper
- type DoguVolume
- type DoguVolumeResizer
- type ExportModeValidator
- type ExportModeValidatorApiClient
- type FinalTimestamp
- type GlobalConfig
- type JobProviderDependencies
- type JobRunner
- type JobService
- type JobServiceDependencies
- type KeyValue
- type LogInitializer
- type MailSender
- type MaintenanceModeHandler
- type Migrator
- type MigratorDependencies
- type PVCGetter
- type SystemInfo
- type SystemInfoProvider
- type SystemInfoValidator
Constants ¶
This section is empty.
Variables ¶
var ErrExpiredTimestamp = errors.New("final migration timestamp is in the past")
Functions ¶
func IsFinalMigration ¶
func Run ¶ added in v0.0.3
Run is the main function to run the migration initiating the delta and final migration
func TriggerFQDNChange ¶
Types ¶
type BackupSchedule ¶ added in v0.0.3
type BackupSchedule struct {
// Name of the backup schedule.
Name string
// Schedule is defined as a cron expression.
Schedule string
}
BackupSchedule contains the configuration of a single backup schedule.
type Configuration ¶ added in v0.0.3
type Configuration struct {
// GlobalConfig is the global configuration of the exporter system.
GlobalConfig GlobalConfig
// DoguConfigs is the configuration of all installed dogus in the exporter system.
DoguConfigs []DoguConfig
// BackupSchedules is the configuration of all backup schedules in the exporter system.
BackupSchedules []BackupSchedule
}
Configuration contains the configuration of the exporter system.
type Dogu ¶ added in v0.0.3
type Dogu struct {
// Name holds the dogu name including the namespace delimited by a slash ("/").
Name string
// Version holds the dogu version.
Version string
// Volume contains data on the dogu's persistent storage.
Volume DoguVolume
}
Dogu contains data on a single installed dogu on the exporter side.
type DoguConfig ¶ added in v0.0.3
type DoguConfig struct {
// Name of the dogu.
Name string
// NormalConfig normal dogu configuration as KeyValue pairs
NormalConfig []KeyValue
// LocalConfig local dogu configuration as KeyValue pairs
LocalConfig []KeyValue
// SensitiveConfig sensitive dogu configuration as KeyValue pairs
SensitiveConfig []KeyValue
}
DoguConfig contains the configuration of a single dogu.
type DoguExport ¶ added in v0.0.3
type DoguExport struct {
// Dogu specifies the name of the Dogu to be exported.
Dogu string
// VolumePath specifies the file system path to the volume associated with the Dogu being exported.
VolumePath string
// ExporterPort defines the network port used by the exporter process for transferring data.
ExporterPort int
}
DoguExport contains data for exporting a Dogu, including its name, volume path, and exporter port configuration.
type DoguStarter ¶
type DoguStopper ¶
type DoguVolume ¶ added in v0.0.3
type DoguVolume struct {
// SizeInBytes contains the expected dogu volume size.
//
// While int32 (~2 Gibi bytes) is too small for comfort, int64 (~9 Exbi bytes) should suffice to accommodate the
// size of even the largest dogu volume.
SizeInBytes int64
}
DoguVolume contains data on the dogu's persistent storage.
type DoguVolumeResizer ¶ added in v0.0.2
type ExportModeValidator ¶
type ExportModeValidatorApiClient ¶
type ExportModeValidatorApiClient struct {
// contains filtered or unexported fields
}
func NewExportModeValidatorApiClient ¶
func NewExportModeValidatorApiClient(apiClient exportModeClient) *ExportModeValidatorApiClient
type FinalTimestamp ¶ added in v0.0.2
FinalTimestamp is the timestamp of the final migration.
func Now ¶ added in v0.0.2
func Now() FinalTimestamp
Now return a FinalTimestamp with the current time.
func ParseFinalTimestamp ¶ added in v0.0.2
func ParseFinalTimestamp(timestamp string) (FinalTimestamp, error)
ParseFinalTimestamp parses the provided string into a FinalTimestamp. The function expects a string in the RFC3339 format. An error is returned when parsing fails or the timestamp lies in the past. An empty string results in a FinalTimestamp with a zero value.
func (FinalTimestamp) Expired ¶ added in v0.0.2
func (ft FinalTimestamp) Expired() bool
Expired return the status whether the final timestamp is expired meaning the time now is bigger than the time of the final timestamp. When FinalTimeStamp is the zero value the timestamp expires immediately.
func (FinalTimestamp) IsZero ¶ added in v0.0.2
func (ft FinalTimestamp) IsZero() bool
IsZero reports whether the final timestamp is the zero value.
func (FinalTimestamp) String ¶ added in v0.0.2
func (ft FinalTimestamp) String() string
String converts FinalTimestamp into a string in RFC3339 format.
func (FinalTimestamp) WaitUntil ¶ added in v0.0.2
func (ft FinalTimestamp) WaitUntil(ctx context.Context)
WaitUntil waits until the final timestamp is reached. This method blocks until the timestamp is reached or the provided context is done.
func (FinalTimestamp) WaitUntilReady ¶ added in v0.0.2
func (ft FinalTimestamp) WaitUntilReady(ctx context.Context, ready func() bool)
WaitUntilReady waits until the final timestamp is reached and the provided ready function returns true. This method blocks until the timestamp is reached and ready or the provided context is done.
type GlobalConfig ¶ added in v0.0.3
type GlobalConfig []KeyValue
GlobalConfig contains the global configuration of the exporter system.
type JobProviderDependencies ¶
type JobProviderDependencies struct {
JobContainerConfig configuration.JobContainer
SSHConfig configuration.SSH
APIKey string
DoguVolumeBasePath string
PVCClient pvcClient
}
type JobService ¶
type JobService struct {
// contains filtered or unexported fields
}
JobService orchestrates the creation, execution, and monitoring of Kubernetes jobs It provides functionality to run jobs, watch their status, and retrieve their logs
func NewJobService ¶
func NewJobService(deps JobServiceDependencies) (*JobService, error)
NewJobService creates a new JobService with the provided dependencies It initializes the job provider and sets up the necessary functions for watching jobs and streaming logs Returns an error if the job provider cannot be created
func (JobService) Run ¶
func (j JobService) Run(ctx context.Context) (err error)
Run creates and executes a Kubernetes job, watches for its completion, and returns its logs It performs the following steps: 1. Creates a job specification using the job creator 2. Submits the job to the Kubernetes API 3. Sets up a watcher to monitor the job's status 4. Waits for the job to complete or fail 5. Retrieves and returns the job's logs
The method returns an io.ReadCloser containing the job logs if successful, or an error if any step in the process fails
type JobServiceDependencies ¶
type JobServiceDependencies struct {
JobProviderDependencies
JobClient jobClient
PodClient podClient
}
JobServiceDependencies contains all the dependencies required to create a JobService It includes dependencies for job creation, job client for interacting with Kubernetes jobs, and pod client for accessing pod information and logs
type KeyValue ¶ added in v0.0.3
type KeyValue struct {
// Key is the name of the configuration value.
Key string
// Value is the value of the configuration value.
Value string
}
KeyValue contains a key-value pair. This is used to represent configuration values.
type LogInitializer ¶
type LogInitializer interface {
InitializeWithLogFile() error
}
type MailSender ¶
type MaintenanceModeHandler ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func NewMigrator(dependencies MigratorDependencies) *Migrator
type MigratorDependencies ¶
type MigratorDependencies struct {
ExportModeValidator
SystemInfoProvider
SystemInfoValidator
DoguVolumeResizer
MaintenanceModeHandler
MailSender
LogInitializer
JobRunner
DoguStopper
DoguStarter
}
type PVCGetter ¶
type PVCGetter struct {
// contains filtered or unexported fields
}
func NewPVCGetter ¶
func NewPVCGetter(client v1.PersistentVolumeClaimInterface) *PVCGetter
type SystemInfo ¶ added in v0.0.3
type SystemInfo struct {
// FQDN contains the DNS name of the exporter systeḿ.
FQDN string
// IsMultinode indicates whether the exporter system is a classic CES or a multinode CES instance.
IsMultinode bool
// Dogus contains data on all installed dogus on the exporter side.
Dogus []Dogu
// Components contain data on all installed components on the exporter side.
Components []Component
}
SystemInfo contains data on vital data on the exporter side.
type SystemInfoProvider ¶ added in v0.0.2
type SystemInfoProvider interface {
GetExporterSystemInfo(ctx context.Context) (*SystemInfo, error)
GetImporterSystemInfo(ctx context.Context) (*SystemInfo, error)
}
type SystemInfoValidator ¶
type SystemInfoValidator interface {
Validate(ctx context.Context, exporterInfo *SystemInfo, importerInfo *SystemInfo) error
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sync provides functions to copy data from the exporter system to the importer system (where this application is running).
|
Package sync provides functions to copy data from the exporter system to the importer system (where this application is running). |