migrations

package
v0.0.0-...-db62745 Latest Latest
Warning

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

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

Documentation

Overview

Package migrations organises required migrations of eirini managed k8s objects

Index

Constants

View Source
const (
	AdjustCPUResourceSequenceID = 1
	AdoptPDBSequenceID          = 2
	AdoptStSetSecretSequenceID  = 3
	AdoptJobSecretSequenceID    = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjustCPURequest

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

func NewAdjustCPURequest

func NewAdjustCPURequest(cpuRequestSetter CPURequestSetter) AdjustCPURequest

func (AdjustCPURequest) AppliesTo

func (m AdjustCPURequest) AppliesTo() ObjectType

func (AdjustCPURequest) Apply

func (AdjustCPURequest) SequenceID

func (m AdjustCPURequest) SequenceID() int

type AdoptJobRegistrySecret

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

func NewAdoptJobRegistrySecret

func NewAdoptJobRegistrySecret(secretsClient SecretsClient) AdoptJobRegistrySecret

func (AdoptJobRegistrySecret) AppliesTo

func (m AdoptJobRegistrySecret) AppliesTo() ObjectType

func (AdoptJobRegistrySecret) Apply

func (AdoptJobRegistrySecret) SequenceID

func (m AdoptJobRegistrySecret) SequenceID() int

type AdoptPDB

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

func NewAdoptPDB

func NewAdoptPDB(pdbClient PDBClient) AdoptPDB

func (AdoptPDB) AppliesTo

func (m AdoptPDB) AppliesTo() ObjectType

func (AdoptPDB) Apply

func (m AdoptPDB) Apply(ctx context.Context, obj runtime.Object) error

func (AdoptPDB) SequenceID

func (m AdoptPDB) SequenceID() int

type AdoptStatefulsetRegistrySecret

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

func NewAdoptStatefulsetRegistrySecret

func NewAdoptStatefulsetRegistrySecret(secretsClient SecretsClient) AdoptStatefulsetRegistrySecret

func (AdoptStatefulsetRegistrySecret) AppliesTo

func (AdoptStatefulsetRegistrySecret) Apply

func (AdoptStatefulsetRegistrySecret) SequenceID

func (m AdoptStatefulsetRegistrySecret) SequenceID() int

type AnnotationSetter

type AnnotationSetter interface {
	SetAnnotation(ctx context.Context, obj runtime.Object, key, value string) (runtime.Object, error)
}

type CPURequestSetter

type CPURequestSetter interface {
	SetCPURequest(ctx context.Context, stSet *appsv1.StatefulSet, cpuRequest *resource.Quantity) (*appsv1.StatefulSet, error)
}

type Executor

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

func NewExecutor

func NewExecutor(stSetClient StatefulsetsClient, jobsClient JobsClient, migrationStepProvider MigrationProvider) *Executor

func (*Executor) Migrate

func (e *Executor) Migrate(ctx context.Context, logger lager.Logger) error

type JobsClient

type JobsClient interface {
	SetAnnotation(ctx context.Context, job *batchv1.Job, key, value string) (*batchv1.Job, error)
	List(ctx context.Context, includeCompleted bool) ([]batchv1.Job, error)
}

type MigrationProvider

type MigrationProvider interface {
	Provide() []MigrationStep
	GetLatestMigrationIndex() int
}

func CreateMigrationStepsProvider

func CreateMigrationStepsProvider(stSetClient *client.StatefulSet, pdbClient *client.PodDisruptionBudget, secretsClient *client.Secret, workloadsNamespace string) MigrationProvider

type MigrationStep

type MigrationStep interface {
	Apply(ctx context.Context, obj runtime.Object) error
	SequenceID() int
	AppliesTo() ObjectType
}

type MigrationStepsProvider

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

func NewMigrationStepsProvider

func NewMigrationStepsProvider(migrationSteps []MigrationStep) MigrationStepsProvider

func (MigrationStepsProvider) GetLatestMigrationIndex

func (p MigrationStepsProvider) GetLatestMigrationIndex() int

func (MigrationStepsProvider) Provide

func (p MigrationStepsProvider) Provide() []MigrationStep

type ObjectType

type ObjectType string
const (
	StatefulSetObjectType ObjectType = "StatefulSet"
	JobObjectType         ObjectType = "Job"
)

type PDBClient

type PDBClient interface {
	Get(ctx context.Context, namespace, name string) (*v1beta1.PodDisruptionBudget, error)
	SetOwner(ctx context.Context, pdb *v1beta1.PodDisruptionBudget, owner *appsv1.StatefulSet) (*v1beta1.PodDisruptionBudget, error)
}

type SecretsClient

type SecretsClient interface {
	Get(ctx context.Context, namespace, name string) (*corev1.Secret, error)
	SetOwner(ctx context.Context, secret *corev1.Secret, owner metav1.Object) (*corev1.Secret, error)
}

type StatefulsetsClient

type StatefulsetsClient interface {
	GetBySourceType(ctx context.Context, sourceType string) ([]appsv1.StatefulSet, error)
	SetAnnotation(ctx context.Context, statefulSet *appsv1.StatefulSet, key, value string) (*appsv1.StatefulSet, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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