orchestrators

package
v0.0.0-...-160a1fa Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectCattle

func DetectCattle() bool

DetectCattle returns true if the Volback is running on the orchestrator Cattle

func DetectDocker

func DetectDocker(config *DockerConfig) bool

DetectDocker tries to detect a Docker orchestrator by connecting to the endpoint

func DetectKubernetes

func DetectKubernetes() bool

DetectKubernetes returns true if Volback is running on the orchestrator Kubernetes

Types

type CattleConfig

type CattleConfig struct {
	URL       string
	AccessKey string
	SecretKey string
}

CattleConfig stores Cattle configuration

type CattleOrchestrator

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

CattleOrchestrator implements a container orchestrator for Cattle

func NewCattleOrchestrator

func NewCattleOrchestrator(config *CattleConfig) (o *CattleOrchestrator, err error)

NewCattleOrchestrator creates a Cattle client

func (*CattleOrchestrator) AttachOrphanAgent

func (o *CattleOrchestrator) AttachOrphanAgent(containerID, namespace string) (success bool, output string, err error)

AttachOrphanAgent connects to a running agent and wait for the end of the backup proccess

func (*CattleOrchestrator) ContainerExec

func (o *CattleOrchestrator) ContainerExec(mountedVolumes *volume.MountedVolume, command []string) (stdout string, err error)

ContainerExec executes a command in a container

func (*CattleOrchestrator) DeployAgent

func (o *CattleOrchestrator) DeployAgent(image string, cmd []string, envs []string, v *volume.Volume) (success bool, output string, err error)

DeployAgent creates a `volback agent` container

func (*CattleOrchestrator) GetContainersMountingVolume

func (o *CattleOrchestrator) GetContainersMountingVolume(v *volume.Volume) (mountedVolumes []*volume.MountedVolume, err error)

GetContainersMountingVolume returns containers mounting a volume

func (*CattleOrchestrator) GetName

func (*CattleOrchestrator) GetName() string

GetName returns the orchestrator name

func (*CattleOrchestrator) GetPath

func (*CattleOrchestrator) GetPath(v *volume.Volume) string

GetPath returns the backup path

func (*CattleOrchestrator) GetVolumes

func (o *CattleOrchestrator) GetVolumes(volumeFilters volume.Filters) (volumes []*volume.Volume, err error)

GetVolumes returns the Cattle volumes, inspected and filtered

func (*CattleOrchestrator) IsNodeAvailable

func (o *CattleOrchestrator) IsNodeAvailable(hostID string) (ok bool, err error)

IsNodeAvailable checks if the node is available to run backups on it

func (*CattleOrchestrator) RemoveContainer

func (o *CattleOrchestrator) RemoveContainer(container *client.Container)

RemoveContainer remove container based on its ID

func (*CattleOrchestrator) RetrieveOrphanAgents

func (o *CattleOrchestrator) RetrieveOrphanAgents() (containers map[string]string, err error)

RetrieveOrphanAgents returns the list of orphan Volback agents

type DockerConfig

type DockerConfig struct {
	Endpoint string
}

DockerConfig stores Docker configuration

type DockerOrchestrator

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

DockerOrchestrator implements a container orchestrator for Docker

func NewDockerOrchestrator

func NewDockerOrchestrator(config *DockerConfig) (o *DockerOrchestrator, err error)

NewDockerOrchestrator creates a Docker client

func (*DockerOrchestrator) AttachOrphanAgent

func (o *DockerOrchestrator) AttachOrphanAgent(containerID, namespace string) (success bool, output string, err error)

AttachOrphanAgent connects to a running agent and wait for the end of the backup proccess

func (*DockerOrchestrator) ContainerExec

func (o *DockerOrchestrator) ContainerExec(mountedVolumes *volume.MountedVolume, command []string) (stdout string, err error)

ContainerExec executes a command in a container

func (*DockerOrchestrator) DeployAgent

func (o *DockerOrchestrator) DeployAgent(image string, cmd []string, envs []string, v *volume.Volume) (success bool, output string, err error)

DeployAgent creates a `volback agent` container

func (*DockerOrchestrator) GetContainersMountingVolume

func (o *DockerOrchestrator) GetContainersMountingVolume(v *volume.Volume) (mountedVolumes []*volume.MountedVolume, err error)

GetContainersMountingVolume returns mounted volumes

func (*DockerOrchestrator) GetName

func (o *DockerOrchestrator) GetName() string

GetName returns the orchestrator's name

func (*DockerOrchestrator) GetPath

func (*DockerOrchestrator) GetPath(v *volume.Volume) string

