snapshot

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package snapshot is the snapshot of cluster

Index

Constants

This section is empty.

Variables

View Source
var ErrNotHandled = fmt.Errorf("resource not handled")

ErrNotHandled is returned when a resource is not handled

View Source
var Resources = []string{
	"namespace",
	"node",
	"serviceaccount",
	"configmap",
	"secret",
	"limitrange",
	"runtimeclass.node.k8s.io",
	"priorityclass.scheduling.k8s.io",
	"clusterrolebindings.rbac.authorization.k8s.io",
	"clusterroles.rbac.authorization.k8s.io",
	"rolebindings.rbac.authorization.k8s.io",
	"roles.rbac.authorization.k8s.io",
	"daemonset.apps",
	"deployment.apps",
	"replicaset.apps",
	"statefulset.apps",
	"cronjob.batch",
	"job.batch",
	"persistentvolumeclaim",
	"persistentvolume",
	"pod",
	"service",
	"endpoints",
}

Resources is the resources of cluster want to save or restore The resource string format adheres to a GVR template. - a single string like "node" will be parsed as {resource: node} - a two-section string like "daemonset.apps" will be parsed as {resource: dasemonset, group: apps} - a three-section (or 3+) string like "foo.v1alpha1.example.com" will be parsed as {resource: foo, version: v1alpha1, group: example.com} list all resources can use: kubectl api-resources -o name

Functions

This section is empty.

Types

type LoadConfig added in v0.5.0

type LoadConfig struct {
	Clientset client.Clientset
	Filters   []*meta.RESTMapping
	NoFilers  bool
}

LoadConfig is the a combination of the impersonation config

type Loader added in v0.5.0

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

Loader loads the resources to cluster This way does not delete existing resources in the cluster, which will handle the ownerReference so that the resources remain relative to each other

func NewLoader added in v0.5.0

func NewLoader(loadConfig LoadConfig) (*Loader, error)

NewLoader creates a new snapshot Loader.

func (*Loader) Load added in v0.5.0

func (l *Loader) Load(ctx context.Context, decoder *yaml.Decoder) error

Load loads the resources to cluster

type PagerConfig added in v0.3.0

type PagerConfig struct {
	PageSize       int64
	PageBufferSize int32
}

PagerConfig is the configuration of the list pager. It defines the page size and the page buffer size of the list pager.

type SaveConfig added in v0.3.0

type SaveConfig struct {
	Clientset   client.Clientset
	PagerConfig *PagerConfig
	Filters     []*meta.RESTMapping
}

SaveConfig is the a combination of the impersonation config and the PagerConfig.

type Saver added in v0.5.0

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

Saver is a snapshot saver.

func NewSaver added in v0.5.0

func NewSaver(saveConfig SaveConfig) (*Saver, error)

NewSaver creates a new snapshot saver.

func (*Saver) Record added in v0.5.0

func (s *Saver) Record(ctx context.Context, encoder *yaml.Encoder, tracks map[*meta.RESTMapping]*TrackData) error

Record records the snapshot of cluster.

func (*Saver) Save added in v0.5.0

func (s *Saver) Save(ctx context.Context, encoder *yaml.Encoder, tracks map[*meta.RESTMapping]*TrackData) error

Save saves the snapshot of cluster

type TrackData added in v0.5.0

type TrackData struct {
	Data            map[log.ObjectRef]json.RawMessage
	ResourceVersion string
}

Jump to

Keyboard shortcuts

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