Documentation
¶
Overview ¶
Package scalesim contains the API interface and structural types for the scaler simular project
Index ¶
- type AllPricing
- type Engine
- type InstancePricing
- type NodePodAssignment
- type NodePool
- type NodeRunResult
- type NodeRunResults
- type PriceDetails
- type Recommendation
- type Recommendations
- type Recommender
- type ScalerRecommendations
- type Scenario
- type ShootAccess
- type StrategyWeights
- type VirtualClusterAccess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllPricing ¶
type AllPricing struct {
Results []InstancePricing `json:"results"`
}
type Engine ¶
type Engine interface {
http.Handler
VirtualClusterAccess() VirtualClusterAccess
ShootAccess(shootName string) ShootAccess
SyncVirtualNodesWithShoot(ctx context.Context, shootName string) error
ScaleWorkerPoolsTillMaxOrNoUnscheduledPods(ctx context.Context, scenarioName string, since time.Time, shoot *gardencore.Shoot, w http.ResponseWriter) (int, error)
ScaleAllWorkerPoolsTillMax(ctx context.Context, scenarioName string, shoot *gardencore.Shoot, w http.ResponseWriter) (int, error)
ScaleWorkerPoolsTillNumZonesMultPoolsMax(ctx context.Context, scenarioName string, shoot *gardencore.Shoot, w http.ResponseWriter) (int, error)
ScaleWorkerPoolTillMax(ctx context.Context, scenarioName string, pool *gardencore.Worker, w http.ResponseWriter) (int, error)
}
Engine is the primary simulation driver facade of the scaling simulator. Since Engine register routes for driving simulation scenarios it extends http.Handler
type InstancePricing ¶
type InstancePricing struct {
InstanceType string `json:"instance_type"`
VCPU float64 `json:"vcpu"`
Memory float64 `json:"memory"`
EDPPrice PriceDetails `json:"edp_price"`
}
type NodePodAssignment ¶
type NodePodAssignment struct {
NodeName string `json:"nodeName"`
ZoneName string `json:"zoneName"`
PoolName string `json:"poolName"`
InstanceType string `json:"instanceType"`
PodNames []string `json:"podNames"`
}
func (NodePodAssignment) String ¶
func (n NodePodAssignment) String() string
type NodeRunResult ¶
type NodeRunResult struct {
NodeName string
Pool *gardencore.Worker
MemoryWasteRatio float64
CPUWasteRatio float64
UnscheduledRatio float64
CostRatio float64
CumulativeScore float64
//NumAssignedPods int
NumAssignedPodsToNode int
NumAssignedPodsTotal int
}
func (NodeRunResult) String ¶
func (n NodeRunResult) String() string
type NodeRunResults ¶
type NodeRunResults map[string]NodeRunResult
func (NodeRunResults) GetTotalAssignedPods ¶
func (ns NodeRunResults) GetTotalAssignedPods() int
func (NodeRunResults) GetWinner ¶
func (ns NodeRunResults) GetWinner() NodeRunResult
type PriceDetails ¶
type Recommendation ¶
type Recommendations ¶
type Recommendations map[string]*Recommendation
func (Recommendations) String ¶
func (r Recommendations) String() string
type Recommender ¶
type Recommender struct {
Engine Engine
ScenarioName string
ShootName string
StrategyWeights StrategyWeights
LogWriter http.ResponseWriter
}
type ScalerRecommendations ¶
func (ScalerRecommendations) String ¶
func (s ScalerRecommendations) String() string
type Scenario ¶
type Scenario interface {
http.Handler
Description() string
// Name is the name of this scenario
Name() string
//ShootName is the name of the shoot that the scenario executes against
ShootName() string
}
Scenario represents a scaling simulation scenario. Each scenario is invocable by an HTTP endpoint and hence extends http.Handler
type ShootAccess ¶
type ShootAccess interface {
// ProjectName returns the project name that the shoot belongs to
ProjectName() string
// GetShootObj returns the shoot object describing the shoot cluster
GetShootObj() (*gardencore.Shoot, error)
// GetNodes returns slice of nodes of the shoot cluster
GetNodes() ([]*corev1.Node, error)
// GetUnscheduledPods returns slice of unscheduled pods of the shoot cluster
GetUnscheduledPods() ([]corev1.Pod, error)
GetDSPods() ([]corev1.Pod, error)
// GetMachineDeployments returns slice of machine deployments of the shoot cluster
GetMachineDeployments() ([]*machinev1alpha1.MachineDeployment, error)
// ScaleMachineDeployment scales the given machine deployment to the given number of replicas
ScaleMachineDeployment(machineDeploymentName string, replicas int32) error
// CreatePods creates the given slice of k8s Pods in the shoot cluster
CreatePods(filePath string, replicas int) error
TaintNodes() error
UntaintNodes() error
DeleteAllPods() error
CleanUp() error
}
ShootAccess is a facade to the real-world shoot data and real shoot cluster
type StrategyWeights ¶
type VirtualClusterAccess ¶
type VirtualClusterAccess interface {
// KubeConfigPath gets path to the kubeconfig.yaml file that can be used by kubectl to connect to this vitual cluster
KubeConfigPath() string
// AddNodesAndUpdateLabels adds the given slice of k8s Nodes to the virtual cluster
AddNodesAndUpdateLabels(context.Context, ...*corev1.Node) error
AddNodes(ctx context.Context, nodes ...*corev1.Node) error
// RemoveAllTaintsFromVirtualNodes removes the NoSchedule taint from all nodes in the virtual cluster
RemoveAllTaintsFromVirtualNodes(context.Context) error
// RemoveAllTaintsFromVirtualNode removes the NoSchedule taint from the given node in the virtual cluster
RemoveAllTaintsFromVirtualNode(context.Context, string) error
RemoveTaintFromVirtualNodes(ctx context.Context, taintKey string) error
RemoveTaintFromVirtualNode(ctx context.Context, nodeName, taintKey string) error
// AddTaintToNode adds the NoSchedule taint from the given node in the virtual cluster
AddTaintToNode(context.Context, *corev1.Node) error
// CreatePods creates the given slice of k8s Pods in the virtual cluster
CreatePods(context.Context, string, ...corev1.Pod) error
// AddPods adds pods in the virtual cluster
AddPods(context.Context, ...corev1.Pod) error
CreatePodsWithNodeAndScheduler(ctx context.Context, schedulerName string, nodeName string, pods ...corev1.Pod) error
// CreatePodsFromYaml loads the pod yaml at the given podYamlPath and creates Pods for given number of replicas.
CreatePodsFromYaml(ctx context.Context, podYamlPath string, replicas int) error
// ApplyK8sObject applies all Objects into the virtual cluster
ApplyK8sObject(context.Context, ...runtime.Object) error
// ClearAll clears all k8s objects from the virtual cluster.
ClearAll(ctx context.Context) error
// ClearNodes clears all nodes from the virtual cluster
ClearNodes(context.Context) error
// UpdateNodes updated nodes in the virtual cluster
UpdateNodes(ctx context.Context, nodes ...corev1.Node) error
// ClearPods clears all nodes from the virtual cluster
ClearPods(context.Context) error
// Shutdown shuts down all components of the virtualcluster cluster. Log all errors encountered during shutdown
Shutdown()
GetPod(ctx context.Context, fullName types.NamespacedName) (*corev1.Pod, error)
GetPods(ctx context.Context, namespace string, podNames []string) ([]corev1.Pod, error)
GetNode(ctx context.Context, namespaceName types.NamespacedName) (*corev1.Node, error)
ListEvents(cts context.Context) ([]corev1.Event, error)
ListNodes(ctx context.Context) ([]corev1.Node, error)
ListNodesInNodePool(ctx context.Context, nodePoolName string) ([]corev1.Node, error)
// ListPods lists all pods from all namespaces
ListPods(ctx context.Context) ([]corev1.Pod, error)
// TrimCluster deletes unused nodes and daemonset pods on these nodes
TrimCluster(ctx context.Context) error
UpdatePods(ctx context.Context, pods ...corev1.Pod) error
DeleteNode(ctx context.Context, name string) error
DeletePods(ctx context.Context, pods ...corev1.Pod) error
DeleteNodesWithMatchingLabels(ctx context.Context, labels map[string]string) error
DeletePodsWithMatchingLabels(ctx context.Context, labels map[string]string) error
ListNodesMatchingLabels(ctx context.Context, labels map[string]string) ([]corev1.Node, error)
ListPodsMatchingLabels(ctx context.Context, labels map[string]string) ([]corev1.Pod, error)
ListPodsMatchingPodNames(ctx context.Context, namespace string, podNames []string) ([]corev1.Pod, error)
GetReferenceNode(instanceType string) (*corev1.Node, error)
InitializeReferenceNodes(ctx context.Context) error
}
VirtualClusterAccess represents access to the virtualcluster cluster managed by the simulator that shadows the real cluster
Click to show internal directories.
Click to hide internal directories.