manager

package
v1.1.3-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 29 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BundleStateInProgress       = BundleState("InProgress")
	BundleStateReadyForDownload = BundleState("ReadyForDownload")
	BundleStateError            = BundleState("Error")
)
View Source
const (
	BundleErrorMkdirFailed        = BundleError("Failed to create bundle file directory")
	BundleErrorZipFailed          = BundleError("Failed to compress the support bundle files")
	BundleErrorOpenFailed         = BundleError("Failed to open the compressed bundle file")
	BundleErrorStatFailed         = BundleError("Failed to compute the size of the compressed bundle file")
	BundleProgressPercentageYaml  = 20
	BundleProgressPercentageLogs  = 75
	BundleProgressPercentageTotal = 100
)
View Source
const (
	BackupStatusQueryInterval = 2 * time.Second
)
View Source
const (
	MaxRecurringJobRetain = 50
)

Variables

View Source
var (
	WaitForEngineImageCount    = 20
	WaitForEngineImageInterval = 6 * time.Second
)
View Source
var (
	ConflictRetryCount = 5
)
View Source
var VERSION = "v0.3.0"

Functions

func GenerateBackupTarget added in v0.5.0

func GenerateBackupTarget(ds *datastore.DataStore) (*engineapi.BackupTarget, error)

func GetBackupCredentialConfig added in v0.5.0

func GetBackupCredentialConfig(ds *datastore.DataStore) (map[string]string, error)

func SyncVolumeLastBackupWithBackupVolume added in v0.5.0

func SyncVolumeLastBackupWithBackupVolume(volumeName string, backupVolume *engineapi.BackupVolume,
	getVolume func(name string) (*longhorn.Volume, error),
	updateVolume func(v *longhorn.Volume) (*longhorn.Volume, error)) (err error)

func SyncVolumesLastBackupWithBackupVolumes added in v0.5.0

func SyncVolumesLastBackupWithBackupVolumes(backupVolumes map[string]*engineapi.BackupVolume,
	listVolumes func() (map[string]*longhorn.Volume, error),
	getVolume func(name string) (*longhorn.Volume, error),
	updateVolume func(v *longhorn.Volume) (*longhorn.Volume, error))

func UpdateVolumeLastBackup added in v0.5.0

func UpdateVolumeLastBackup(volumeName string, backupTarget *engineapi.BackupTarget,
	getVolume func(name string) (*longhorn.Volume, error),
	updateVolume func(v *longhorn.Volume) (*longhorn.Volume, error)) (err error)

Types

type BundleError added in v0.5.0

type BundleError string

type BundleMeta added in v0.4.0

type BundleMeta struct {
	LonghornVersion       string `json:"longhornVersion"`
	KubernetesVersion     string `json:"kubernetesVersion"`
	LonghornNamespaceUUID string `json:"longhornNamspaceUUID"`
	BundleCreatedAt       string `json:"bundleCreatedAt"`
	IssueURL              string `json:"issueURL"`
	IssueDescription      string `json:"issueDescription"`
}

type BundleState added in v0.5.0

type BundleState string

type GetObjectMapFunc added in v0.4.0

type GetObjectMapFunc func() (interface{}, error)

type GetRuntimeObjectListFunc added in v0.4.0

type GetRuntimeObjectListFunc func() (runtime.Object, error)

type SupportBundle added in v0.5.0

type SupportBundle struct {
	Name               string
	State              BundleState
	Size               int64
	Error              BundleError
	Filename           string
	ProgressPercentage int
}

type VolumeManager

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

func NewVolumeManager

func NewVolumeManager(currentNodeID string, ds *datastore.DataStore) *VolumeManager

func (*VolumeManager) Activate added in v0.5.0

func (m *VolumeManager) Activate(volumeName string, frontend string) (v *longhorn.Volume, err error)

func (*VolumeManager) Attach

func (m *VolumeManager) Attach(name, nodeID string, disableFrontend bool, attachedBy string) (v *longhorn.Volume, err error)

func (*VolumeManager) BackupSnapshot

