test: e2e: HPA ContainerResource

This add e2e test for HPA ContainerResource metrics. This add test to cover two scenarios
1. Scale up on a busy application with an idle sidecar container
2. Do not scale up on a busy sidecar with an idle application.

Signed-off-by: Vivek Singh <svivekkumar@vmware.com>
This commit is contained in:
Vivek Singh
2021-06-08 00:39:21 +05:30
parent 33aba7ee02
commit 80e4007bc3
6 changed files with 293 additions and 46 deletions

View File

@@ -181,6 +181,9 @@ type RCConfig struct {
ConfigMapNames []string
ServiceAccountTokenProjections int
//Additional containers to run in the pod
AdditionalContainers []v1.Container
}
func (rc *RCConfig) RCConfigLog(fmt string, args ...interface{}) {
@@ -343,6 +346,10 @@ func (config *DeploymentConfig) create() error {
},
}
if len(config.AdditionalContainers) > 0 {
deployment.Spec.Template.Spec.Containers = append(deployment.Spec.Template.Spec.Containers, config.AdditionalContainers...)
}
if len(config.SecretNames) > 0 {
attachSecrets(&deployment.Spec.Template, config.SecretNames)
}
@@ -425,6 +432,10 @@ func (config *ReplicaSetConfig) create() error {
},
}
if len(config.AdditionalContainers) > 0 {
rs.Spec.Template.Spec.Containers = append(rs.Spec.Template.Spec.Containers, config.AdditionalContainers...)
}
if len(config.SecretNames) > 0 {
attachSecrets(&rs.Spec.Template, config.SecretNames)
}
@@ -618,6 +629,10 @@ func (config *RCConfig) create() error {
},
}
if len(config.AdditionalContainers) > 0 {
rc.Spec.Template.Spec.Containers = append(rc.Spec.Template.Spec.Containers, config.AdditionalContainers...)
}
if len(config.SecretNames) > 0 {
attachSecrets(rc.Spec.Template, config.SecretNames)
}