Documentation ¶
Index ¶
- Constants
- Variables
- func Add(mgr manager.Manager) error
- func GetRegistryInfo(major, minor int, client compat.Client) (string, error)
- type AnalyticPredicate
- type BaseUnit
- type DF
- type DFCommandExecutor
- type DFOutput
- type DU
- type DUOutput
- type DfDu
- type MigAnalyticPersistentVolumeDetails
- type PersistentVolumeAdjuster
- type ReconcileMigAnalytic
- type ResticDFCommandExecutor
- type StorageCommand
- type StorageCommandOutput
Constants ¶
const ( MiBSuffix = "Mi" MiB = 1048576 RequeueInterval = 10 )
const ( // ResticPodLabelKey is the key of the label used to discover Restic pod ResticPodLabelKey = "name" // ResticPodLabelValue is the value of the label used to discover Restic pod ResticPodLabelValue = "node-agent" )
const ( InvalidPlanRef = "InvalidPlanRef" Postponed = "Postponed" )
Types
const ( Supported = "Supported" NotSupported = "NotSupported" NotSet = "NotSet" NotFound = "NotFound" KeyError = "KeyError" TestFailed = "TestFailed" )
Reasons
const ( True = migapi.True False = migapi.False )
Statuses
const ( DecimalSIGiga = BaseUnit("GB") DecimalSIMega = BaseUnit("MB") BinarySIMega = BaseUnit("M") BinarySIGiga = BaseUnit("G") )
Supported base units used for df command
const (
Critical = migapi.Critical
)
Categories
const DEFAULT_PV_USAGE_THRESHOLD = 3
const VolumePath = "%s/%s/volumes/*/%s"
VolumePath defines format of expected path of the volume present on Pod
Variables ¶
var (
Settings = &settings.Settings
)
Functions ¶
Types ¶
type AnalyticPredicate ¶
func (AnalyticPredicate) Create ¶
func (r AnalyticPredicate) Create(e event.CreateEvent) bool
func (AnalyticPredicate) Delete ¶
func (r AnalyticPredicate) Delete(e event.DeleteEvent) bool
func (AnalyticPredicate) Update ¶
func (r AnalyticPredicate) Update(e event.UpdateEvent) bool
type DF ¶
type DF struct {
StorageCommand
}
DF represent a df command
func (*DF) GetOutputForPV ¶
GetOutputForPV given a volume name and pod uid, returns structured df ouput for the volume only works on outputs of commands created by DFCommand.PrepareDFCommand()
func (*DF) PrepareCommand ¶
func (d *DF) PrepareCommand(pvcs []MigAnalyticPersistentVolumeDetails) []string
PrepareCommand given a list of volumes, creates a bulk df command for all volumes
type DFCommandExecutor ¶
type DFCommandExecutor interface {
Execute(map[string][]MigAnalyticPersistentVolumeDetails) ([]DFOutput, []DUOutput, error)
}
DFCommandExecutor defines an executor responsible for running DF
type DFOutput ¶
type DFOutput struct { Node string Name string Namespace string StorageCommandOutput }
DFOutput defines structured output of df per PV
type DU ¶
type DU struct {
StorageCommand
}
func (*DU) GetOutputForPV ¶
GetOutputForPV given a volume name and pod uid, returns structured df ouput for the volume only works on outputs of commands created by DFCommand.PrepareDFCommand()
func (*DU) PrepareCommand ¶
func (d *DU) PrepareCommand(pvcs []MigAnalyticPersistentVolumeDetails) []string
PrepareCommand given a list of volumes, creates a bulk df command for all volumes
type DUOutput ¶
type DUOutput struct { Name string Namespace string StorageCommandOutput }
type MigAnalyticPersistentVolumeDetails ¶
type MigAnalyticPersistentVolumeDetails struct { Name string RequestedCapacity resource.Quantity PodUID types.UID ProvisionedCapacity resource.Quantity StorageClass *string Namespace string VolumeName string }
MigAnalyticPersistentVolumeDetails defines extended properties of a volume discovered by MigAnalytic
type PersistentVolumeAdjuster ¶
type PersistentVolumeAdjuster struct { Owner *migapi.MigAnalytic Client client.Client DFExecutor DFCommandExecutor StatusRefCache map[string]*migapi.MigAnalyticNamespace }
PersistentVolumeAdjuster defines volume adjustment context
func (*PersistentVolumeAdjuster) Run ¶
func (p *PersistentVolumeAdjuster) Run(pvNodeMap map[string][]MigAnalyticPersistentVolumeDetails) error
Run runs executor, uses df output to calculate adjusted volume sizes, updates owner.status with results
type ReconcileMigAnalytic ¶
type ReconcileMigAnalytic struct { client.Client record.EventRecorder // contains filtered or unexported fields }
ReconcileMigAnalytic reconciles a MigAnalytic object
type ResticDFCommandExecutor ¶
type ResticDFCommandExecutor struct { // Namespace is the ns in which Restic pods are present Namespace string // Client to interact with Restic pods Client compat.Client // ResticPodReferences is a local cache of known Restic pods ResticPodReferences map[string]*corev1.Pod }
ResticDFCommandExecutor uses Restic pods to run DF command
func (*ResticDFCommandExecutor) Execute ¶
func (r *ResticDFCommandExecutor) Execute(pvcNodeMap map[string][]MigAnalyticPersistentVolumeDetails) ([]DFOutput, []DUOutput, error)
Execute given a map node->[]pvc, runs Df command for each, returns list of structured df output per pvc
func (*ResticDFCommandExecutor) ExecuteStorageCommands ¶
func (r *ResticDFCommandExecutor) ExecuteStorageCommands(podRef *corev1.Pod, persistentVolumes []MigAnalyticPersistentVolumeDetails) (DF, DU)
ExecuteStorageCommands given a podRef and a list of volumes, runs df command, returns with structured command context any errors running the df command are suppressed here. DFCommand.stdErr field should be used to determine failure