migrate

package
v3.9.0-alpha.3+incompa... Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MigrateRecommendedName = "migrate"

Variables

View Source
var ErrRecalculate = fmt.Errorf("recalculate migration")

ErrRecalculate may be returned by MigrateActionFunc to indicate that the object has changed and needs to have its information recalculated prior to being saved. Use when a resource requires multiple API operations to persist (for instance, both status and spec must be changed).

View Source
var ErrUnchanged = fmt.Errorf("migration was not necessary")

ErrUnchanged may be returned by MigrateActionFunc to indicate that the object did not need migration (but that could only be determined when the action was taken).

View Source
var NotChanged = ReporterBool(false)

NotChanged is a Reporter returned by operations that are guaranteed to be read-only

Functions

func DefaultRetriable

func DefaultRetriable(info *resource.Info, err error) error

DefaultRetriable adds retry information to the provided error, and will refresh the info if the client info is stale. If the refresh fails the error is made fatal. All other errors are left in their natural state - they will not be retried unless they define a Temporary() method that returns true.

func NewCommandMigrate

func NewCommandMigrate(name, fullName string, f *clientcmd.Factory, out, errOut io.Writer, cmds ...*cobra.Command) *cobra.Command

Types

type ErrNotRetriable

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

ErrNotRetriable is a wrapper for an error that a migrator may use to indicate the specific error cannot be retried.

func (ErrNotRetriable) Temporary

func (ErrNotRetriable) Temporary() bool

type ErrRetriable

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

ErrRetriable is a wrapper for an error that a migrator may use to indicate the specific error can be retried.

func (ErrRetriable) Temporary

func (ErrRetriable) Temporary() bool

type MigrateActionFunc

type MigrateActionFunc func(info *resource.Info, reporter Reporter) error

MigrateActionFunc is expected to persist the altered info.Object. The Reporter returned from Visit is passed to this function and may be used to carry additional information about what to save on an object.

type MigrateFilterFunc

type MigrateFilterFunc func(info *resource.Info) (bool, error)

MigrateFilterFunc can return false to skip an item, or an error.

type MigrateVisitFunc

type MigrateVisitFunc func(info *resource.Info) (Reporter, error)

MigrateVisitFunc is invoked for each returned object, and may return a Reporter that can contain info to be used by save.

type Reporter

type Reporter interface {
	// Changed returns true if the resource requires migration.
	Changed() bool
}

Reporter indicates whether a resource requires migration.

func AlwaysRequiresMigration

func AlwaysRequiresMigration(_ *resource.Info) (Reporter, error)

type ReporterBool

type ReporterBool bool

ReporterBool implements the Reporter interface for a boolean.

func (ReporterBool) Changed

func (r ReporterBool) Changed() bool

type ResourceOptions

type ResourceOptions struct {
	In          io.Reader
	Out, ErrOut io.Writer

	Unstructured  bool
	AllNamespaces bool
	Include       []string
	Filenames     []string
	Confirm       bool
	Output        string
	FromKey       string
	ToKey         string

	OverlappingResources []sets.String
	DefaultExcludes      []schema.GroupResource

	Builder   *resource.Builder
	SaveFn    MigrateActionFunc
	PrintFn   MigrateActionFunc
	FilterFn  MigrateFilterFunc
	DryRun    bool
	Summarize bool
}

ResourceOptions assists in performing migrations on any object that can be retrieved via the API.

func (*ResourceOptions) Bind

func (o *ResourceOptions) Bind(c *cobra.Command)

func (*ResourceOptions) Complete

func (o *ResourceOptions) Complete(f *clientcmd.Factory, c *cobra.Command) error

func (*ResourceOptions) Validate

func (o *ResourceOptions) Validate() error

func (*ResourceOptions) Visitor

func (o *ResourceOptions) Visitor() *ResourceVisitor

type ResourceVisitor

type ResourceVisitor struct {
	Out io.Writer

	Builder *resource.Builder

	SaveFn   MigrateActionFunc
	PrintFn  MigrateActionFunc
	FilterFn MigrateFilterFunc

	DryRun bool
}

func (*ResourceVisitor) Visit

func (o *ResourceVisitor) Visit(fn MigrateVisitFunc) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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