environment

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoWatch  = "NoWatch"
	NoEvents = "NoEvents"
)

Variables

View Source
var (
	TestLabelName    = "testing.karpenter.sh/test-id"
	CleanableObjects = []client.Object{
		&v1.Pod{},
		&appsv1.Deployment{},
		&appsv1.DaemonSet{},
		&policyv1.PodDisruptionBudget{},
		&v1.PersistentVolumeClaim{},
		&v1.PersistentVolume{},
		&storagev1.StorageClass{},
		&v1alpha1.AWSNodeTemplate{},
		&v1alpha5.Provisioner{},
	}
)

Functions

func DiscoverClusterName

func DiscoverClusterName(config *rest.Config) (string, error)

func NewClient

func NewClient(config *rest.Config) (client.Client, error)

func NewConfig

func NewConfig() *rest.Config

Types

type Environment

type Environment struct {
	context.Context
	ClusterName       string
	Region            string
	Client            client.Client
	KubeClient        kubernetes.Interface
	EC2API            ec2.EC2
	SSMAPI            ssm.SSM
	IAMAPI            iam.IAM
	Monitor           *Monitor
	StartingNodeCount int
}

func NewEnvironment

func NewEnvironment(t *testing.T) (*Environment, error)

func (*Environment) AfterEach

func (env *Environment) AfterEach()

func (*Environment) BeforeEach

func (env *Environment) BeforeEach()

nolint:gocyclo

func (*Environment) EventuallyExpectAvgUtilization added in v0.15.0

func (env *Environment) EventuallyExpectAvgUtilization(resource v1.ResourceName, comparator string, value float64)

func (*Environment) EventuallyExpectCreatedNodeCount added in v0.16.2

func (env *Environment) EventuallyExpectCreatedNodeCount(comparator string, nodeCount int)

func (*Environment) EventuallyExpectHealthy

func (env *Environment) EventuallyExpectHealthy(pods ...*v1.Pod)

func (*Environment) EventuallyExpectHealthyPodCount

func (env *Environment) EventuallyExpectHealthyPodCount(selector labels.Selector, numPods int)

func (*Environment) EventuallyExpectKarpenterWithEnvVar

func (env *Environment) EventuallyExpectKarpenterWithEnvVar(envVar v1.EnvVar)

func (*Environment) EventuallyExpectMinUtilization added in v0.15.0

func (env *Environment) EventuallyExpectMinUtilization(resource v1.ResourceName, comparator string, value float64)

func (*Environment) EventuallyExpectNotFound added in v0.16.0

func (env *Environment) EventuallyExpectNotFound(objects ...client.Object)

func (*Environment) ExpectCreated

func (env *Environment) ExpectCreated(objects ...client.Object)

func (*Environment) ExpectCreatedNodeCount

func (env *Environment) ExpectCreatedNodeCount(comparator string, nodeCount int)

func (*Environment) ExpectDeleted

func (env *Environment) ExpectDeleted(objects ...client.Object)

func (*Environment) ExpectInstance added in v0.15.0

func (env *Environment) ExpectInstance(nodeName string) Assertion

func (*Environment) ExpectUniqueNodeNames added in v0.16.2

func (env *Environment) ExpectUniqueNodeNames(selector labels.Selector, uniqueNames int)

func (*Environment) ExpectUpdate added in v0.15.0

func (env *Environment) ExpectUpdate(objects ...client.Object)

func (*Environment) GetInstance added in v0.15.0

func (env *Environment) GetInstance(nodeName string) ec2.Instance

func (*Environment) GetNode added in v0.16.0

func (env *Environment) GetNode(nodeName string) v1.Node

func (*Environment) GetVolume added in v0.15.0

func (env *Environment) GetVolume(volumeID *string) ec2.Volume

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor is used to monitor the cluster state during a running test

func NewMonitor

func NewMonitor(ctx context.Context, kubeClient client.Client) *Monitor

func (*Monitor) AvgUtilization added in v0.15.0

func (m *Monitor) AvgUtilization(resource v1.ResourceName) float64

func (*Monitor) CreatedNodes

func (m *Monitor) CreatedNodes() int

CreatedNodes returns the number of nodes created since the last reset

func (*Monitor) GetCreatedNodes added in v0.16.0

func (m *Monitor) GetCreatedNodes() []v1.Node

func (*Monitor) GetNodes

func (m *Monitor) GetNodes() []v1.Node

GetNodes returns the most recent recording of nodes

func (*Monitor) MinUtilization added in v0.15.0

func (m *Monitor) MinUtilization(resource v1.ResourceName) float64

func (*Monitor) NodeCount

func (m *Monitor) NodeCount() int

NodeCount returns the current number of nodes

func (*Monitor) NodeCountAtReset

func (m *Monitor) NodeCountAtReset() int

NodeCountAtReset returns the number of nodes that were running when the monitor was last reset, typically at the beginning of a test

func (*Monitor) Reset

func (m *Monitor) Reset()

Reset resets the cluster monitor prior to running a test.

func (*Monitor) RestartCount

func (m *Monitor) RestartCount() map[string]int

RestartCount returns the containers and number of restarts for that container for all containers in the pods in the given namespace

func (*Monitor) RunningPods

func (m *Monitor) RunningPods(selector labels.Selector) []*v1.Pod

RunningPods returns the number of running pods matching the given selector

func (*Monitor) RunningPodsCount added in v0.16.2

func (m *Monitor) RunningPodsCount(selector labels.Selector) int

func (*Monitor) TotalNodesSeen

func (m *Monitor) TotalNodesSeen() int

TotalNodesSeen returns the total number of unique nodes ever seen since the last reset.

Jump to

Keyboard shortcuts

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