status

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 6 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

This section is empty.

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 `json:"driver,omitempty"`

	// Servers are a list of components that receive traffic from. The list
	// indicates the Servers still in need.
	Servers []grpcv1.Server `json:"servers,omitempty"`

	// Clients are a list of components that send traffic to servers. The list
	// indicates the Clients still in need.
	Clients []grpcv1.Client `json:"clients,omitempty"`
}

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.

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