Documentation ¶
Index ¶
- func ConfigMapMarker(ctx context.Context, kubeClient kubernetes.Interface, name string) (*corev1.ConfigMap, error)
- func DefaultWatchReactor(watchInterface watch.Interface, err error) testing.WatchReactionFunc
- func Restore(restore *cbv1alpha1.Restore, pref *cbv1alpha1.RestorePreference, ...) error
- func Snapshot(ctx context.Context, snapshot *cbv1alpha1.Snapshot) error
- func SnapshotWithClient(ctx context.Context, snapshot *cbv1alpha1.Snapshot, ...) error
- func UploadSnapshot(snapshot *cbv1alpha1.Snapshot, bucket objectstore.Objectstore) error
- type Cluster
- type Cmd
- type ObjectScheme
- type ObjectTracker
- type ServerResources
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 ¶
func Restore(restore *cbv1alpha1.Restore, pref *cbv1alpha1.RestorePreference, bucket objectstore.Objectstore) error
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 (*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) 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.
type ServerResources ¶ added in v0.5.0
type ServerResources struct {
// contains filtered or unexported fields
}
ServerResources holds informations of API resources
func (*ServerResources) GetResources ¶ added in v0.5.0
func (sr *ServerResources) GetResources() []*metav1.APIResourceList
GetResources returns server resources struct
func (*ServerResources) ResourceName ¶ added in v0.5.0
func (sr *ServerResources) ResourceName(gvk schema.GroupVersionKind) (string, error)
ResourceName get resource string from GroupVersionKind
func (*ServerResources) ResourcePath ¶ added in v0.5.0
func (sr *ServerResources) ResourcePath(item *unstructured.Unstructured) (string, error)
ResourcePath returns an API path of the resource