Module tests.test_cluster_autoscaler
Functions
def annotate_safe_to_evict_to_namespace_pods(core_api, namespace)
def configure_node_scale_down(core_api, nodes, disable)
def get_new_nodes(client, old_nodes)
def get_replica_count_to_scale_up(core_api, node_number, cpu_request)
def test_cluster_autoscaler(client, core_api, apps_api, make_deployment_cpu_request, request)
-
Scenario: Test CA
Given Cluster with Kubernetes cluster-autoscaler. And Longhorn installed. And Set
kubernetes-cluster-autoscaler-enabled
totrue
. And Create deployment with cpu request.When Trigger CA to scale-up by increase deployment replicas. (double the node number, not including host node) Then Cluster should have double the node number.
When Trigger CA to scale-down by decrease deployment replicas. Then Cluster should scale-down to original node number.
def test_cluster_autoscaler_all_nodes_with_volume_replicas(client, core_api, apps_api, make_deployment_cpu_request, volume_name, pod_make, request)
-
Scenario: Test CA scale down all nodes with volume replicas
Given Cluster with Kubernetes cluster-autoscaler. And Longhorn installed. And Set
kubernetes-cluster-autoscaler-enabled
totrue
. And Create volume. And Attach the volume. And Write some data to volume. And Detach the volume. And Create deployment with cpu request.When Trigger CA to scale-up by increase deployment replicas. (double the node number, not including host node) Then Cluster should have double the node number.
When Annotate new nodes with
cluster-autoscaler.kubernetes.io/scale-down-disabled
. (this ensures scale-down only the old nodes) And Trigger CA to scale-down by decrease deployment replicas. Then Cluster should have original node number + 1 blocked node.When Attach the volume to a new node. This triggers replica rebuild. And Volume data should be the same. And Detach the volume. Then Cluster should scale-down to original node number. And Volume data should be the same.
def test_cluster_autoscaler_backing_image(client, core_api, apps_api, make_deployment_cpu_request, request)
-
Scenario: Test CA scale down with backing image
Given Cluster with Kubernetes cluster-autoscaler. And Longhorn installed. And Set
kubernetes-cluster-autoscaler-enabled
totrue
. And Create backing image. And Create deployment with cpu request.When Trigger CA to scale-up by increase deployment replicas. (double the node number, not including host node) Then Cluster should have double the node number.
When Annotate new nodes with
cluster-autoscaler.kubernetes.io/scale-down-disabled
. (this ensures scale-down only the old nodes) And Trigger CA to scale-down by decrease deployment replicas. Then Cluster should have original node number + 1 blocked node.When Remove backing image. Then Cluster should scale-down to original node number.
def wait_cluster_autoscale_down(client, core_api, nodes, diff)
def wait_cluster_autoscale_up(client, nodes, diff)