func (m *VolumeManager) BackupSnapshot(volumeName, snapshotName, backingImageName, backingImageURL string, labels map[string]string) error

func (*VolumeManager) CancelExpansion added in v0.8.1

func (m *VolumeManager) CancelExpansion(volumeName string) (v *longhorn.Volume, err error)

func (*VolumeManager) CleanUpBackingImageInDisks added in v1.1.1

func (m *VolumeManager) CleanUpBackingImageInDisks(name string, disks []string) (*longhorn.BackingImage, error)

func (*VolumeManager) Create

func (m *VolumeManager) Create(name string, spec *types.VolumeSpec) (v *longhorn.Volume, err error)

func (*VolumeManager) CreateBackingImage added in v1.1.1

func (m *VolumeManager) CreateBackingImage(name, url string) (*longhorn.BackingImage, error)

func (*VolumeManager) CreateEngineImage

func (m *VolumeManager) CreateEngineImage(image string) (*longhorn.EngineImage, error)

func (*VolumeManager) CreateOrUpdateSetting

func (m *VolumeManager) CreateOrUpdateSetting(s *longhorn.Setting) (*longhorn.Setting, error)

func (*VolumeManager) CreateSnapshot

func (m *VolumeManager) CreateSnapshot(snapshotName string, labels map[string]string, volumeName string) (*types.Snapshot, error)

func (*VolumeManager) Delete

func (m *VolumeManager) Delete(name string) error

func (*VolumeManager) DeleteBackingImage added in v1.1.1

func (m *VolumeManager) DeleteBackingImage(name string) error

func (*VolumeManager) DeleteBackup

func (m *VolumeManager) DeleteBackup(backupName, volumeName string) error

func (*VolumeManager) DeleteBackupVolume added in v0.6.0

func (m *VolumeManager) DeleteBackupVolume(volumeName string) error

func (*VolumeManager) DeleteEngineImageByName

func (m *VolumeManager) DeleteEngineImageByName(name string) error

func (*VolumeManager) DeleteNode added in v0.3.1

func (m *VolumeManager) DeleteNode(name string) error

func (*VolumeManager) DeleteReplica

func (m *VolumeManager) DeleteReplica(volumeName, replicaName string) error

func (*VolumeManager) DeleteSnapshot

func (m *VolumeManager) DeleteSnapshot(snapshotName, volumeName string) error

func (*VolumeManager) DeleteSupportBundle added in v0.5.0

func (m *VolumeManager) DeleteSupportBundle()

func (*VolumeManager) DeployEngineImage added in v1.1.1

func (m *VolumeManager) DeployEngineImage(image string) error

func (*VolumeManager) Detach

func (m *VolumeManager) Detach(name, nodeID string) (v *longhorn.Volume, err error)

Detach will handle regular detachment as well as volume migration confirmation/rollback if nodeID is not specified, the volume will be detached from all nodes

func (*VolumeManager) DiskUpdate

func (m *VolumeManager) DiskUpdate(name string, updateDisks map[string]types.DiskSpec) (*longhorn.Node, error)

func (*VolumeManager) EngineUpgrade

func (m *VolumeManager) EngineUpgrade(volumeName, image string) (v *longhorn.Volume, err error)

func (*VolumeManager) Expand added in v0.8.0

func (m *VolumeManager) Expand(volumeName string, size int64) (v *longhorn.Volume, err error)

func (*VolumeManager) GenerateSupportBundle added in v0.4.0

func (m *VolumeManager) GenerateSupportBundle(issueURL string, description string) (*SupportBundle, error)

GenerateSupportBundle covers: 1. YAMLs of the Longhorn related CRDs 2. YAMLs of pods, services, daemonset, deployment in longhorn namespace 3. All the logs of pods in the longhorn namespace 4. Recent events happens in the longhorn namespace

Directories are organized like this: root |- yamls

|- events.yaml
|- crds
  |- <list of top level CRD objects>
    |- <name of each crd>.yaml
|- pods
  |- <name of each pod>.yaml
|- <other workloads>...

