status

package
v1.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package status contains code for determining the current state of the world, including which pods belong to a load test.

Package status contains code for determining the current state of the world, including the health of a load test and its resources.

Index

Constants

View Source
const DefaultClientPool = "__default_pool (clients)"

DefaultClientPool is a key in the NodeCountByPool map on the LoadTestMissing struct. It maps to the number of nodes required from the default client pool.

View Source
const DefaultDriverPool = "__default_pool (drivers)"

DefaultDriverPool is a key in the NodeCountByPool map on the LoadTestMissing struct. It maps to the number of nodes required from the default driver pool.

View Source
const DefaultServerPool = "__default_pool (servers)"

DefaultServerPool is a key in the NodeCountByPool map on the LoadTestMissing struct. It maps to the number of nodes required from the default server pool.

Variables

This section is empty.

Functions

func ForLoadTest

func ForLoadTest(test *grpcv1.LoadTest, pods []*corev1.Pod) grpcv1.LoadTestStatus

ForLoadTest creates and returns a LoadTestStatus, given a load test and the pods it owns. This sets the state, reason and message for the load test. In addition, it attempts to set the start and stop times based on what has been previously encountered.

func PodsForLoadTest

func PodsForLoadTest(loadtest *grpcv1.LoadTest, allPods []corev1.Pod) []*corev1.Pod

PodsForLoadTest returns a slice of pointers to pods which belong to a specific load test. It accepts the load test to match and a list of all pods to consider. If none of the pods match, an empty slice is returned.

Types

type LoadTestMissing

type LoadTestMissing struct {
	// Driver is the component that orchestrates the test. If Driver is not set
	// that means we already have the Driver running.
	Driver *grpcv1.Driver

	// Servers are a list of components that receive traffic from. The list
	// indicates the Servers still in need.
	Servers []grpcv1.Server

	// Clients are a list of components that send traffic to servers. The list
	// indicates the Clients still in need.
	Clients []grpcv1.Client

	// NodeCountPyPool is a map which gives the number of nodes required from
	// each pool to run the test. These counts will not include any pods from
	// the test that have already been scheduled. The names of the required node
	// pools are the keys and the value is the number of nodes required from the
	// named pool.
	//
	// If a test does not require any nodes from a pool, the pool name will not
	// be present as a key in the map. If a driver, client or server has not
	// been scheduled for a test and does not specify a pool, it will be counted
	// in one of the default pool keys. See the DefaultClientPool,
	// DefaultDriverPool and DefaultServerPool constants.
	NodeCountByPool map[string]int
}

LoadTestMissing defines missing pods of LoadTest.

func CheckMissingPods

func CheckMissingPods(test *grpcv1.LoadTest, ownedPods []*corev1.Pod) *LoadTestMissing

CheckMissingPods attempts to check if any required component is missing from the current load test. It takes reference of the current load test and a pod list that contains all running pods at the moment, returning all missing components required from the current load test with their roles.

func (*LoadTestMissing) IsEmpty added in v0.4.0

func (ltm *LoadTestMissing) IsEmpty() bool

IsEmpty returns true if there are no missing driver, servers or clients on a LoadTestMissing struct. Otherwise, it returns false.

type State

type State string

State reflects the observed state of a resource.

const (
	// Pending indicates that the resource has not yet been observed as
	// succeeding or failing.
	Pending State = "Pending"

	// Succeeded indicates that the resource has terminated successfully,
	// marked by a zero exit code.
	Succeeded State = "Succeeded"

	// Errored indicates that the resource has terminated unsuccessfully,
	// marked by a non-zero exit code.
	Errored State = "Errored"
)

func StateForContainerStatus

func StateForContainerStatus(status *corev1.ContainerStatus) (State, *int32)

StateForContainerStatus accepts the status of a container and returns a ContainerState and a pointer to the integer exit code. If the container has not terminated, a Pending state and nil pointer are returned.

func StateForPodStatus

func StateForPodStatus(status *corev1.PodStatus) (state State, reason string, message string)

StateForPodStatus accepts the status of a pod and returns a State, as well as the reason and message. The reason is a camel-case word that is machine comparable. The message is a human-legible description. If the pod has not terminated or it terminated successfully, the reason and message strings will be empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL