mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Move autoscaling e2e tests to a separate directory
This commit is contained in:
parent
70684584be
commit
dac7b3e268
@ -14,7 +14,6 @@ go_library(
|
||||
"addon_update.go",
|
||||
"apparmor.go",
|
||||
"cadvisor.go",
|
||||
"cluster_size_autoscaling.go",
|
||||
"cluster_upgrade.go",
|
||||
"cronjob.go",
|
||||
"daemon_restart.go",
|
||||
@ -23,7 +22,6 @@ go_library(
|
||||
"deployment.go",
|
||||
"disruption.go",
|
||||
"dns.go",
|
||||
"dns_autoscaling.go",
|
||||
"dns_common.go",
|
||||
"dns_configmap.go",
|
||||
"e2e.go",
|
||||
@ -39,7 +37,6 @@ go_library(
|
||||
"gke_local_ssd.go",
|
||||
"gke_node_pools.go",
|
||||
"ha_master.go",
|
||||
"horizontal_pod_autoscaling.go",
|
||||
"ingress.go",
|
||||
"initial_resources.go",
|
||||
"job.go",
|
||||
@ -250,6 +247,7 @@ filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//test/e2e/autoscaling:all-srcs",
|
||||
"//test/e2e/chaosmonkey:all-srcs",
|
||||
"//test/e2e/cluster-logging:all-srcs",
|
||||
"//test/e2e/common:all-srcs",
|
||||
|
53
test/e2e/autoscaling/BUILD
Normal file
53
test/e2e/autoscaling/BUILD
Normal file
@ -0,0 +1,53 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"cluster_size_autoscaling.go",
|
||||
"dns_autoscaling.go",
|
||||
"horizontal_pod_autoscaling.go",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/client/clientset_generated/clientset:go_default_library",
|
||||
"//test/e2e:go_default_library",
|
||||
"//test/e2e/common:go_default_library",
|
||||
"//test/e2e/framework:go_default_library",
|
||||
"//test/e2e/scheduling:go_default_library",
|
||||
"//test/utils:go_default_library",
|
||||
"//vendor:github.com/golang/glog",
|
||||
"//vendor:github.com/onsi/ginkgo",
|
||||
"//vendor:github.com/onsi/gomega",
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/errors",
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/resource",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/fields",
|
||||
"//vendor:k8s.io/apimachinery/pkg/labels",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/intstr",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/sets",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/uuid",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
"//vendor:k8s.io/client-go/pkg/apis/policy/v1beta1",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
8
test/e2e/autoscaling/OWNERS
Normal file
8
test/e2e/autoscaling/OWNERS
Normal file
@ -0,0 +1,8 @@
|
||||
reviewers:
|
||||
- mwielgus
|
||||
- jszczepkowski
|
||||
- MaciekPytel
|
||||
approvers:
|
||||
- mwielgus
|
||||
- jszczepkowski
|
||||
- MaciekPytel
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package autoscaling
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@ -36,6 +36,7 @@ import (
|
||||
policy "k8s.io/client-go/pkg/apis/policy/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
"k8s.io/kubernetes/test/e2e"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/scheduling"
|
||||
testutils "k8s.io/kubernetes/test/utils"
|
||||
@ -82,7 +83,7 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
|
||||
originalSizes = make(map[string]int)
|
||||
sum := 0
|
||||
for _, mig := range strings.Split(framework.TestContext.CloudConfig.NodeInstanceGroup, ",") {
|
||||
size, err := GroupSize(mig)
|
||||
size, err := e2e.GroupSize(mig)
|
||||
framework.ExpectNoError(err)
|
||||
By(fmt.Sprintf("Initial size of %s: %d", mig, size))
|
||||
originalSizes[mig] = size
|
||||
@ -190,7 +191,8 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
|
||||
})
|
||||
|
||||
It("should add node to the particular mig [Feature:ClusterSizeAutoscalingScaleUp]", func() {
|
||||
labels := map[string]string{"cluster-autoscaling-test.special-node": "true"}
|
||||
labelKey := "cluster-autoscaling-test.special-node"
|
||||
labelValue := "true"
|
||||
|
||||
By("Finding the smallest MIG")
|
||||
minMig := ""
|
||||
@ -204,25 +206,30 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
|
||||
|
||||
removeLabels := func(nodesToClean sets.String) {
|
||||
By("Removing labels from nodes")
|
||||
updateNodeLabels(c, nodesToClean, nil, labels)
|
||||
for node := range nodesToClean {
|
||||
framework.RemoveLabelOffNode(c, node, labelKey)
|
||||
}
|
||||
}
|
||||
|
||||
nodes, err := GetGroupNodes(minMig)
|
||||
nodes, err := e2e.GetGroupNodes(minMig)
|
||||
framework.ExpectNoError(err)
|
||||
nodesSet := sets.NewString(nodes...)
|
||||
defer removeLabels(nodesSet)
|
||||
By(fmt.Sprintf("Annotating nodes of the smallest MIG(%s): %v", minMig, nodes))
|
||||
updateNodeLabels(c, nodesSet, labels, nil)
|
||||
|
||||
CreateNodeSelectorPods(f, "node-selector", minSize+1, labels, false)
|
||||
for node := range nodesSet {
|
||||
framework.AddOrUpdateLabelOnNode(c, node, labelKey, labelValue)
|
||||
}
|
||||
|
||||
CreateNodeSelectorPods(f, "node-selector", minSize+1, map[string]string{labelKey: labelValue}, false)
|
||||
|
||||
By("Waiting for new node to appear and annotating it")
|
||||
WaitForGroupSize(minMig, int32(minSize+1))
|
||||
e2e.WaitForGroupSize(minMig, int32(minSize+1))
|
||||
// Verify, that cluster size is increased
|
||||
framework.ExpectNoError(WaitForClusterSizeFunc(f.ClientSet,
|
||||
func(size int) bool { return size >= nodeCount+1 }, scaleUpTimeout))
|
||||
|
||||
newNodes, err := GetGroupNodes(minMig)
|
||||
newNodes, err := e2e.GetGroupNodes(minMig)
|
||||
framework.ExpectNoError(err)
|
||||
newNodesSet := sets.NewString(newNodes...)
|
||||
newNodesSet.Delete(nodes...)
|
||||
@ -264,7 +271,10 @@ var _ = framework.KubeDescribe("Cluster size autoscaling [Slow]", func() {
|
||||
}
|
||||
}
|
||||
By(fmt.Sprintf("Setting labels for registered new nodes: %v", registeredNodes.List()))
|
||||
updateNodeLabels(c, registeredNodes, labels, nil)
|
||||
for node := range registeredNodes {
|
||||
framework.AddOrUpdateLabelOnNode(c, node, labelKey, labelValue)
|
||||
}
|
||||
|
||||
defer removeLabels(registeredNodes)
|
||||
|
||||
framework.ExpectNoError(waitForAllCaPodsReadyInNamespace(f, c))
|
||||
@ -645,11 +655,11 @@ func waitForAllCaPodsReadyInNamespace(f *framework.Framework, c clientset.Interf
|
||||
|
||||
func setMigSizes(sizes map[string]int) {
|
||||
for mig, desiredSize := range sizes {
|
||||
currentSize, err := GroupSize(mig)
|
||||
currentSize, err := e2e.GroupSize(mig)
|
||||
framework.ExpectNoError(err)
|
||||
if desiredSize != currentSize {
|
||||
By(fmt.Sprintf("Setting size of %s to %d", mig, desiredSize))
|
||||
err = ResizeGroup(mig, int32(desiredSize))
|
||||
err = e2e.ResizeGroup(mig, int32(desiredSize))
|
||||
framework.ExpectNoError(err)
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package autoscaling
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -28,6 +28,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
|
||||
"k8s.io/kubernetes/test/e2e"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@ -119,7 +120,7 @@ var _ = framework.KubeDescribe("DNS horizontal autoscaling", func() {
|
||||
originalSizes := make(map[string]int)
|
||||
sum := 0
|
||||
for _, mig := range strings.Split(framework.TestContext.CloudConfig.NodeInstanceGroup, ",") {
|
||||
size, err := GroupSize(mig)
|
||||
size, err := e2e.GroupSize(mig)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
By(fmt.Sprintf("Initial size of %s: %d", mig, size))
|
||||
originalSizes[mig] = size
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package e2e
|
||||
package autoscaling
|
||||
|
||||
import (
|
||||
"time"
|
@ -19,6 +19,7 @@ package e2e
|
||||
import (
|
||||
"testing"
|
||||
|
||||
_ "k8s.io/kubernetes/test/e2e/autoscaling"
|
||||
_ "k8s.io/kubernetes/test/e2e/cluster-logging"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
_ "k8s.io/kubernetes/test/e2e/perf"
|
||||
|
Loading…
Reference in New Issue
Block a user