|- logs

|- <name of each pod>.log
|- <directory by the name of pod, if multiple containers exists>
  |- <container1>.log
  |- ...

The bundle would be compressed to a zip file for download.

func (*VolumeManager) Get

func (m *VolumeManager) Get(vName string) (*longhorn.Volume, error)

func (*VolumeManager) GetBackingImage added in v1.1.1

func (m *VolumeManager) GetBackingImage(name string) (*longhorn.BackingImage, error)

func (*VolumeManager) GetBackup

func (m *VolumeManager) GetBackup(backupName, volumeName string) (*engineapi.Backup, error)

func (*VolumeManager) GetBackupVolume

func (m *VolumeManager) GetBackupVolume(volumeName string) (*engineapi.BackupVolume, error)

func (*VolumeManager) GetBundleFileHandler added in v0.5.0

func (m *VolumeManager) GetBundleFileHandler() (io.ReadCloser, error)

func (*VolumeManager) GetCurrentNodeID

func (m *VolumeManager) GetCurrentNodeID() string

func (*VolumeManager) GetDaemonSetRO added in v1.1.0

func (m *VolumeManager) GetDaemonSetRO(name string) (*appsv1.DaemonSet, error)

func (*VolumeManager) GetDiskTags added in v0.6.0

func (m *VolumeManager) GetDiskTags() ([]string, error)

func (*VolumeManager) GetEngineClient

func (m *VolumeManager) GetEngineClient(volumeName string) (client engineapi.EngineClient, err error)

func (*VolumeManager) GetEngineImageByImage added in v1.1.1

func (m *VolumeManager) GetEngineImageByImage(image string) (*longhorn.EngineImage, error)

func (*VolumeManager) GetEngineImageByName

func (m *VolumeManager) GetEngineImageByName(name string) (*longhorn.EngineImage, error)

func (*VolumeManager) GetEngines

func (m *VolumeManager) GetEngines(vName string) (map[string]*longhorn.Engine, error)

func (*VolumeManager) GetEnginesSorted

func (m *VolumeManager) GetEnginesSorted(vName string) ([]*longhorn.Engine, error)

func (*VolumeManager) GetInstanceManager added in v0.6.0

func (m *VolumeManager) GetInstanceManager(name string) (*longhorn.InstanceManager, error)

func (*VolumeManager) GetLonghornEventList added in v0.4.0

func (m *VolumeManager) GetLonghornEventList() (*v1.EventList, error)

func (*VolumeManager) GetManagerNodeIPMap

func (m *VolumeManager) GetManagerNodeIPMap() (map[string]string, error)

func (*VolumeManager) GetNode

func (m *VolumeManager) GetNode(name string) (*longhorn.Node, error)

func (*VolumeManager) GetNodeTags added in v0.6.0

func (m *VolumeManager) GetNodeTags() ([]string, error)

func (*VolumeManager) GetReplicas

func (m *VolumeManager) GetReplicas(vName string) (map[string]*longhorn.Replica, error)

func (*VolumeManager) GetReplicasSorted

func (m *VolumeManager) GetReplicasSorted(vName string) ([]*longhorn.Replica, error)

func (*VolumeManager) GetSetting

func (m *VolumeManager) GetSetting(sName types.SettingName) (*longhorn.Setting, error)

func (*VolumeManager) GetSettingValueExisted

func (m *VolumeManager) GetSettingValueExisted(sName types.SettingName) (string, error)

func (*VolumeManager) GetSnapshot

func (m *VolumeManager) GetSnapshot(snapshotName, volumeName string) (*types.Snapshot, error)

func (*VolumeManager) GetSupportBundle added in v0.5.0

func (m *VolumeManager) GetSupportBundle(name string) (*SupportBundle, error)

func (*VolumeManager) InitSupportBundle added in v0.5.0

func (m *VolumeManager) InitSupportBundle(issueURL string, description string) (*SupportBundle, error)

func (*VolumeManager) List

func (m *VolumeManager) List() (map[string]*longhorn.Volume, error)

