Documentation ¶
Index ¶
- func GetPodUsage(spec []specPhase, executedSeconds int32) v1.ResourceList
- type Metrics
- type Pod
- func (pod *Pod) BuildStatus(clock clock.Clock) v1.PodStatus
- func (pod *Pod) Delete(clock clock.Clock)
- func (pod *Pod) FreezeUsage(clock clock.Clock)
- func (pod *Pod) HasFailedToStart() bool
- func (pod *Pod) IsDeleted(clk clock.Clock) bool
- func (pod *Pod) IsRunning(clock clock.Clock) bool
- func (pod *Pod) IsTerminated(clock clock.Clock) bool
- func (pod *Pod) IsTerminating(clock clock.Clock) bool
- func (pod *Pod) Metrics(clock clock.Clock) Metrics
- func (pod *Pod) ResourceUsage(clock clock.Clock) v1.ResourceList
- func (pod *Pod) ToV1() *v1.Pod
- func (pod *Pod) TotalResourceLimits() v1.ResourceList
- func (pod *Pod) TotalResourceRequests() v1.ResourceList
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPodUsage ¶
func GetPodUsage(spec []specPhase, executedSeconds int32) v1.ResourceList
Types ¶
type Metrics ¶
type Metrics struct { ResourceRequest v1.ResourceList ResourceLimit v1.ResourceList ResourceUsage v1.ResourceList Runtime int32 BoundAt clock.Clock Node string ExecutedSeconds int32 Priority int32 Status Status }
Metrics is a metrics of a pod at one time point.
type Pod ¶
type Pod struct {
// contains filtered or unexported fields
}
Pod represents a simulated pod.
func NewPod ¶
NewPod creates a pod with the given v1.Pod, the clock at which the pod was bound to a node, and the pod's status. Returns error if fails to parse the simulation spec of the pod.
func (*Pod) BuildStatus ¶
BuildStatus builds a status of this Pod at the given clock, assuming that this Pod has not been deleted (but it can be terminating).
func (*Pod) FreezeUsage ¶
func (*Pod) HasFailedToStart ¶
HasFailedToStart returns whether this Pod has failed to start to a node.
func (*Pod) IsRunning ¶
IsRunning returns whether this Pod is running at the given clock. Returns false if this Pod has failed to start.
func (*Pod) IsTerminated ¶
IsTerminated returns whether this Pod is terminated at the clock. If this Pod failed to start, false is returned.
func (*Pod) IsTerminating ¶
IsTerminating returns whether this Pod is terminating (i.e. in its grace period).
func (*Pod) ResourceUsage ¶
func (pod *Pod) ResourceUsage(clock clock.Clock) v1.ResourceList
ResourceUsage returns resource usage of this Pod at the given clock.
func (*Pod) TotalResourceLimits ¶
func (pod *Pod) TotalResourceLimits() v1.ResourceList
TotalResourceLimits extracts the total amount of resource limits of this Pod.
func (*Pod) TotalResourceRequests ¶
func (pod *Pod) TotalResourceRequests() v1.ResourceList
TotalResourceRequests extracts the total amount of resource requested by this Pod.
type Status ¶
type Status int
Status represents status of a Pod.
const ( // Ok indicates that the pod has been successfully started on a node. // Whether the pod is running or has spontaneously terminated is determined by its total // execution time and the clock. Ok Status = iota // Deleted indicates that the pod has been deleted from the cluster. // Whether the pod is terminating (i.e., in its grace period) or has been deleted is determined // by the length of its grace period and the clock. Deleted // OverCapacity indicates that the pod failed to start due to over capacity. OverCapacity )
func (Status) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface.