Documentation ¶
Index ¶
- Constants
- func GroupRestoreExecHooks(resourceRestoreHooks []ResourceRestoreHook, pod *corev1api.Pod, ...) (map[string][]PodExecRestoreHook, error)
- type DefaultItemHookHandler
- type DefaultListWatchFactory
- type DefaultWaitExecHookHandler
- type InitContainerRestoreHookHandler
- type ItemHookHandler
- type ItemRestoreHookHandler
- type ListWatchFactory
- type PodExecRestoreHook
- type ResourceHook
- type ResourceHookSelector
- type ResourceRestoreHook
- type WaitExecHookHandler
Constants ¶
const ( PhasePre hookPhase = "pre" PhasePost hookPhase = "post" )
Variables ¶
This section is empty.
Functions ¶
func GroupRestoreExecHooks ¶
func GroupRestoreExecHooks( resourceRestoreHooks []ResourceRestoreHook, pod *corev1api.Pod, log logrus.FieldLogger, ) (map[string][]PodExecRestoreHook, error)
GroupRestoreExecHooks returns a list of hooks to be executed in a pod grouped by container name. If an exec hook is defined in annotation that is used, else applicable exec hooks from the restore resource are accumulated.
Types ¶
type DefaultItemHookHandler ¶
type DefaultItemHookHandler struct {
PodCommandExecutor podexec.PodCommandExecutor
}
DefaultItemHookHandler is the default itemHookHandler.
func (*DefaultItemHookHandler) HandleHooks ¶
func (h *DefaultItemHookHandler) HandleHooks( log logrus.FieldLogger, groupResource schema.GroupResource, obj runtime.Unstructured, resourceHooks []ResourceHook, phase hookPhase, ) error
type DefaultListWatchFactory ¶
func (*DefaultListWatchFactory) NewListWatch ¶
func (d *DefaultListWatchFactory) NewListWatch(namespace string, selector fields.Selector) cache.ListerWatcher
type DefaultWaitExecHookHandler ¶
type DefaultWaitExecHookHandler struct { ListWatchFactory ListWatchFactory PodCommandExecutor podexec.PodCommandExecutor }
func (*DefaultWaitExecHookHandler) HandleHooks ¶
func (e *DefaultWaitExecHookHandler) HandleHooks( ctx context.Context, log logrus.FieldLogger, pod *v1.Pod, byContainer map[string][]PodExecRestoreHook, ) []error
type InitContainerRestoreHookHandler ¶
type InitContainerRestoreHookHandler struct{}
InitContainerRestoreHookHandler is the restore hook handler to add init containers to restored pods.
func (*InitContainerRestoreHookHandler) HandleRestoreHooks ¶
func (i *InitContainerRestoreHookHandler) HandleRestoreHooks( log logrus.FieldLogger, groupResource schema.GroupResource, obj runtime.Unstructured, resourceRestoreHooks []ResourceRestoreHook, ) (runtime.Unstructured, error)
HandleRestoreHooks runs the restore hooks for an item. If the item is a pod, then hooks are chosen to be run as follows: If the pod has the appropriate annotations specifying the hook action, then hooks from the annotation are run Otherwise, the supplied ResourceRestoreHooks are applied.
type ItemHookHandler ¶
type ItemHookHandler interface { // HandleHooks invokes hooks for an item. If the item is a pod and the appropriate annotations exist // to specify a hook, that is executed. Otherwise, this looks at the backup context's Backup to // determine if there are any hooks relevant to the item, taking into account the hook spec's // namespaces, resources, and label selector. HandleHooks( log logrus.FieldLogger, groupResource schema.GroupResource, obj runtime.Unstructured, resourceHooks []ResourceHook, phase hookPhase, ) error }
ItemHookHandler invokes hooks for an item.
type ItemRestoreHookHandler ¶
type ItemRestoreHookHandler interface { HandleRestoreHooks( log logrus.FieldLogger, groupResource schema.GroupResource, obj runtime.Unstructured, rh []ResourceRestoreHook, ) (runtime.Unstructured, error) }
ItemRestoreHookHandler invokes restore hooks for an item
type ListWatchFactory ¶
type ListWatchFactory interface {
NewListWatch(namespace string, selector fields.Selector) cache.ListerWatcher
}
type PodExecRestoreHook ¶
type PodExecRestoreHook struct { HookName string HookSource string Hook velerov1api.ExecRestoreHook // contains filtered or unexported fields }
type ResourceHook ¶
type ResourceHook struct { Name string Selector ResourceHookSelector Pre []velerov1api.BackupResourceHook Post []velerov1api.BackupResourceHook }
ResourceHook is a hook for a given resource.
type ResourceHookSelector ¶
type ResourceHookSelector struct { Namespaces *collections.IncludesExcludes Resources *collections.IncludesExcludes LabelSelector labels.Selector }
type ResourceRestoreHook ¶
type ResourceRestoreHook struct { Name string Selector ResourceHookSelector RestoreHooks []velerov1api.RestoreResourceHook }
ResourceRestoreHook is a restore hook for a given resource.
func GetRestoreHooksFromSpec ¶
func GetRestoreHooksFromSpec(hooksSpec *velerov1api.RestoreHooks) ([]ResourceRestoreHook, error)
GetRestoreHooksFromSpec returns a list of ResourceRestoreHooks from the restore Spec.
type WaitExecHookHandler ¶
type WaitExecHookHandler interface { HandleHooks( ctx context.Context, log logrus.FieldLogger, pod *v1.Pod, byContainer map[string][]PodExecRestoreHook, ) []error }