migrator

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConversionError

type ConversionError struct {
	Cause   error
	KeyV1   model.Key
	ValueV1 interface{}
	KeyV3   model.Key
	ValueV3 converters.Resource
}

ConversionError contains details about a specific error converting a v1 resource to a v3 resource.

type ErrorType

type ErrorType int

Error types encountered during validation and migration.

const (
	ErrorGeneric ErrorType = iota
	ErrorConvertingData
	ErrorMigratingData
)

type Interface

type Interface interface {
	ValidateConversion() (*MigrationData, error)
	IsDestinationEmpty() (bool, error)
	ShouldMigrate() (bool, error)
	CanMigrate() error
	Migrate() (*MigrationData, error)
	IsMigrationInProgress() (bool, error)
	Abort() error
	Complete() error
}

Interface is the migration interface used for migrating data from version v2.x to v3.x.

func New

func New(clientv3 clientv3.Interface, clientv1 clients.V1ClientInterface, statusWriter StatusWriterInterface) Interface

New creates a new migration helper implementing Interface.

type MigrationData

type MigrationData struct {
	// The converted resources
	Resources []converters.Resource

	// The converted resource names
	NameConversions []NameConversion

	// Errors hit attempting to convert the v1 data to v3 format. The
	// KeyV3 and ValueV3 will be nil for these conversion errors.
	ConversionErrors []ConversionError

	// Errors hit validating the converted v3 data. This suggests an error in the
	// conversion script which should be fixed before reattempting the conversion.
	ConvertedResourceValidationErrors []ConversionError

	// Name clashes in the converted resources. These need to be resolved through
	// reconfiguration before attempting the upgrade.
	NameClashes []NameClash

	// Entries that were skipped because they will be handled by the Kubernetes
	// Policy controller.
	HandledByPolicyCtrl []model.Key
}

MigrationData includes details about data migrated using the migration helper.

func (*MigrationData) HasErrors

func (c *MigrationData) HasErrors() bool

HasErrors returns whether there are any errors contained in the MigrationData.

type MigrationError

type MigrationError struct {
	Err        error
	Type       ErrorType
	NeedsAbort bool
}

func (MigrationError) Error

func (m MigrationError) Error() string

type NameClash

type NameClash struct {
	KeyV1      model.Key
	KeyV3      model.Key
	OtherKeyV1 model.Key
}

NameClash contains details about name/id clashes (i.e. when two converted resource names (for the same resource type) clash.

type NameConversion

type NameConversion struct {
	KeyV1 model.Key
	KeyV3 model.Key
}

NameConversion contains details about name/id conversions.

type StatusWriterInterface

type StatusWriterInterface interface {
	Msg(string)
	Bullet(string)
	Error(string)
}

StatusWriterInterface is an optional interface supplied by the consumer of the migration helper used to record status of the migration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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