environment

package
v0.14.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestLabelName    = "testing.karpenter.sh/test-id"
	CleanableObjects = []client.Object{
		&v1.Pod{},
		&appsv1.Deployment{},
		&appsv1.DaemonSet{},
		&v1beta1.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
	Client      client.Client
	KubeClient  kubernetes.Interface
	EC2API      ec2.EC2
	SSMAPI      ssm.SSM
	Monitor     *Monitor
}

func NewEnvironment

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

func (*Environment) AfterEach

func (env *Environment) AfterEach()

func (*Environment) BeforeEach

func (env *Environment) BeforeEach()

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) 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) ExpectNodesEventuallyDeleted

func (env *Environment) ExpectNodesEventuallyDeleted(timeout time.Duration, nodes ...*v1.Node)

func (*Environment) GetCreatedNodes

func (env *Environment) GetCreatedNodes(before []v1.Node, after []v1.Node) []*v1.Node

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) CreatedNodes

func (m *Monitor) CreatedNodes() int

CreatedNodes returns the number of nodes created since the last reset

func (*Monitor) GetNodes

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

GetNodes returns the most recent recording of nodes

func (*Monitor) NodeCount

func (m *Monitor) NodeCount() int

NodeCount returns the current number of nodes

func (*Monitor) NodeCountAtReset

func (m *Monitor) NodeCountAtReset() interface{}

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) int

RunningPods returns the number of running pods matching the given selector

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