Adds e2e tests for Pod Priority and Preemption in Clucter Autoscaler:

- shouldn't scale up when expendable pod is created
 - should scale up when non expendable pod is created
 - shouldn't scale up when expendable pod is preempted
 - should scale down when expendable pod is running
 - shouldn't scale down when non expendable pod is running
This commit is contained in:
Krzysztof Jastrzebski
2017-11-09 12:48:03 +01:00
parent d2b9aa29c3
commit 20e5b896e9
3 changed files with 125 additions and 30 deletions

View File

@@ -112,23 +112,24 @@ type RunObjectConfig interface {
}
type RCConfig struct {
Affinity *v1.Affinity
Client clientset.Interface
InternalClient internalclientset.Interface
Image string
Command []string
Name string
Namespace string
PollInterval time.Duration
Timeout time.Duration
PodStatusFile *os.File
Replicas int
CpuRequest int64 // millicores
CpuLimit int64 // millicores
MemRequest int64 // bytes
MemLimit int64 // bytes
ReadinessProbe *v1.Probe
DNSPolicy *v1.DNSPolicy
Affinity *v1.Affinity
Client clientset.Interface
InternalClient internalclientset.Interface
Image string
Command []string
Name string
Namespace string
PollInterval time.Duration
Timeout time.Duration
PodStatusFile *os.File
Replicas int
CpuRequest int64 // millicores
CpuLimit int64 // millicores
MemRequest int64 // bytes
MemLimit int64 // bytes
ReadinessProbe *v1.Probe
DNSPolicy *v1.DNSPolicy
PriorityClassName string
// Env vars, set the same for every pod.
Env map[string]string
@@ -539,6 +540,7 @@ func (config *RCConfig) create() error {
DNSPolicy: *config.DNSPolicy,
NodeSelector: config.NodeSelector,
TerminationGracePeriodSeconds: &one,
PriorityClassName: config.PriorityClassName,
},
},
},
@@ -615,6 +617,9 @@ func (config *RCConfig) applyTo(template *v1.PodTemplateSpec) {
if len(config.VolumeMounts) > 0 {
template.Spec.Containers[0].VolumeMounts = config.VolumeMounts
}
if config.PriorityClassName != "" {
template.Spec.PriorityClassName = config.PriorityClassName
}
}
type RCStartupStatus struct {