func (*VolumeManager) ListBackingImages added in v1.1.1

func (m *VolumeManager) ListBackingImages() (map[string]*longhorn.BackingImage, error)

func (*VolumeManager) ListBackingImagesSorted added in v1.1.2

func (m *VolumeManager) ListBackingImagesSorted() ([]*longhorn.BackingImage, error)

func (*VolumeManager) ListBackupVolumes

func (m *VolumeManager) ListBackupVolumes() (map[string]*engineapi.BackupVolume, error)

func (*VolumeManager) ListBackupsForVolume

func (m *VolumeManager) ListBackupsForVolume(volumeName string) ([]*engineapi.Backup, error)

func (*VolumeManager) ListEngineImagesByName

func (m *VolumeManager) ListEngineImagesByName() (map[string]*longhorn.EngineImage, error)

func (*VolumeManager) ListEngineImagesSorted

func (m *VolumeManager) ListEngineImagesSorted() ([]*longhorn.EngineImage, error)

func (*VolumeManager) ListInstanceManagers added in v0.6.0

func (m *VolumeManager) ListInstanceManagers() (map[string]*longhorn.InstanceManager, error)

func (*VolumeManager) ListNodes

func (m *VolumeManager) ListNodes() (map[string]*longhorn.Node, error)

func (*VolumeManager) ListNodesSorted

func (m *VolumeManager) ListNodesSorted() ([]*longhorn.Node, error)

func (*VolumeManager) ListReadyNodesWithEngineImage added in v1.1.1

func (m *VolumeManager) ListReadyNodesWithEngineImage(image string) (map[string]*longhorn.Node, error)

func (*VolumeManager) ListSettings

func (m *VolumeManager) ListSettings() (map[types.SettingName]*longhorn.Setting, error)

func (*VolumeManager) ListSettingsSorted

func (m *VolumeManager) ListSettingsSorted() ([]*longhorn.Setting, error)

func (*VolumeManager) ListSnapshots

func (m *VolumeManager) ListSnapshots(volumeName string) (map[string]*types.Snapshot, error)

func (*VolumeManager) ListSorted

func (m *VolumeManager) ListSorted() ([]*longhorn.Volume, error)

func (*VolumeManager) Node2APIAddress

func (m *VolumeManager) Node2APIAddress(nodeID string) (string, error)

func (*VolumeManager) PVCCreate added in v0.5.0

func (m *VolumeManager) PVCCreate(name, namespace, pvcName string) (v *longhorn.Volume, err error)

func (*VolumeManager) PVCreate added in v0.5.0

func (m *VolumeManager) PVCreate(name, pvName, fsType string) (v *longhorn.Volume, err error)

func (*VolumeManager) PurgeSnapshot

func (m *VolumeManager) PurgeSnapshot(volumeName string) error

func (*VolumeManager) RevertSnapshot

func (m *VolumeManager) RevertSnapshot(snapshotName, volumeName string) error

func (*VolumeManager) Salvage

func (m *VolumeManager) Salvage(volumeName string, replicaNames []string) (v *longhorn.Volume, err error)

func (*VolumeManager) UpdateAccessMode added in v1.1.0

func (m *VolumeManager) UpdateAccessMode(name string, accessMode types.AccessMode) (v *longhorn.Volume, err error)

func (*VolumeManager) UpdateDataLocality added in v1.1.0

func (m *VolumeManager) UpdateDataLocality(name string, dataLocality types.DataLocality) (v *longhorn.Volume, err error)

func (*VolumeManager) UpdateNode

func (m *VolumeManager) UpdateNode(n *longhorn.Node) (*longhorn.Node, error)

func (*VolumeManager) UpdateRecurringJobs

func (m *VolumeManager) UpdateRecurringJobs(volumeName string, jobs []types.RecurringJob) (v *longhorn.Volume, err error)

func (*VolumeManager) UpdateReplicaCount added in v0.3.3

func (m *VolumeManager) UpdateReplicaCount(name string, count int) (v *longhorn.Volume, err error)

Jump to

Keyboard shortcuts

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