Documentation ¶
Index ¶
- Constants
- Variables
- func NewClient(ctx context.Context, config *rest.Config) client.Client
- func NewConfig() *rest.Config
- func NodeClaimNames(nodeClaims []*karpv1.NodeClaim) []string
- func NodeNames(nodes []*corev1.Node) []string
- type ContextKey
- type Environment
- func (env *Environment) AfterEach()
- func (env *Environment) ArmNodepool(nodeClass *v1alpha2.AKSNodeClass) *karpv1.NodePool
- func (env *Environment) BeforeEach()
- func (env *Environment) Cleanup()
- func (env *Environment) CleanupObjects(cleanableObjects ...client.Object)
- func (env *Environment) ConsistentlyExpectDisruptionsWithNodeCount(disruptingNodes, totalNodes int, duration time.Duration) (taintedNodes []*corev1.Node)
- func (env *Environment) ConsistentlyExpectHealthyPods(duration time.Duration, pods ...*corev1.Pod)
- func (env *Environment) ConsistentlyExpectNoDisruptions(nodeCount int, duration time.Duration) (taintedNodes []*corev1.Node)
- func (env *Environment) ConsistentlyExpectNodeClaimsNotDrifted(duration time.Duration, nodeClaims ...*karpv1.NodeClaim)
- func (env *Environment) ConsistentlyExpectNodeCount(comparator string, count int, duration time.Duration) []*corev1.Node
- func (env *Environment) ConsistentlyExpectTerminatingPods(duration time.Duration, pods ...*corev1.Pod)
- func (env *Environment) DefaultNodePool(nodeClass *v1alpha2.AKSNodeClass) *karpv1.NodePool
- func (env *Environment) EventuallyExpectAvgUtilization(resource corev1.ResourceName, comparator string, value float64)
- func (env *Environment) EventuallyExpectBound(pods ...*corev1.Pod)
- func (env *Environment) EventuallyExpectBoundPodCount(selector labels.Selector, numPods int) []*corev1.Pod
- func (env *Environment) EventuallyExpectConsolidatable(nodeClaims ...*karpv1.NodeClaim)
- func (env *Environment) EventuallyExpectCreatedNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
- func (env *Environment) EventuallyExpectCreatedNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) EventuallyExpectDeletedNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) EventuallyExpectDeletedNodeCountWithSelector(comparator string, count int, selector labels.Selector) []*corev1.Node
- func (env *Environment) EventuallyExpectDrifted(nodeClaims ...*karpv1.NodeClaim)
- func (env *Environment) EventuallyExpectHealthy(pods ...*corev1.Pod)
- func (env *Environment) EventuallyExpectHealthyPodCount(selector labels.Selector, numPods int) []*corev1.Pod
- func (env *Environment) EventuallyExpectHealthyPodCountWithTimeout(timeout time.Duration, selector labels.Selector, numPods int) []*corev1.Pod
- func (env *Environment) EventuallyExpectHealthyWithTimeout(timeout time.Duration, pods ...*corev1.Pod)
- func (env *Environment) EventuallyExpectInitializedNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) EventuallyExpectKarpenterRestarted()
- func (env *Environment) EventuallyExpectMinUtilization(resource corev1.ResourceName, comparator string, value float64)
- func (env *Environment) EventuallyExpectNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
- func (env *Environment) EventuallyExpectNodeClaimsReady(nodeClaims ...*karpv1.NodeClaim)
- func (env *Environment) EventuallyExpectNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) EventuallyExpectNodeCountWithSelector(comparator string, count int, selector labels.Selector) []*corev1.Node
- func (env *Environment) EventuallyExpectNodesUntaintedWithTimeout(timeout time.Duration, nodes ...*corev1.Node)
- func (env *Environment) EventuallyExpectNotFound(objects ...client.Object)
- func (env *Environment) EventuallyExpectNotFoundAssertion(objects ...client.Object) AsyncAssertion
- func (env *Environment) EventuallyExpectPendingPodCount(selector labels.Selector, numPods int)
- func (env *Environment) EventuallyExpectRollout(name, namespace string)
- func (env *Environment) EventuallyExpectTaintedNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) EventuallyExpectTerminating(pods ...*corev1.Pod)
- func (env *Environment) EventuallyExpectTerminatingWithTimeout(timeout time.Duration, pods ...*corev1.Pod)
- func (env *Environment) EventuallyExpectUniqueNodeNames(selector labels.Selector, uniqueNames int)
- func (env *Environment) ExpectActiveKarpenterPod() *corev1.Pod
- func (env *Environment) ExpectActiveKarpenterPodName() string
- func (env *Environment) ExpectActivePodsForNode(nodeName string) []*corev1.Pod
- func (env *Environment) ExpectCABundle() string
- func (env *Environment) ExpectCleanCluster()
- func (env *Environment) ExpectConfigMapDataOverridden(key types.NamespacedName, data ...map[string]string) (changed bool)
- func (env *Environment) ExpectConfigMapDataReplaced(key types.NamespacedName, data ...map[string]string) (changed bool)
- func (env *Environment) ExpectConfigMapExists(key types.NamespacedName) *corev1.ConfigMap
- func (env *Environment) ExpectCreated(objects ...client.Object)
- func (env *Environment) ExpectCreatedNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) ExpectCreatedOrUpdated(objects ...client.Object)
- func (env *Environment) ExpectDaemonSetEnvironmentVariableUpdated(obj client.ObjectKey, name, value string, containers ...string)
- func (env *Environment) ExpectDeleted(objects ...client.Object)
- func (env *Environment) ExpectExists(obj client.Object) client.Object
- func (env *Environment) ExpectKarpenterLeaseOwnerChanged()
- func (env *Environment) ExpectKarpenterPods() []*corev1.Pod
- func (env *Environment) ExpectNoCrashes()
- func (env *Environment) ExpectNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
- func (env *Environment) ExpectNodeCount(comparator string, count int) []*corev1.Node
- func (env *Environment) ExpectPodsMatchingSelector(selector labels.Selector) []*corev1.Pod
- func (env *Environment) ExpectSettings() (res []corev1.EnvVar)
- func (env *Environment) ExpectSettingsOverridden(vars ...corev1.EnvVar)
- func (env *Environment) ExpectSettingsRemoved(vars ...corev1.EnvVar)
- func (env *Environment) ExpectSettingsReplaced(vars ...corev1.EnvVar)
- func (env *Environment) ExpectTestingFinalizerRemoved(obj client.Object) error
- func (env *Environment) ExpectUpdated(objects ...client.Object)
- func (env *Environment) ForcePodsToSpread(nodes ...*corev1.Node)
- func (env *Environment) GetDaemonSetCount(np *karpv1.NodePool) int
- func (env *Environment) GetDaemonSetOverhead(np *karpv1.NodePool) corev1.ResourceList
- func (env *Environment) GetNode(nodeName string) corev1.Node
- func (env *Environment) Stop()
- type Monitor
- func (m *Monitor) AvgUtilization(resource corev1.ResourceName) float64
- func (m *Monitor) CreatedNodeCount() int
- func (m *Monitor) CreatedNodes() []*corev1.Node
- func (m *Monitor) DeletedNodes() []*corev1.Node
- func (m *Monitor) MinUtilization(resource corev1.ResourceName) float64
- func (m *Monitor) NodeCount() int
- func (m *Monitor) NodeCountAtReset() int
- func (m *Monitor) Nodes() []*corev1.Node
- func (m *Monitor) NodesAtReset() []*corev1.Node
- func (m *Monitor) PendingPods(selector labels.Selector) []*corev1.Pod
- func (m *Monitor) PendingPodsCount(selector labels.Selector) int
- func (m *Monitor) Reset()
- func (m *Monitor) RestartCount(namespace string) map[string]int
- func (m *Monitor) RunningPods(selector labels.Selector) []*corev1.Pod
- func (m *Monitor) RunningPodsCount(selector labels.Selector) int
Constants ¶
const (
GitRefContextKey = ContextKey("gitRef")
)
const TestingFinalizer = "testing/finalizer"
Variables ¶
var ( CleanableObjects = []client.Object{ &corev1.Pod{}, &appsv1.Deployment{}, &appsv1.StatefulSet{}, &appsv1.DaemonSet{}, &policyv1.PodDisruptionBudget{}, &corev1.PersistentVolumeClaim{}, &corev1.PersistentVolume{}, &storagev1.StorageClass{}, &karpv1.NodePool{}, &corev1.LimitRange{}, &schedulingv1.PriorityClass{}, &corev1.Node{}, &karpv1.NodeClaim{}, &v1alpha2.AKSNodeClass{}, } )
Functions ¶
func NodeClaimNames ¶ added in v0.7.0
Types ¶
type ContextKey ¶
type ContextKey string
type Environment ¶
type Environment struct { context.Context Client client.Client Config *rest.Config KubeClient kubernetes.Interface Monitor *Monitor StartingNodeCount int // contains filtered or unexported fields }
func NewEnvironment ¶
func NewEnvironment(t *testing.T) *Environment
func (*Environment) AfterEach ¶
func (env *Environment) AfterEach()
func (*Environment) ArmNodepool ¶ added in v0.7.0
func (env *Environment) ArmNodepool(nodeClass *v1alpha2.AKSNodeClass) *karpv1.NodePool
func (*Environment) Cleanup ¶
func (env *Environment) Cleanup()
func (*Environment) CleanupObjects ¶
func (env *Environment) CleanupObjects(cleanableObjects ...client.Object)
func (*Environment) ConsistentlyExpectDisruptionsWithNodeCount ¶ added in v0.7.0
func (env *Environment) ConsistentlyExpectDisruptionsWithNodeCount(disruptingNodes, totalNodes int, duration time.Duration) (taintedNodes []*corev1.Node)
ConsistentlyExpectDisruptionsWithNodeCount will continually ensure that there are exactly disruptingNodes with totalNodes (including replacements and existing nodes)
func (*Environment) ConsistentlyExpectHealthyPods ¶ added in v0.7.0
func (env *Environment) ConsistentlyExpectHealthyPods(duration time.Duration, pods ...*corev1.Pod)
func (*Environment) ConsistentlyExpectNoDisruptions ¶ added in v0.7.0
func (*Environment) ConsistentlyExpectNodeClaimsNotDrifted ¶ added in v0.7.0
func (env *Environment) ConsistentlyExpectNodeClaimsNotDrifted(duration time.Duration, nodeClaims ...*karpv1.NodeClaim)
func (*Environment) ConsistentlyExpectNodeCount ¶
func (*Environment) ConsistentlyExpectTerminatingPods ¶ added in v0.7.0
func (env *Environment) ConsistentlyExpectTerminatingPods(duration time.Duration, pods ...*corev1.Pod)
func (*Environment) DefaultNodePool ¶ added in v0.7.0
func (env *Environment) DefaultNodePool(nodeClass *v1alpha2.AKSNodeClass) *karpv1.NodePool
func (*Environment) EventuallyExpectAvgUtilization ¶
func (env *Environment) EventuallyExpectAvgUtilization(resource corev1.ResourceName, comparator string, value float64)
func (*Environment) EventuallyExpectBound ¶ added in v0.7.0
func (env *Environment) EventuallyExpectBound(pods ...*corev1.Pod)
func (*Environment) EventuallyExpectBoundPodCount ¶ added in v0.7.0
func (*Environment) EventuallyExpectConsolidatable ¶ added in v0.7.0
func (env *Environment) EventuallyExpectConsolidatable(nodeClaims ...*karpv1.NodeClaim)
func (*Environment) EventuallyExpectCreatedNodeClaimCount ¶
func (env *Environment) EventuallyExpectCreatedNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
func (*Environment) EventuallyExpectCreatedNodeCount ¶
func (env *Environment) EventuallyExpectCreatedNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) EventuallyExpectDeletedNodeCount ¶
func (env *Environment) EventuallyExpectDeletedNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) EventuallyExpectDeletedNodeCountWithSelector ¶
func (*Environment) EventuallyExpectDrifted ¶ added in v0.6.0
func (env *Environment) EventuallyExpectDrifted(nodeClaims ...*karpv1.NodeClaim)
func (*Environment) EventuallyExpectHealthy ¶
func (env *Environment) EventuallyExpectHealthy(pods ...*corev1.Pod)
func (*Environment) EventuallyExpectHealthyPodCount ¶
func (*Environment) EventuallyExpectHealthyPodCountWithTimeout ¶
func (*Environment) EventuallyExpectHealthyWithTimeout ¶
func (env *Environment) EventuallyExpectHealthyWithTimeout(timeout time.Duration, pods ...*corev1.Pod)
func (*Environment) EventuallyExpectInitializedNodeCount ¶
func (env *Environment) EventuallyExpectInitializedNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) EventuallyExpectKarpenterRestarted ¶
func (env *Environment) EventuallyExpectKarpenterRestarted()
func (*Environment) EventuallyExpectMinUtilization ¶
func (env *Environment) EventuallyExpectMinUtilization(resource corev1.ResourceName, comparator string, value float64)
func (*Environment) EventuallyExpectNodeClaimCount ¶ added in v0.7.0
func (env *Environment) EventuallyExpectNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
func (*Environment) EventuallyExpectNodeClaimsReady ¶
func (env *Environment) EventuallyExpectNodeClaimsReady(nodeClaims ...*karpv1.NodeClaim)
func (*Environment) EventuallyExpectNodeCount ¶
func (env *Environment) EventuallyExpectNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) EventuallyExpectNodeCountWithSelector ¶
func (*Environment) EventuallyExpectNodesUntaintedWithTimeout ¶ added in v0.7.0
func (env *Environment) EventuallyExpectNodesUntaintedWithTimeout(timeout time.Duration, nodes ...*corev1.Node)
func (*Environment) EventuallyExpectNotFound ¶
func (env *Environment) EventuallyExpectNotFound(objects ...client.Object)
func (*Environment) EventuallyExpectNotFoundAssertion ¶
func (env *Environment) EventuallyExpectNotFoundAssertion(objects ...client.Object) AsyncAssertion
func (*Environment) EventuallyExpectPendingPodCount ¶
func (env *Environment) EventuallyExpectPendingPodCount(selector labels.Selector, numPods int)
func (*Environment) EventuallyExpectRollout ¶
func (env *Environment) EventuallyExpectRollout(name, namespace string)
func (*Environment) EventuallyExpectTaintedNodeCount ¶ added in v0.7.0
func (env *Environment) EventuallyExpectTaintedNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) EventuallyExpectTerminating ¶ added in v0.7.0
func (env *Environment) EventuallyExpectTerminating(pods ...*corev1.Pod)
func (*Environment) EventuallyExpectTerminatingWithTimeout ¶ added in v0.7.0
func (env *Environment) EventuallyExpectTerminatingWithTimeout(timeout time.Duration, pods ...*corev1.Pod)
func (*Environment) EventuallyExpectUniqueNodeNames ¶
func (env *Environment) EventuallyExpectUniqueNodeNames(selector labels.Selector, uniqueNames int)
func (*Environment) ExpectActiveKarpenterPod ¶
func (env *Environment) ExpectActiveKarpenterPod() *corev1.Pod
func (*Environment) ExpectActiveKarpenterPodName ¶
func (env *Environment) ExpectActiveKarpenterPodName() string
func (*Environment) ExpectActivePodsForNode ¶ added in v0.7.0
func (env *Environment) ExpectActivePodsForNode(nodeName string) []*corev1.Pod
func (*Environment) ExpectCABundle ¶
func (env *Environment) ExpectCABundle() string
func (*Environment) ExpectCleanCluster ¶
func (env *Environment) ExpectCleanCluster()
func (*Environment) ExpectConfigMapDataOverridden ¶
func (env *Environment) ExpectConfigMapDataOverridden(key types.NamespacedName, data ...map[string]string) (changed bool)
func (*Environment) ExpectConfigMapDataReplaced ¶
func (env *Environment) ExpectConfigMapDataReplaced(key types.NamespacedName, data ...map[string]string) (changed bool)
func (*Environment) ExpectConfigMapExists ¶
func (env *Environment) ExpectConfigMapExists(key types.NamespacedName) *corev1.ConfigMap
func (*Environment) ExpectCreated ¶
func (env *Environment) ExpectCreated(objects ...client.Object)
func (*Environment) ExpectCreatedNodeCount ¶
func (env *Environment) ExpectCreatedNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) ExpectCreatedOrUpdated ¶
func (env *Environment) ExpectCreatedOrUpdated(objects ...client.Object)
ExpectCreatedOrUpdated can update objects in the cluster to match the inputs. WARNING: ExpectUpdated ignores the resource version check, which can result in overwriting changes made by other controllers in the cluster. This is useful in ensuring that we can clean up resources by patching out finalizers. Grab the object before making the updates to reduce the chance of this race.
func (*Environment) ExpectDaemonSetEnvironmentVariableUpdated ¶
func (env *Environment) ExpectDaemonSetEnvironmentVariableUpdated(obj client.ObjectKey, name, value string, containers ...string)
func (*Environment) ExpectDeleted ¶
func (env *Environment) ExpectDeleted(objects ...client.Object)
func (*Environment) ExpectExists ¶
func (env *Environment) ExpectExists(obj client.Object) client.Object
func (*Environment) ExpectKarpenterLeaseOwnerChanged ¶
func (env *Environment) ExpectKarpenterLeaseOwnerChanged()
func (*Environment) ExpectKarpenterPods ¶
func (env *Environment) ExpectKarpenterPods() []*corev1.Pod
func (*Environment) ExpectNoCrashes ¶
func (env *Environment) ExpectNoCrashes()
func (*Environment) ExpectNodeClaimCount ¶ added in v0.7.0
func (env *Environment) ExpectNodeClaimCount(comparator string, count int) []*karpv1.NodeClaim
func (*Environment) ExpectNodeCount ¶ added in v0.7.0
func (env *Environment) ExpectNodeCount(comparator string, count int) []*corev1.Node
func (*Environment) ExpectPodsMatchingSelector ¶
func (env *Environment) ExpectPodsMatchingSelector(selector labels.Selector) []*corev1.Pod
func (*Environment) ExpectSettings ¶
func (env *Environment) ExpectSettings() (res []corev1.EnvVar)
func (*Environment) ExpectSettingsOverridden ¶
func (env *Environment) ExpectSettingsOverridden(vars ...corev1.EnvVar)
func (*Environment) ExpectSettingsRemoved ¶
func (env *Environment) ExpectSettingsRemoved(vars ...corev1.EnvVar)
func (*Environment) ExpectSettingsReplaced ¶
func (env *Environment) ExpectSettingsReplaced(vars ...corev1.EnvVar)
func (*Environment) ExpectTestingFinalizerRemoved ¶ added in v0.7.0
func (env *Environment) ExpectTestingFinalizerRemoved(obj client.Object) error
func (*Environment) ExpectUpdated ¶
func (env *Environment) ExpectUpdated(objects ...client.Object)
ExpectUpdated will update objects in the cluster to match the inputs. WARNING: This ignores the resource version check, which can result in overwriting changes made by other controllers in the cluster. This is useful in ensuring that we can clean up resources by patching out finalizers. Grab the object before making the updates to reduce the chance of this race.
func (*Environment) ForcePodsToSpread ¶ added in v0.7.0
func (env *Environment) ForcePodsToSpread(nodes ...*corev1.Node)
ForcePodsToSpread ensures that currently scheduled pods get spread evenly across all passed nodes by deleting pods off of existing nodes and waiting them to reschedule. This is useful for scenarios where you want to force the nodes be underutilized but you want to keep a consistent count of nodes rather than leaving around empty ones.
func (*Environment) GetDaemonSetCount ¶
func (env *Environment) GetDaemonSetCount(np *karpv1.NodePool) int
func (*Environment) GetDaemonSetOverhead ¶ added in v0.7.0
func (env *Environment) GetDaemonSetOverhead(np *karpv1.NodePool) corev1.ResourceList
func (*Environment) Stop ¶
func (env *Environment) Stop()
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is used to monitor the cluster state during a running test
func (*Monitor) AvgUtilization ¶
func (m *Monitor) AvgUtilization(resource corev1.ResourceName) float64
func (*Monitor) CreatedNodeCount ¶
CreatedNodeCount returns the number of nodes created since the last reset
func (*Monitor) CreatedNodes ¶
CreatedNodes returns the nodes that have been created since the last reset (essentially Nodes - NodesAtReset)
func (*Monitor) DeletedNodes ¶
DeletedNodes returns the nodes that have been deleted since the last reset (essentially NodesAtReset - Nodes)
func (*Monitor) MinUtilization ¶
func (m *Monitor) MinUtilization(resource corev1.ResourceName) float64
func (*Monitor) NodeCountAtReset ¶
NodeCountAtReset returns the number of nodes that were running when the monitor was last reset, typically at the beginning of a test
func (*Monitor) NodesAtReset ¶
NodesAtReset returns a slice of nodes that the monitor saw at the last reset
func (*Monitor) PendingPods ¶
PendingPods returns the number of pending pods matching the given selector
func (*Monitor) Reset ¶
func (m *Monitor) Reset()
Reset resets the cluster monitor prior to running a test.
func (*Monitor) RestartCount ¶
RestartCount returns the containers and number of restarts for that container for all containers in the pods in the given namespace
func (*Monitor) RunningPods ¶
RunningPods returns the number of running pods matching the given selector