Documentation ¶
Index ¶
- func BuildTestContainer(containerName, cpu, mem string) apiv1.Container
- func BuildTestPolicy(containerName, minCPU, maxCPU, minMemory, maxMemory string) *vpa_types.PodResourcePolicy
- func Container() *containerBuilder
- func FakeEventRecorder() record.EventRecorder
- func Resources(cpu, mem string) apiv1.ResourceList
- type FakeRecommendationProcessor
- type MultidimPodAutoscalerBuilder
- type MultidimPodAutoscalerListerMock
- func (m *MultidimPodAutoscalerListerMock) Get(name string) (*mpa_types.MultidimPodAutoscaler, error)
- func (m *MultidimPodAutoscalerListerMock) List(selector labels.Selector) (ret []*mpa_types.MultidimPodAutoscaler, err error)
- func (m *MultidimPodAutoscalerListerMock) MultidimPodAutoscalers(namespace string) mpa_lister.MultidimPodAutoscalerNamespaceLister
- type PodListerMock
- type PodsEvictionRestrictionMock
- type RecommendationBuilder
- type RecommendationProcessorMock
- type RecommenderAPIMock
- type RecommenderMock
- type VerticalPodAutoscalerListerMock
- func (m *VerticalPodAutoscalerListerMock) Get(name string) (*vpa_types.VerticalPodAutoscaler, error)
- func (m *VerticalPodAutoscalerListerMock) List(selector labels.Selector) (ret []*vpa_types.VerticalPodAutoscaler, err error)
- func (m *VerticalPodAutoscalerListerMock) VerticalPodAutoscalers(namespace string) vpa_lister.VerticalPodAutoscalerNamespaceLister
- type VerticalPodAutoscalerV1Beta1ListerMock
- func (m *VerticalPodAutoscalerV1Beta1ListerMock) Get(name string) (*vpa_types_v1beta1.VerticalPodAutoscaler, error)
- func (m *VerticalPodAutoscalerV1Beta1ListerMock) List(selector labels.Selector) (ret []*vpa_types_v1beta1.VerticalPodAutoscaler, err error)
- func (m *VerticalPodAutoscalerV1Beta1ListerMock) VerticalPodAutoscalers(namespace string) vpa_lister_v1beta1.VerticalPodAutoscalerNamespaceLister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestContainer ¶
BuildTestContainer creates container with specified resources
func BuildTestPolicy ¶
func BuildTestPolicy(containerName, minCPU, maxCPU, minMemory, maxMemory string) *vpa_types.PodResourcePolicy
BuildTestPolicy creates ResourcesPolicy with specified constraints
func Container ¶
func Container() *containerBuilder
Container returns object that helps build containers for tests.
func FakeEventRecorder ¶
func FakeEventRecorder() record.EventRecorder
FakeEventRecorder returns a dummy implementation of record.EventRecorder.
func Resources ¶
func Resources(cpu, mem string) apiv1.ResourceList
Resources creates a ResourceList with given amount of cpu and memory.
Types ¶
type FakeRecommendationProcessor ¶
type FakeRecommendationProcessor struct{}
FakeRecommendationProcessor is a dummy implementation of RecommendationProcessor
func (*FakeRecommendationProcessor) Apply ¶
func (f *FakeRecommendationProcessor) Apply(podRecommendation *vpa_types.RecommendedPodResources, policy *vpa_types.PodResourcePolicy, conditions []mpa_types.MultidimPodAutoscalerCondition, pod *apiv1.Pod) (*vpa_types.RecommendedPodResources, map[string][]string, error)
Apply is a dummy implementation of RecommendationProcessor.Apply which returns provided podRecommendation
type MultidimPodAutoscalerBuilder ¶
type MultidimPodAutoscalerBuilder interface { WithName(vpaName string) MultidimPodAutoscalerBuilder WithContainer(containerName string) MultidimPodAutoscalerBuilder WithNamespace(namespace string) MultidimPodAutoscalerBuilder WithUpdateMode(updateMode vpa_types.UpdateMode) MultidimPodAutoscalerBuilder WithCreationTimestamp(timestamp time.Time) MultidimPodAutoscalerBuilder WithMinAllowed(cpu, memory string) MultidimPodAutoscalerBuilder WithMaxAllowed(cpu, memory string) MultidimPodAutoscalerBuilder WithControlledValues(mode vpa_types.ContainerControlledValues) MultidimPodAutoscalerBuilder WithTarget(cpu, memory string) MultidimPodAutoscalerBuilder WithLowerBound(cpu, memory string) MultidimPodAutoscalerBuilder WithScaleTargetRef(targetRef *autoscaling.CrossVersionObjectReference) MultidimPodAutoscalerBuilder WithUpperBound(cpu, memory string) MultidimPodAutoscalerBuilder WithAnnotations(map[string]string) MultidimPodAutoscalerBuilder WithRecommender(string2 string) MultidimPodAutoscalerBuilder AppendCondition(conditionType mpa_types.MultidimPodAutoscalerConditionType, status core.ConditionStatus, reason, message string, lastTransitionTime time.Time) MultidimPodAutoscalerBuilder AppendRecommendation(vpa_types.RecommendedContainerResources) MultidimPodAutoscalerBuilder Get() *mpa_types.MultidimPodAutoscaler }
MultidimPodAutoscalerBuilder helps building test instances of MultidimPodAutoscaler.
func MultidimPodAutoscaler ¶
func MultidimPodAutoscaler() MultidimPodAutoscalerBuilder
MultidimPodAutoscaler returns a new MultidimPodAutoscalerBuilder.
type MultidimPodAutoscalerListerMock ¶
MultidimPodAutoscalerListerMock is a mock of MultidimPodAutoscalerLister or MultidimPodAutoscalerNamespaceLister - the crucial List method is the same.
func (*MultidimPodAutoscalerListerMock) Get ¶
func (m *MultidimPodAutoscalerListerMock) Get(name string) (*mpa_types.MultidimPodAutoscaler, error)
Get is not implemented for this mock
func (*MultidimPodAutoscalerListerMock) List ¶
func (m *MultidimPodAutoscalerListerMock) List(selector labels.Selector) (ret []*mpa_types.MultidimPodAutoscaler, err error)
List is a mock implementation of MultidimPodAutoscalerLister.List
func (*MultidimPodAutoscalerListerMock) MultidimPodAutoscalers ¶
func (m *MultidimPodAutoscalerListerMock) MultidimPodAutoscalers(namespace string) mpa_lister.MultidimPodAutoscalerNamespaceLister
MultidimPodAutoscalers is a mock implementation of returning a lister for namespace.
type PodListerMock ¶
PodListerMock is a mock of PodLister
func (*PodListerMock) Get ¶
func (m *PodListerMock) Get(name string) (*apiv1.Pod, error)
Get is not implemented for this mock
func (*PodListerMock) Pods ¶
func (m *PodListerMock) Pods(namespace string) v1.PodNamespaceLister
Pods is a mock implementation of PodLister.Pods
type PodsEvictionRestrictionMock ¶
PodsEvictionRestrictionMock is a mock of PodsEvictionRestriction
func (*PodsEvictionRestrictionMock) CanEvict ¶
func (m *PodsEvictionRestrictionMock) CanEvict(pod *apiv1.Pod) bool
CanEvict is a mock implementation of PodsEvictionRestriction.CanEvict
func (*PodsEvictionRestrictionMock) Evict ¶
func (m *PodsEvictionRestrictionMock) Evict(pod *apiv1.Pod, eventRecorder record.EventRecorder) error
Evict is a mock implementation of PodsEvictionRestriction.Evict
type RecommendationBuilder ¶
type RecommendationBuilder interface { WithContainer(containerName string) RecommendationBuilder WithTarget(cpu, memory string) RecommendationBuilder WithLowerBound(cpu, memory string) RecommendationBuilder WithUpperBound(cpu, memory string) RecommendationBuilder Get() *vpa_types.RecommendedPodResources GetContainerResources() vpa_types.RecommendedContainerResources }
RecommendationBuilder helps building test instances of RecommendedPodResources.
func Recommendation ¶
func Recommendation() RecommendationBuilder
Recommendation returns a new RecommendationBuilder.
type RecommendationProcessorMock ¶
RecommendationProcessorMock is mock implementation of RecommendationProcessor
func (*RecommendationProcessorMock) Apply ¶
func (m *RecommendationProcessorMock) Apply(podRecommendation *vpa_types.RecommendedPodResources, policy *vpa_types.PodResourcePolicy, conditions []mpa_types.MultidimPodAutoscalerCondition, pod *apiv1.Pod) (*vpa_types.RecommendedPodResources, map[string][]string, error)
Apply is a mock implementation of RecommendationProcessor.Apply
type RecommenderAPIMock ¶
RecommenderAPIMock is a mock of RecommenderAPI
func (*RecommenderAPIMock) GetRecommendation ¶
func (m *RecommenderAPIMock) GetRecommendation(spec *apiv1.PodSpec) (*vpa_types.RecommendedPodResources, error)
GetRecommendation is mock implementation of RecommenderAPI.GetRecommendation
type RecommenderMock ¶
RecommenderMock is a mock of Recommender
func (*RecommenderMock) Get ¶
func (m *RecommenderMock) Get(spec *apiv1.PodSpec) (*vpa_types.RecommendedPodResources, error)
Get is a mock implementation of Recommender.Get
type VerticalPodAutoscalerListerMock ¶
VerticalPodAutoscalerListerMock is a mock of VerticalPodAutoscalerLister or VerticalPodAutoscalerNamespaceLister - the crucial List method is the same.
func (*VerticalPodAutoscalerListerMock) Get ¶
func (m *VerticalPodAutoscalerListerMock) Get(name string) (*vpa_types.VerticalPodAutoscaler, error)
Get is not implemented for this mock
func (*VerticalPodAutoscalerListerMock) List ¶
func (m *VerticalPodAutoscalerListerMock) List(selector labels.Selector) (ret []*vpa_types.VerticalPodAutoscaler, err error)
List is a mock implementation of VerticalPodAutoscalerLister.List
func (*VerticalPodAutoscalerListerMock) VerticalPodAutoscalers ¶
func (m *VerticalPodAutoscalerListerMock) VerticalPodAutoscalers(namespace string) vpa_lister.VerticalPodAutoscalerNamespaceLister
VerticalPodAutoscalers is a mock implementation of returning a lister for namespace.
type VerticalPodAutoscalerV1Beta1ListerMock ¶
VerticalPodAutoscalerV1Beta1ListerMock is a mock of VerticalPodAutoscalerLister or VerticalPodAutoscalerNamespaceLister - the crucial List method is the same.
func (*VerticalPodAutoscalerV1Beta1ListerMock) Get ¶
func (m *VerticalPodAutoscalerV1Beta1ListerMock) Get(name string) (*vpa_types_v1beta1.VerticalPodAutoscaler, error)
Get is not implemented for this mock
func (*VerticalPodAutoscalerV1Beta1ListerMock) List ¶
func (m *VerticalPodAutoscalerV1Beta1ListerMock) List(selector labels.Selector) (ret []*vpa_types_v1beta1.VerticalPodAutoscaler, err error)
List is a mock implementation of VerticalPodAutoscalerLister.List
func (*VerticalPodAutoscalerV1Beta1ListerMock) VerticalPodAutoscalers ¶
func (m *VerticalPodAutoscalerV1Beta1ListerMock) VerticalPodAutoscalers(namespace string) vpa_lister_v1beta1.VerticalPodAutoscalerNamespaceLister
VerticalPodAutoscalers is a mock implementation of returning a lister for namespace.