Documentation ¶
Index ¶
- Variables
- func AdjustPods(pods []corev1.Pod) []corev1.Pod
- func ApplyDsPodsToNodes(ctx context.Context, v scalesim.VirtualClusterAccess, dsPods []corev1.Pod) error
- func AsJson(nodePodAssignments []scalesim.NodePodAssignment) (string, error)
- func ComparePriceDescending(n1, n2 corev1.Node) int
- func ComputeNodeWaste(node *corev1.Node, pods []corev1.Pod) resource.Quantity
- func CreateNodeInWorkerGroup(ctx context.Context, a scalesim.VirtualClusterAccess, wg *v1beta1.Worker) (*corev1.Node, error)
- func CreateNodeInWorkerGroupForZone(ctx context.Context, a scalesim.VirtualClusterAccess, zone, region string, ...) (bool, error)
- func CreateNodesTillPoolMax(ctx context.Context, a scalesim.VirtualClusterAccess, wg *v1beta1.Worker) (int, error)
- func CreateNodesTillZonexPoolMax(ctx context.Context, a scalesim.VirtualClusterAccess, region string, ...) error
- func DeleteAssignedPods(unscheduledPods []corev1.Pod, allAssignedPods []corev1.Pod) []corev1.Pod
- func DeleteNodeAndPods(ctx context.Context, w http.ResponseWriter, ...) error
- func DeleteNodeAndResetPods(ctx context.Context, a scalesim.VirtualClusterAccess, nodeName string, ...) ([]corev1.Pod, time.Time, error)
- func EmptyOr(val string, defaultVal string) string
- func GenerateRandomString(length int) (string, error)
- func GetAllAssignedPods(ctx context.Context, a scalesim.VirtualClusterAccess) ([]corev1.Pod, error)
- func GetFailedSchedulingEvents(ctx context.Context, a scalesim.VirtualClusterAccess, since time.Time) ([]corev1.Event, error)
- func GetMatchingPods(allPods []corev1.Pod, filterPods []corev1.Pod) []corev1.Pod
- func GetNodePodAssignments(ctx context.Context, a scalesim.VirtualClusterAccess) ([]scalesim.NodePodAssignment, error)
- func GetNodesSet(ctx context.Context, a scalesim.VirtualClusterAccess) (map[string]*corev1.Node, error)
- func GetPodSchedulingEvents(ctx context.Context, vca scalesim.VirtualClusterAccess, podNames []string, ...) ([]corev1.Event, error)
- func GetPodsAssignedToNode(ctx context.Context, a scalesim.VirtualClusterAccess, nodeName string) ([]corev1.Pod, error)
- func GetPodsOnNode(ctx context.Context, virtualAccess scalesim.VirtualClusterAccess, ...) ([]corev1.Pod, error)
- func GetScalerRecommendation(ctx context.Context, a scalesim.VirtualClusterAccess, ...) (scalesim.ScalerRecommendations, error)
- func GetUnscheduledPodCount(ctx context.Context, access scalesim.VirtualClusterAccess) (int, error)
- func IsExistingNode(n *corev1.Node) bool
- func LogError(w http.ResponseWriter, scenarioName string, err error)
- func PodNames(pods []corev1.Pod) []string
- func PrintScheduledPodEvents(ctx context.Context, a scalesim.VirtualClusterAccess, since time.Time, ...) error
- func RunConcurrently(ctx context.Context, tasks []Task, bound int) []error
- func WaitAndGetUnscheduledPodCount(ctx context.Context, access scalesim.VirtualClusterAccess, waitSec int) (int, error)
- func WaitForAndRecordPodSchedulingEvents(ctx context.Context, vca scalesim.VirtualClusterAccess, w http.ResponseWriter, ...) (scheduledPodNames sets.Set[string], unscheduledPodNames sets.Set[string], ...)
- func WaitTillNoUnscheduledPodsOrTimeout(ctx context.Context, access scalesim.VirtualClusterAccess, ...) (int, error)
- type PodBuilder
- func (p *PodBuilder) AddLabels(labels map[string]string) *PodBuilder
- func (p *PodBuilder) Build() (*corev1.Pod, error)
- func (p *PodBuilder) GenerateName(generateName string) *PodBuilder
- func (p *PodBuilder) Name(name string) *PodBuilder
- func (p *PodBuilder) Namespace(namespace string) *PodBuilder
- func (p *PodBuilder) NodeName(nodeName string) *PodBuilder
- func (p *PodBuilder) RequestCPU(quantity string) *PodBuilder
- func (p *PodBuilder) RequestMemory(quantity string) *PodBuilder
- func (p *PodBuilder) SchedulerName(schedulerName string) *PodBuilder
- func (p *PodBuilder) TopologySpreadConstraint(topologyKey *string, maxSkew *int, labels map[string]string) *PodBuilder
- type RunGroup
- type Task
Constants ¶
This section is empty.
Variables ¶
var ErrorEncapsulatingPanic = errors.New("panic has occurred")
ErrorEncapsulatingPanic is a sentinel error indicating that there has been a panic which has been captured as an error and returned as value.
Functions ¶
func ApplyDsPodsToNodes ¶
func ComparePriceDescending ¶
func ComputeNodeWaste ¶
func CreateNodeInWorkerGroup ¶
func CreateNodeInWorkerGroup(ctx context.Context, a scalesim.VirtualClusterAccess, wg *v1beta1.Worker) (*corev1.Node, error)
CreateNodeInWorkerGroup creates a sample node if the passed workerGroup objects max has not been met
func CreateNodesTillPoolMax ¶
func CreateNodesTillPoolMax(ctx context.Context, a scalesim.VirtualClusterAccess, wg *v1beta1.Worker) (int, error)
CreateNodesTillPoolMax creates sample nodes in the given worker pool till the worker pool max is reached.
func CreateNodesTillZonexPoolMax ¶
func CreateNodesTillZonexPoolMax(ctx context.Context, a scalesim.VirtualClusterAccess, region string, wg *v1beta1.Worker) error
CreateNodesTillZonexPoolMax creates sample nodes in the given worker pool till the worker pool max is reached.
func DeleteAssignedPods ¶
func DeleteNodeAndPods ¶
func DeleteNodeAndResetPods ¶
func GenerateRandomString ¶
func GetAllAssignedPods ¶
func GetFailedSchedulingEvents ¶
func GetFailedSchedulingEvents(ctx context.Context, a scalesim.VirtualClusterAccess, since time.Time) ([]corev1.Event, error)
GetFailedSchedulingEvents get all FailedSchedulingEvents whose referenced pod does not have a node assigned FIXME: This should take a since time.Time which is the scenario start time.
func GetMatchingPods ¶
func GetNodePodAssignments ¶
func GetNodePodAssignments(ctx context.Context, a scalesim.VirtualClusterAccess) ([]scalesim.NodePodAssignment, error)
func GetNodesSet ¶
func GetPodSchedulingEvents ¶
func GetPodsAssignedToNode ¶
func GetPodsOnNode ¶
func GetScalerRecommendation ¶
func GetScalerRecommendation(ctx context.Context, a scalesim.VirtualClusterAccess, assignments []scalesim.NodePodAssignment) (scalesim.ScalerRecommendations, error)
func GetUnscheduledPodCount ¶
func IsExistingNode ¶
func PrintScheduledPodEvents ¶
func PrintScheduledPodEvents(ctx context.Context, a scalesim.VirtualClusterAccess, since time.Time, w http.ResponseWriter) error
func RunConcurrently ¶
RunConcurrently runs tasks concurrently with number of goroutines bounded by bound. If there is a panic executing a single Task then it will capture the panic and capture it as an error which will then subsequently be returned from this function. It will not propagate the panic causing the app to exit.
Types ¶
type PodBuilder ¶
type PodBuilder struct {
// contains filtered or unexported fields
}
func NewPodBuilder ¶
func NewPodBuilder() *PodBuilder
func (*PodBuilder) AddLabels ¶
func (p *PodBuilder) AddLabels(labels map[string]string) *PodBuilder
func (*PodBuilder) GenerateName ¶
func (p *PodBuilder) GenerateName(generateName string) *PodBuilder
func (*PodBuilder) Name ¶
func (p *PodBuilder) Name(name string) *PodBuilder
func (*PodBuilder) Namespace ¶
func (p *PodBuilder) Namespace(namespace string) *PodBuilder
func (*PodBuilder) NodeName ¶
func (p *PodBuilder) NodeName(nodeName string) *PodBuilder
func (*PodBuilder) RequestCPU ¶
func (p *PodBuilder) RequestCPU(quantity string) *PodBuilder
func (*PodBuilder) RequestMemory ¶
func (p *PodBuilder) RequestMemory(quantity string) *PodBuilder
func (*PodBuilder) SchedulerName ¶
func (p *PodBuilder) SchedulerName(schedulerName string) *PodBuilder
func (*PodBuilder) TopologySpreadConstraint ¶
func (p *PodBuilder) TopologySpreadConstraint(topologyKey *string, maxSkew *int, labels map[string]string) *PodBuilder
type RunGroup ¶
type RunGroup struct {
// contains filtered or unexported fields
}
RunGroup is a runner for concurrently spawning multiple asynchronous tasks. If any task errors or panics then these are captured as errors.
func NewRunGroup ¶
NewRunGroup creates a new RunGroup.
func (*RunGroup) WaitAndCollectErrors ¶
WaitAndCollectErrors waits for all tasks to finish, collects and returns any errors.
type Task ¶
type Task struct { // Name is the name of the task Name string // Fn is the function which accepts a context and returns an error if there is one. // Implementations of Fn should handle context cancellation properly. Fn func(ctx context.Context) error }
Task is a holder for a named function.