Documentation
¶
Index ¶
- Constants
- func CalculateEffectiveCPU(physicalCores, threads int) float64
- type AgentService
- type AssessmentFilter
- func (f *AssessmentFilter) WithLimit(limit int) *AssessmentFilter
- func (f *AssessmentFilter) WithNameLike(pattern string) *AssessmentFilter
- func (f *AssessmentFilter) WithOffset(offset int) *AssessmentFilter
- func (f *AssessmentFilter) WithSource(source string) *AssessmentFilter
- func (f *AssessmentFilter) WithSourceID(sourceID string) *AssessmentFilter
- type AssessmentService
- func (as *AssessmentService) CreateAssessment(ctx context.Context, createForm mappers.AssessmentCreateForm) (*model.Assessment, error)
- func (as *AssessmentService) DeleteAssessment(ctx context.Context, id uuid.UUID) error
- func (as *AssessmentService) GetAssessment(ctx context.Context, id uuid.UUID) (*model.Assessment, error)
- func (as *AssessmentService) ListAssessments(ctx context.Context, filter *AssessmentFilter) ([]model.Assessment, error)
- func (as *AssessmentService) UpdateAssessment(ctx context.Context, id uuid.UUID, name *string) (*model.Assessment, error)
- type BatchedService
- type ErrAgentUpdateForbidden
- type ErrAssessmentCreationForbidden
- type ErrDuplicateKey
- type ErrFileCorrupted
- type ErrInvalidClusterInventory
- type ErrInvalidRequest
- type ErrInvalidVCenterID
- type ErrInventoryHasNoVMs
- type ErrJobForbidden
- type ErrJobNotFound
- type ErrResourceNotFound
- func NewErrAgentNotFound(id uuid.UUID) *ErrResourceNotFound
- func NewErrAssessmentNotFound(id uuid.UUID) *ErrResourceNotFound
- func NewErrClusterNotFound(clusterID string, assessmentID uuid.UUID) *ErrResourceNotFound
- func NewErrResourceNotFound(id uuid.UUID, resourceType string) *ErrResourceNotFound
- func NewErrSourceNotFound(id uuid.UUID) *ErrResourceNotFound
- type ErrSourceHasNoInventory
- type EstimationService
- type JobService
- func (s *JobService) CancelJob(ctx context.Context, jobID int64, orgID, username string) (*v1alpha1.Job, error)
- func (s *JobService) CreateRVToolsJob(ctx context.Context, args jobs.RVToolsJobArgs) (*v1alpha1.Job, error)
- func (s *JobService) GetJob(ctx context.Context, jobID int64, orgID, username string) (*v1alpha1.Job, error)
- type MigrationAssessmentResult
- type SizerService
- type SourceFilter
- type SourceFilterFunc
- type SourceService
- func (s *SourceService) CreateSource(ctx context.Context, sourceForm mappers.SourceCreateForm) (model.Source, error)
- func (s *SourceService) DeleteSource(ctx context.Context, id uuid.UUID) error
- func (s *SourceService) DeleteSources(ctx context.Context) error
- func (s *SourceService) GetSource(ctx context.Context, id uuid.UUID) (*model.Source, error)
- func (s *SourceService) GetSourceDownloadURL(ctx context.Context, id uuid.UUID) (string, time.Time, error)
- func (s *SourceService) ListSources(ctx context.Context, filter *SourceFilter) ([]model.Source, error)
- func (s *SourceService) UpdateInventory(ctx context.Context, form mappers.InventoryUpdateForm) (model.Source, error)
- func (s *SourceService) UpdateSource(ctx context.Context, id uuid.UUID, form mappers.SourceUpdateForm) (*model.Source, error)
- type TransformedSizerResponse
Constants ¶
const ( SourceTypeAgent string = "agent" SourceTypeInventory string = "inventory" SourceTypeRvtools string = "rvtools" )
const ( // TargetCapacityPercent leaves 30% headroom for over-commitment TargetCapacityPercent = 70.0 // CapacityMultiplier is the decimal representation of TargetCapacityPercent CapacityMultiplier = TargetCapacityPercent / 100.0 DefaultPlatform = "BAREMETAL" // MaxBatches - if exceeded, recommend larger nodes MaxBatches = 200 // MinBatchCPU prevents tiny batches MinBatchCPU = 1.0 // MinBatchMemory prevents tiny batches MinBatchMemory = 2.0 // MaxNodeCount - if exceeded, recommend larger nodes MaxNodeCount = 100 // ControlPlaneCPU is the default CPU for control plane nodes ControlPlaneCPU = 6 // ControlPlaneMemory is the default memory (GB) for control plane nodes ControlPlaneMemory = 16 // MachineSetNumberOfDisks is the number of disks for both worker and control plane machine sets MachineSetNumberOfDisks = 24 // ControlPlaneReservedCPU is the CPU reserved for control plane services ControlPlaneReservedCPU = 3.5 // ControlPlaneReservedMemory is the memory (GB) reserved for control plane services ControlPlaneReservedMemory = 13.39 // MinFallbackNodeCPU is the minimum fallback CPU when inputs are invalid MinFallbackNodeCPU = 2 // MinFallbackNodeMemory is the minimum fallback memory (GB) when inputs are invalid MinFallbackNodeMemory = 4 // MaxRecommendedNodeCPU is the maximum recommended CPU for nodes MaxRecommendedNodeCPU = 200 // MaxRecommendedNodeMemory is the maximum recommended memory (GB) for nodes MaxRecommendedNodeMemory = 512 // MinFailoverNodes is the minimum number of failover nodes MinFailoverNodes = 2 // FailoverCapacityPercent is the percentage of worker nodes for failover FailoverCapacityPercent = 10.0 )
Variables ¶
This section is empty.
Functions ¶
func CalculateEffectiveCPU ¶ added in v0.5.0
CalculateEffectiveCPU calculates SMT-adjusted effective CPU cores Formula: effectiveCPU = physicalCores + ((threads - physicalCores) * 0.5) If threads == 0 or threads == cores, returns cores (no SMT)
Types ¶
type AgentService ¶
type AgentService struct {
// contains filtered or unexported fields
}
func NewAgentService ¶
func NewAgentService(store store.Store) *AgentService
func (*AgentService) UpdateAgentStatus ¶
func (as *AgentService) UpdateAgentStatus(ctx context.Context, updateForm mappers.AgentUpdateForm) (*model.Agent, bool, error)
UpdateAgentStatus updates or creates a new agent resource If the source has not agent than the agent is created.
func (*AgentService) UpdateSourceInventory ¶
func (as *AgentService) UpdateSourceInventory(ctx context.Context, updateForm mappers.InventoryUpdateForm) (*model.Source, error)
UpdateSourceInventory updates source inventory
This implements the SingleModel logic: - Only updates for a single vCenterID are allowed - allow two agents trying to update the source with same vCenterID - don't allow updates from agents not belonging to the source - don't allow updates if source is missing. (i.g the source is created as per MultiSource logic). It fails anyway because an agent always has a source. - if the source has no inventory yet, set the vCenterID and AssociatedAgentID to this source.
type AssessmentFilter ¶
type AssessmentFilter struct {
OrgID string
Username string
Source string
SourceID string
NameLike string
Limit int
Offset int
}
AssessmentFilter represents filtering options for listing assessments
func NewAssessmentFilter ¶
func NewAssessmentFilter(username, orgID string) *AssessmentFilter
func (*AssessmentFilter) WithLimit ¶
func (f *AssessmentFilter) WithLimit(limit int) *AssessmentFilter
func (*AssessmentFilter) WithNameLike ¶
func (f *AssessmentFilter) WithNameLike(pattern string) *AssessmentFilter
func (*AssessmentFilter) WithOffset ¶
func (f *AssessmentFilter) WithOffset(offset int) *AssessmentFilter
func (*AssessmentFilter) WithSource ¶
func (f *AssessmentFilter) WithSource(source string) *AssessmentFilter
func (*AssessmentFilter) WithSourceID ¶
func (f *AssessmentFilter) WithSourceID(sourceID string) *AssessmentFilter
type AssessmentService ¶
type AssessmentService struct {
// contains filtered or unexported fields
}
func NewAssessmentService ¶
func NewAssessmentService(store store.Store, opaValidator *opa.Validator) *AssessmentService
func (*AssessmentService) CreateAssessment ¶
func (as *AssessmentService) CreateAssessment(ctx context.Context, createForm mappers.AssessmentCreateForm) (*model.Assessment, error)
func (*AssessmentService) DeleteAssessment ¶
func (*AssessmentService) GetAssessment ¶
func (as *AssessmentService) GetAssessment(ctx context.Context, id uuid.UUID) (*model.Assessment, error)
func (*AssessmentService) ListAssessments ¶
func (as *AssessmentService) ListAssessments(ctx context.Context, filter *AssessmentFilter) ([]model.Assessment, error)
func (*AssessmentService) UpdateAssessment ¶
func (as *AssessmentService) UpdateAssessment(ctx context.Context, id uuid.UUID, name *string) (*model.Assessment, error)
type BatchedService ¶ added in v0.4.0
type BatchedService struct {
Name string
RequiredCPU float64
RequiredMemory float64
LimitCPU float64
LimitMemory float64
}
BatchedService represents an aggregated service workload for the sizer API. It contains the resource requirements for a single batch of VMs that will be scheduled as a service on the cluster.
Fields:
- Name: Unique identifier for the batch (e.g., "vms-batch-1-services")
- RequiredCPU: CPU cores requested for this batch (after applying over-commit ratio)
- RequiredMemory: Memory (GB) requested for this batch (after applying over-commit ratio)
- LimitCPU: Maximum CPU cores allowed for this batch (before over-commit)
- LimitMemory: Maximum memory (GB) allowed for this batch (before over-commit)
The Required values represent Kubernetes resource requests, while Limit values represent Kubernetes resource limits. The over-commit ratio determines the relationship between them.
type ErrAgentUpdateForbidden ¶
type ErrAgentUpdateForbidden struct {
// contains filtered or unexported fields
}
func NewErrAgentUpdateForbidden ¶
func NewErrAgentUpdateForbidden(sourceID, agentID uuid.UUID) *ErrAgentUpdateForbidden
type ErrAssessmentCreationForbidden ¶
type ErrAssessmentCreationForbidden struct {
// contains filtered or unexported fields
}
func NewErrAssessmentCreationForbidden ¶
func NewErrAssessmentCreationForbidden(sourceID uuid.UUID) *ErrAssessmentCreationForbidden
type ErrDuplicateKey ¶ added in v0.3.0
type ErrDuplicateKey struct {
// contains filtered or unexported fields
}
func NewErrAssessmentDuplicateName ¶ added in v0.3.0
func NewErrAssessmentDuplicateName(name string) *ErrDuplicateKey
func NewErrDuplicateKey ¶ added in v0.3.0
func NewErrDuplicateKey(resourceType, key string) *ErrDuplicateKey
type ErrFileCorrupted ¶ added in v0.3.0
type ErrFileCorrupted struct {
// contains filtered or unexported fields
}
func NewErrFileCorrupted ¶ added in v0.3.0
func NewErrFileCorrupted(message string) *ErrFileCorrupted
func NewErrRVToolsFileCorrupted ¶ added in v0.3.0
func NewErrRVToolsFileCorrupted(message string) *ErrFileCorrupted
type ErrInvalidClusterInventory ¶ added in v0.4.0
type ErrInvalidClusterInventory struct {
// contains filtered or unexported fields
}
func NewErrInvalidClusterInventory ¶ added in v0.4.0
func NewErrInvalidClusterInventory(clusterID string, reason string) *ErrInvalidClusterInventory
type ErrInvalidRequest ¶ added in v0.4.0
type ErrInvalidRequest struct {
// contains filtered or unexported fields
}
func NewErrInvalidRequest ¶ added in v0.4.0
func NewErrInvalidRequest(message string) *ErrInvalidRequest
type ErrInvalidVCenterID ¶
type ErrInvalidVCenterID struct {
// contains filtered or unexported fields
}
func NewErrInvalidVCenterID ¶
func NewErrInvalidVCenterID(sourceID uuid.UUID, vCenterID string) *ErrInvalidVCenterID
type ErrInventoryHasNoVMs ¶ added in v0.4.0
type ErrInventoryHasNoVMs struct {
// contains filtered or unexported fields
}
func NewErrInventoryHasNoVMs ¶ added in v0.4.0
func NewErrInventoryHasNoVMs() *ErrInventoryHasNoVMs
type ErrJobForbidden ¶ added in v0.3.0
type ErrJobForbidden struct {
JobID int64
}
func NewErrJobForbidden ¶ added in v0.3.0
func NewErrJobForbidden(jobID int64) *ErrJobForbidden
func (*ErrJobForbidden) Error ¶ added in v0.3.0
func (e *ErrJobForbidden) Error() string
type ErrJobNotFound ¶ added in v0.3.0
type ErrJobNotFound struct {
JobID int64
}
func NewErrJobNotFound ¶ added in v0.3.0
func NewErrJobNotFound(jobID int64) *ErrJobNotFound
func (*ErrJobNotFound) Error ¶ added in v0.3.0
func (e *ErrJobNotFound) Error() string
type ErrResourceNotFound ¶
type ErrResourceNotFound struct {
// contains filtered or unexported fields
}
func NewErrAgentNotFound ¶
func NewErrAgentNotFound(id uuid.UUID) *ErrResourceNotFound
func NewErrAssessmentNotFound ¶
func NewErrAssessmentNotFound(id uuid.UUID) *ErrResourceNotFound
func NewErrClusterNotFound ¶ added in v0.5.1
func NewErrClusterNotFound(clusterID string, assessmentID uuid.UUID) *ErrResourceNotFound
func NewErrResourceNotFound ¶
func NewErrResourceNotFound(id uuid.UUID, resourceType string) *ErrResourceNotFound
func NewErrSourceNotFound ¶
func NewErrSourceNotFound(id uuid.UUID) *ErrResourceNotFound
type ErrSourceHasNoInventory ¶
type ErrSourceHasNoInventory struct {
// contains filtered or unexported fields
}
func NewErrSourceHasNoInventory ¶
func NewErrSourceHasNoInventory(sourceID uuid.UUID) *ErrSourceHasNoInventory
type EstimationService ¶ added in v0.5.1
type EstimationService struct {
// contains filtered or unexported fields
}
EstimationService orchestrates the migration time estimation workflow. It retrieves assessment and inventory data from the store and runs them through the estimation Engine to produce a MigrationAssessmentResult.
func NewEstimationService ¶ added in v0.5.1
func NewEstimationService(store store.Store) *EstimationService
NewEstimationService creates an EstimationService with the default set of calculators registered.
func (*EstimationService) CalculateMigrationEstimation ¶ added in v0.5.1
func (es *EstimationService) CalculateMigrationEstimation( ctx context.Context, assessmentID uuid.UUID, clusterID string, ) (*MigrationAssessmentResult, error)
CalculateMigrationEstimation calculates migration time estimation for a given assessment and cluster
type JobService ¶ added in v0.3.0
type JobService struct {
// contains filtered or unexported fields
}
JobService handles job-related operations.
func NewJobService ¶ added in v0.3.0
NewJobService creates a new job service.
func (*JobService) CancelJob ¶ added in v0.3.0
func (s *JobService) CancelJob(ctx context.Context, jobID int64, orgID, username string) (*v1alpha1.Job, error)
CancelJob cancels a job by ID.
func (*JobService) CreateRVToolsJob ¶ added in v0.3.0
func (s *JobService) CreateRVToolsJob(ctx context.Context, args jobs.RVToolsJobArgs) (*v1alpha1.Job, error)
CreateRVToolsJob creates a new RVTools processing job.
type MigrationAssessmentResult ¶ added in v0.5.1
type MigrationAssessmentResult struct {
TotalDuration time.Duration
Breakdown map[string]estimation.Estimation
}
MigrationAssessmentResult represents the result of a migration assessment calculation
type SizerService ¶ added in v0.4.0
type SizerService struct {
// contains filtered or unexported fields
}
SizerService handles cluster sizing calculations
func NewSizerService ¶ added in v0.4.0
func NewSizerService(sizerClient *client.SizerClient, store store.Store) *SizerService
func (*SizerService) CalculateClusterRequirements ¶ added in v0.4.0
func (s *SizerService) CalculateClusterRequirements( ctx context.Context, assessmentID uuid.UUID, req *mappers.ClusterRequirementsRequestForm, ) (*mappers.ClusterRequirementsResponseForm, error)
CalculateClusterRequirements calculates cluster requirements for an assessment
type SourceFilter ¶
func NewSourceFilter ¶
func NewSourceFilter(filters ...SourceFilterFunc) *SourceFilter
func (*SourceFilter) WithOption ¶
func (s *SourceFilter) WithOption(o SourceFilterFunc) *SourceFilter
type SourceFilterFunc ¶
type SourceFilterFunc func(s *SourceFilter)
func WithOrgID ¶
func WithOrgID(orgID string) SourceFilterFunc
func WithSourceID ¶
func WithSourceID(id uuid.UUID) SourceFilterFunc
func WithUsername ¶ added in v0.3.0
func WithUsername(username string) SourceFilterFunc
type SourceService ¶
type SourceService struct {
// contains filtered or unexported fields
}
func NewSourceService ¶
func NewSourceService(store store.Store, opaValidator *opa.Validator) *SourceService
func (*SourceService) CreateSource ¶
func (s *SourceService) CreateSource(ctx context.Context, sourceForm mappers.SourceCreateForm) (model.Source, error)
func (*SourceService) DeleteSource ¶
func (*SourceService) DeleteSources ¶
func (s *SourceService) DeleteSources(ctx context.Context) error
func (*SourceService) GetSourceDownloadURL ¶
func (s *SourceService) GetSourceDownloadURL(ctx context.Context, id uuid.UUID) (string, time.Time, error)
TODO should be moved to ImageService (to be created)
func (*SourceService) ListSources ¶
func (s *SourceService) ListSources(ctx context.Context, filter *SourceFilter) ([]model.Source, error)
func (*SourceService) UpdateInventory ¶
func (s *SourceService) UpdateInventory(ctx context.Context, form mappers.InventoryUpdateForm) (model.Source, error)
func (*SourceService) UpdateSource ¶
func (s *SourceService) UpdateSource(ctx context.Context, id uuid.UUID, form mappers.SourceUpdateForm) (*model.Source, error)
type TransformedSizerResponse ¶ added in v0.4.0
type TransformedSizerResponse struct {
ClusterSizing mappers.ClusterSizingForm
ResourceConsumption mappers.ResourceConsumptionForm
}
TransformedSizerResponse represents the transformed response from the sizer service after mapping it to the domain model format.