cluster

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMapMarker

func ConfigMapMarker(ctx context.Context, kubeClient kubernetes.Interface, name string) (*corev1.ConfigMap, error)

ConfigMapMarker creates and deletes a config map to get a marker for Resource Version

func DefaultWatchReactor

func DefaultWatchReactor(watchInterface watch.Interface, err error) testing.WatchReactionFunc

DefaultWatchReactor returns default watch action

func Restore

Restore k8s resources

func Snapshot

func Snapshot(ctx context.Context, snapshot *cbv1alpha1.Snapshot) error

Snapshot k8s resources

func SnapshotWithClient

func SnapshotWithClient(
	ctx context.Context,
	snapshot *cbv1alpha1.Snapshot,
	kubeClient kubernetes.Interface,
	dynamicClient dynamic.Interface) error

SnapshotWithClient takes a snapshot of k8s resources

func UploadSnapshot

func UploadSnapshot(snapshot *cbv1alpha1.Snapshot, bucket objectstore.Objectstore) error

UploadSnapshot uploads a snapshot tgz file to the bucket

Types

type Cluster

type Cluster interface {
	Snapshot(ctx context.Context, snapshot *cbv1alpha1.Snapshot) error
	UploadSnapshot(snapshot *cbv1alpha1.Snapshot, bucket objectstore.Objectstore) error
	Restore(restore *cbv1alpha1.Restore, pref *cbv1alpha1.RestorePreference, bucket objectstore.Objectstore) error
}

Cluster interfaces for taking and restoring snapshot of k8s clusters

type Cmd

type Cmd struct {
}

Cmd for execute cluster commands

func NewClusterCmd

func NewClusterCmd() *Cmd

NewClusterCmd returns new Cmd

func (*Cmd) Restore

func (c *Cmd) Restore(restore *cbv1alpha1.Restore, pref *cbv1alpha1.RestorePreference, bucket objectstore.Objectstore) error

Restore restores snapshot data on a cluster

func (*Cmd) Snapshot

func (c *Cmd) Snapshot(ctx context.Context, snapshot *cbv1alpha1.Snapshot) error

Snapshot take a snapshot

func (*Cmd) UploadSnapshot

func (c *Cmd) UploadSnapshot(snapshot *cbv1alpha1.Snapshot, bucket objectstore.Objectstore) error

UploadSnapshot uploads the snapshot data to the object store bucket

type ObjectScheme

type ObjectScheme interface {
	runtime.ObjectCreater
	runtime.ObjectTyper
}

ObjectScheme abstracts the implementation of common operations on objects.

type ObjectTracker

type ObjectTracker interface {
	// Add adds an object to the tracker. If object being added
	// is a list, its items are added separately.
	Add(obj runtime.Object) error

	// Get retrieves the object by its kind, namespace and name.
	Get(gvr schema.GroupVersionResource, ns, name string) (runtime.Object, error)

	// Create adds an object to the tracker in the specified namespace.
	Create(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error

	// Update updates an existing object in the tracker in the specified namespace.
	Update(gvr schema.GroupVersionResource, obj runtime.Object, ns string) error

	// List retrieves all objects of a given kind in the given
	// namespace. Only non-List kinds are accepted.
	List(gvr schema.GroupVersionResource, gvk schema.GroupVersionKind, ns string) (runtime.Object, error)

	// Delete deletes an existing object from the tracker. If object
	// didn't exist in the tracker prior to deletion, Delete returns
	// no error.
	Delete(gvr schema.GroupVersionResource, ns, name string) error

	// Watch watches objects from the tracker. Watch returns a channel
	// which will push added / modified / deleted object.
	Watch(gvr schema.GroupVersionResource, ns string) (watch.Interface, error)

	GetResourceVersion() uint64
}

ObjectTracker keeps track of objects. It is intended to be used to fake calls to a server by returning objects based on their kind, namespace and name.

func NewObjectTracker

func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder, rv uint64) ObjectTracker

NewObjectTracker returns an ObjectTracker that can be used to keep track of objects for the fake clientset. Mostly useful for unit tests.

Jump to

Keyboard shortcuts

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