Documentation ¶
Index ¶
- Constants
- Variables
- func ActuationSuiteE2eDescribe(name string, body func()) bool
- func AdmissionControllerE2eDescribe(name string, body func()) bool
- func AfterSuiteActions()
- func AnnotatePod(f *framework.Framework, podName, annotationName, annotationValue string)
- func CheckNoPodsEvicted(f *framework.Framework, initialPodSet PodSet)
- func CleanupSuite()
- func E2eDescribe(scenario, name string, body func()) bool
- func FullVpaE2eDescribe(name string, body func()) bool
- func GetEvictedPodsCount(currentPodSet PodSet, initialPodSet PodSet) int
- func GetHamsterContainerNameByIndex(i int) string
- func GetHamsterPods(f *framework.Framework) (*apiv1.PodList, error)
- func InstallLimitRangeWithMax(f *framework.Framework, maxCpuLimit, maxMemoryLimit string, ...)
- func InstallLimitRangeWithMin(f *framework.Framework, minCpuLimit, minMemoryLimit string, ...)
- func InstallRawVPA(f *framework.Framework, obj interface{}) error
- func InstallVPA(f *framework.Framework, vpa *vpa_types.VerticalPodAutoscaler)
- func NewHamsterDeployment(f *framework.Framework) *appsv1.Deployment
- func NewHamsterDeploymentWithGuaranteedResources(f *framework.Framework, cpuQuantity, memoryQuantity resource.Quantity) *appsv1.Deployment
- func NewHamsterDeploymentWithResources(f *framework.Framework, cpuQuantity, memoryQuantity resource.Quantity) *appsv1.Deployment
- func NewHamsterDeploymentWithResourcesAndLimits(f *framework.Framework, ...) *appsv1.Deployment
- func NewNHamstersDeployment(f *framework.Framework, n int) *appsv1.Deployment
- func NewTestCronJob(name, schedule string) *batchv1.CronJob
- func NewVPA(f *framework.Framework, name string, ...) *vpa_types.VerticalPodAutoscaler
- func ParseQuantityOrDie(text string) resource.Quantity
- func PatchVpaRecommendation(f *framework.Framework, vpa *vpa_types.VerticalPodAutoscaler, ...)
- func RecommenderE2eDescribe(name string, body func()) bool
- func RunE2ETests(t *testing.T)
- func SIGDescribe(text string, body func()) bool
- func SetupHamsterContainer(cpu, memory string) apiv1.Container
- func SetupHamsterCronJob(f *framework.Framework, schedule, cpu, memory string, replicas int32)
- func SetupHamsterDeployment(f *framework.Framework, cpu, memory string, replicas int32) *appsv1.Deployment
- func SetupVPA(f *framework.Framework, cpu string, mode vpa_types.UpdateMode, ...)
- func SetupVPAForNHamsters(f *framework.Framework, n int, cpu string, mode vpa_types.UpdateMode, ...)
- func UpdaterE2eDescribe(name string, body func()) bool
- func WaitForPodsEvicted(f *framework.Framework, podList *apiv1.PodList) error
- func WaitForPodsRestarted(f *framework.Framework, podList *apiv1.PodList) error
- func WaitForRecommendationPresent(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler) (*vpa_types.VerticalPodAutoscaler, error)
- func WaitForUncappedCPURecommendationAbove(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler, ...) (*vpa_types.VerticalPodAutoscaler, error)
- func WaitForVPAMatch(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler, ...) (*vpa_types.VerticalPodAutoscaler, error)
- func WerePodsSuccessfullyRestarted(currentPodSet PodSet, initialPodSet PodSet) bool
- type PodSet
- type ResourceConsumer
Constants ¶
const ( // VpaEvictionTimeout is a timeout for VPA to restart a pod if there are no // mechanisms blocking it (for example PDB). VpaEvictionTimeout = 3 * time.Minute )
Variables ¶
var ( // KindRC is the GVK for ReplicationController KindRC = schema.GroupVersionKind{Version: "v1", Kind: "ReplicationController"} // KindDeployment is the GVK for Deployment KindDeployment = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "Deployment"} // KindReplicaSet is the GVK for ReplicaSet KindReplicaSet = schema.GroupVersionKind{Group: "apps", Version: "v1beta2", Kind: "ReplicaSet"} )
Functions ¶
func ActuationSuiteE2eDescribe ¶
ActuationSuiteE2eDescribe describes a VPA actuation e2e test.
func AdmissionControllerE2eDescribe ¶
AdmissionControllerE2eDescribe describes a VPA admission controller e2e test.
func AfterSuiteActions ¶
func AfterSuiteActions()
AfterSuiteActions are actions that are run on ginkgo's SynchronizedAfterSuite
func AnnotatePod ¶
AnnotatePod adds annotation for an existing pod.
func CheckNoPodsEvicted ¶
CheckNoPodsEvicted waits for long enough period for VPA to start evicting pods and checks that no pods were restarted.
func CleanupSuite ¶
func CleanupSuite()
CleanupSuite is the boilerplate that can be used after tests on ginkgo were run, on the SynchronizedAfterSuite step. Similar to SynchronizedBeforeSuite, we want to run some operations only once (such as collecting cluster logs). Here, the order of functions is reversed; first, the function which runs everywhere, and then the function that only runs on the first Ginkgo node.
func E2eDescribe ¶
E2eDescribe describes a VPA e2e test.
func FullVpaE2eDescribe ¶
FullVpaE2eDescribe describes a VPA full stack e2e test.
func GetEvictedPodsCount ¶
GetEvictedPodsCount returns the count of pods from initialPodSet that have been evicted comparing to currentPodSet.
func GetHamsterContainerNameByIndex ¶
GetHamsterContainerNameByIndex returns name of i-th hamster container.
func GetHamsterPods ¶
GetHamsterPods returns running hamster pods (matched by hamsterLabels)
func InstallLimitRangeWithMax ¶
func InstallLimitRangeWithMax(f *framework.Framework, maxCpuLimit, maxMemoryLimit string, lrType apiv1.LimitType)
InstallLimitRangeWithMax installs a LimitRange with a maximum limit for CPU and memory.
func InstallLimitRangeWithMin ¶
func InstallLimitRangeWithMin(f *framework.Framework, minCpuLimit, minMemoryLimit string, lrType apiv1.LimitType)
InstallLimitRangeWithMin installs a LimitRange with a minimum limit for CPU and memory.
func InstallRawVPA ¶
InstallRawVPA installs a VPA object passed in as raw json in the test cluster.
func InstallVPA ¶
func InstallVPA(f *framework.Framework, vpa *vpa_types.VerticalPodAutoscaler)
InstallVPA installs a VPA object in the test cluster.
func NewHamsterDeployment ¶
func NewHamsterDeployment(f *framework.Framework) *appsv1.Deployment
NewHamsterDeployment creates a simple hamster deployment for e2e test purposes.
func NewHamsterDeploymentWithGuaranteedResources ¶
func NewHamsterDeploymentWithGuaranteedResources(f *framework.Framework, cpuQuantity, memoryQuantity resource.Quantity) *appsv1.Deployment
NewHamsterDeploymentWithGuaranteedResources creates a simple hamster deployment with specific resource requests for e2e test purposes. Since the container in the pod specifies resource limits but not resource requests K8s will set requests equal to limits and the pod will have guaranteed QoS class.
func NewHamsterDeploymentWithResources ¶
func NewHamsterDeploymentWithResources(f *framework.Framework, cpuQuantity, memoryQuantity resource.Quantity) *appsv1.Deployment
NewHamsterDeploymentWithResources creates a simple hamster deployment with specific resource requests for e2e test purposes.
func NewHamsterDeploymentWithResourcesAndLimits ¶
func NewHamsterDeploymentWithResourcesAndLimits(f *framework.Framework, cpuQuantityRequest, memoryQuantityRequest, cpuQuantityLimit, memoryQuantityLimit resource.Quantity) *appsv1.Deployment
NewHamsterDeploymentWithResourcesAndLimits creates a simple hamster deployment with specific resource requests and limits for e2e test purposes.
func NewNHamstersDeployment ¶
func NewNHamstersDeployment(f *framework.Framework, n int) *appsv1.Deployment
NewNHamstersDeployment creates a simple hamster deployment with n containers for e2e test purposes.
func NewTestCronJob ¶
NewTestCronJob returns a CronJob for test purposes.
func NewVPA ¶
func NewVPA(f *framework.Framework, name string, targetRef *autoscaling.CrossVersionObjectReference) *vpa_types.VerticalPodAutoscaler
NewVPA creates a VPA object for e2e test purposes.
func ParseQuantityOrDie ¶
ParseQuantityOrDie parses quantity from string and dies with an error if unparsable.
func PatchVpaRecommendation ¶
func PatchVpaRecommendation(f *framework.Framework, vpa *vpa_types.VerticalPodAutoscaler, recommendation *vpa_types.RecommendedPodResources)
PatchVpaRecommendation installs a new reocmmendation for VPA object.
func RecommenderE2eDescribe ¶
RecommenderE2eDescribe describes a VPA recommender e2e test.
func RunE2ETests ¶
RunE2ETests checks configuration parameters (specified through flags) and then runs E2E tests using the Ginkgo runner. If a "report directory" is specified, one or more JUnit test reports will be generated in this directory, and cluster logs will also be saved. This function is called on each Ginkgo node in parallel mode.
func SIGDescribe ¶
SIGDescribe adds sig-autoscaling tag to test description.
func SetupHamsterContainer ¶
SetupHamsterContainer returns container with given amount of cpu and memory
func SetupHamsterCronJob ¶
SetupHamsterCronJob creates and sets up a new CronJob
func SetupHamsterDeployment ¶
func SetupHamsterDeployment(f *framework.Framework, cpu, memory string, replicas int32) *appsv1.Deployment
SetupHamsterDeployment creates and installs a simple hamster deployment for e2e test purposes, then makes sure the deployment is running.
func SetupVPA ¶
func SetupVPA(f *framework.Framework, cpu string, mode vpa_types.UpdateMode, targetRef *autoscaling.CrossVersionObjectReference)
SetupVPA creates and installs a simple hamster VPA for e2e test purposes.
func SetupVPAForNHamsters ¶
func SetupVPAForNHamsters(f *framework.Framework, n int, cpu string, mode vpa_types.UpdateMode, targetRef *autoscaling.CrossVersionObjectReference)
SetupVPAForNHamsters creates and installs a simple pod with n hamster containers for e2e test purposes.
func UpdaterE2eDescribe ¶
UpdaterE2eDescribe describes a VPA updater e2e test.
func WaitForPodsEvicted ¶
WaitForPodsEvicted waits until some pods from the list are evicted.
func WaitForPodsRestarted ¶
WaitForPodsRestarted waits until some pods from the list are restarted.
func WaitForRecommendationPresent ¶
func WaitForRecommendationPresent(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler) (*vpa_types.VerticalPodAutoscaler, error)
WaitForRecommendationPresent pools VPA object until recommendations are not empty. Returns polled vpa object. On timeout returns error.
func WaitForUncappedCPURecommendationAbove ¶
func WaitForUncappedCPURecommendationAbove(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler, minMilliCPU int64) (*vpa_types.VerticalPodAutoscaler, error)
WaitForUncappedCPURecommendationAbove pools VPA object until uncapped recommendation is above specified value. Returns polled VPA object. On timeout returns error.
func WaitForVPAMatch ¶
func WaitForVPAMatch(c vpa_clientset.Interface, vpa *vpa_types.VerticalPodAutoscaler, match func(vpa *vpa_types.VerticalPodAutoscaler) bool) (*vpa_types.VerticalPodAutoscaler, error)
WaitForVPAMatch pools VPA object until match function returns true. Returns polled vpa object. On timeout returns error.
func WerePodsSuccessfullyRestarted ¶
WerePodsSuccessfullyRestarted returns true if some pods from initialPodSet have been successfully restarted comparing to currentPodSet (pods were evicted and are running).
Types ¶
type PodSet ¶
PodSet is a simplified representation of PodList mapping names to UIDs.
func MakePodSet ¶
MakePodSet converts PodList to podset for easier comparison of pod collections.
type ResourceConsumer ¶
type ResourceConsumer struct {
// contains filtered or unexported fields
}
ResourceConsumer is a tool for testing. It helps create specified usage of CPU or memory (Warning: memory not supported) typical use case: rc.ConsumeCPU(600) // ... check your assumption here rc.ConsumeCPU(300) // ... check your assumption here
func NewDynamicResourceConsumer ¶
func NewDynamicResourceConsumer(name, nsName string, kind schema.GroupVersionKind, replicas, initCPUTotal, initMemoryTotal, initCustomMetric int, cpuLimit, memLimit int64, clientset clientset.Interface, scaleClient scaleclient.ScalesGetter) *ResourceConsumer
NewDynamicResourceConsumer is a wrapper to create a new dynamic ResourceConsumer
func (*ResourceConsumer) CleanUp ¶
func (rc *ResourceConsumer) CleanUp()
CleanUp clean up the background goroutines responsible for consuming resources.
func (*ResourceConsumer) ConsumeCPU ¶
func (rc *ResourceConsumer) ConsumeCPU(millicores int)
ConsumeCPU consumes given number of CPU
func (*ResourceConsumer) ConsumeCustomMetric ¶
func (rc *ResourceConsumer) ConsumeCustomMetric(amount int)
ConsumeCustomMetric consumes given number of custom metric
func (*ResourceConsumer) ConsumeMem ¶
func (rc *ResourceConsumer) ConsumeMem(megabytes int)
ConsumeMem consumes given number of Mem