GetPath returns the backup path

func (*DockerOrchestrator) GetVolumes

func (o *DockerOrchestrator) GetVolumes(volumeFilters volume.Filters) (volumes []*volume.Volume, err error)

GetVolumes returns the Docker volumes, inspected and filtered

func (*DockerOrchestrator) IsNodeAvailable

func (o *DockerOrchestrator) IsNodeAvailable(hostID string) (ok bool, err error)

IsNodeAvailable checks if the node is available to run backups on it

func (*DockerOrchestrator) PullImage

func (o *DockerOrchestrator) PullImage(image string) (err error)

PullImage pulls a Docker image

func (*DockerOrchestrator) RemoveContainer

func (o *DockerOrchestrator) RemoveContainer(containerID string) (err error)

RemoveContainer removes a container based on its ID

func (*DockerOrchestrator) RetrieveOrphanAgents

func (o *DockerOrchestrator) RetrieveOrphanAgents() (containers map[string]string, err error)

RetrieveOrphanAgents returns the list of orphan Volback agents

type KubernetesConfig

type KubernetesConfig struct {
	Namespace           string
	AllNamespaces       bool
	KubeConfig          string
	AgentServiceAccount string
}

KubernetesConfig stores Kubernetes configuration

type KubernetesOrchestrator

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

KubernetesOrchestrator implements a container orchestrator for Kubernetes

func NewKubernetesOrchestrator

func NewKubernetesOrchestrator(config *KubernetesConfig) (o *KubernetesOrchestrator, err error)

NewKubernetesOrchestrator creates a Kubernetes client

func (*KubernetesOrchestrator) AttachOrphanAgent

func (o *KubernetesOrchestrator) AttachOrphanAgent(containerID, namespace string) (success bool, output string, err error)

AttachOrphanAgent connects to a running agent and wait for the end of the backup proccess

func (*KubernetesOrchestrator) ContainerExec

func (o *KubernetesOrchestrator) ContainerExec(mountedVolumes *volume.MountedVolume, command []string) (stdout string, err error)

ContainerExec executes a command in a container

func (*KubernetesOrchestrator) DeletePod

func (o *KubernetesOrchestrator) DeletePod(name, namespace string)

DeletePod removes pod based on its name

func (*KubernetesOrchestrator) DeployAgent

func (o *KubernetesOrchestrator) DeployAgent(image string, cmd, envs []string, v *volume.Volume) (success bool, output string, err error)

DeployAgent creates a `volback agent` container

func (*KubernetesOrchestrator) GetContainersMountingVolume

func (o *KubernetesOrchestrator) GetContainersMountingVolume(v *volume.Volume) (containers []*volume.MountedVolume, er error)

GetContainersMountingVolume returns containers mounting a volume

func (*KubernetesOrchestrator) GetName

func (*KubernetesOrchestrator) GetName() string

GetName returns the orchestrator name

func (*KubernetesOrchestrator) GetPath

GetPath returns the backup path

func (*KubernetesOrchestrator) GetVolumes

func (o *KubernetesOrchestrator) GetVolumes(volumeFilters volume.Filters) (volumes []*volume.Volume, err error)

GetVolumes returns the Kubernetes persistent volume claims, inspected and filtered

func (*KubernetesOrchestrator) IsNodeAvailable

func (o *KubernetesOrchestrator) IsNodeAvailable(hostID string) (ok bool, err error)

IsNodeAvailable checks if the node is available to run backups on it

func (*KubernetesOrchestrator) RetrieveOrphanAgents

func (o *KubernetesOrchestrator) RetrieveOrphanAgents() (containers map[string]string, err error)

RetrieveOrphanAgents returns the list of orphan Volback agents

type Orchestrator

type Orchestrator interface {
	GetName() string
	GetPath(v *volume.Volume) string
	GetVolumes(volumeFilters volume.Filters) (volumes []*volume.Volume, err error)
	DeployAgent(image string, cmd []string, envs []string, volume *volume.Volume) (success bool, output string, err error)
	GetContainersMountingVolume(v *volume.Volume) (mountedVolumes []*volume.MountedVolume, err error)
	ContainerExec(mountedVolumes *volume.MountedVolume, command []string) (stdout string, err error)
	IsNodeAvailable(hostID string) (ok bool, err error)
	RetrieveOrphanAgents() (containers map[string]string, err error)
	AttachOrphanAgent(containerID, namespace string) (success bool, output string, err error)
}

Orchestrator implements a container Orchestrator interface

Jump to

Keyboard shortcuts

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