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 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 DoguStarter
- type DoguStopper
- type DoguVolumeResizer
- type ExportModeValidator
- type ExportModeValidatorApiClient
- type FinalTimestamp
- type JobProviderDependencies
- type JobRunner
- type JobService
- type JobServiceDependencies
- type LogInitializer
- type LogWriter
- type MailSender
- type MaintenanceModeHandler
- type Migrator
- type MigratorDependencies
- type PVCGetter
- 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 TriggerFQDNChange ¶
Types ¶
type DoguStarter ¶
type DoguStopper ¶
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 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) (jobLogs io.ReadCloser, 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 LogInitializer ¶
type LogInitializer interface {
InitializeWithLogFile() error
}
type LogWriter ¶
type LogWriter interface {
Write(io.ReadCloser) 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
LogWriter
LogInitializer
JobRunner
DoguStopper
DoguStarter
}
type PVCGetter ¶
type PVCGetter struct {
// contains filtered or unexported fields
}
func NewPVCGetter ¶
func NewPVCGetter(client v1.PersistentVolumeClaimInterface) *PVCGetter
type SystemInfoProvider ¶ added in v0.0.2
type SystemInfoProvider interface {
GetExporterSystemInfo(ctx context.Context) (*exporter.SystemInfo, error)
GetImporterSystemInfo(ctx context.Context) (*exporter.SystemInfo, error)
}
type SystemInfoValidator ¶
type SystemInfoValidator interface {
Validate(ctx context.Context, exporterInfo *exporter.SystemInfo, importerInfo *exporter.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). |