Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Autoscaler to CSE #1269

Merged
merged 33 commits into from
Jun 19, 2024
Merged

Conversation

adambarreiro
Copy link
Collaborator

@adambarreiro adambarreiro commented May 16, 2024

Overview

This PR automates the steps to deploy an Autoscaler into a Kubernetes cluster stated in this document:
https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/docs/vmw-whitepaper-cluster-auto-scaler.pdf

This procedure affects cluster creation and cluster update operations.

All the logic is implemented in vmware/go-vcloud-director#678

Description

The Go SDK implementation now adds extra fields to work with the Autoscaler in the worker pools.
Hence, the worker_pool block has two new fields, autoscaler_max_replicas and autoscaler_min_replicas, that when set, they deploy the Autoscaler to the cluster to start the automatic adjustment of its nodes.

When autoscaler_max_replicas and autoscaler_min_replicas are set, machine_count must be either unset or 0, and viceversa: when machine_count is set, autoscaler_max_replicas and autoscaler_min_replicas must be 0.

As it can be seen in the Go SDK implementation, once the autoscaler is deployed to the cluster, it is not removed. It's just scaled to 0 or 1 (depending on the mentioned arguments).

Tests

Updated TestAccVcdCseKubernetesCluster (the modifications check Autoscaler updates) and createdTestAccVcdCseKubernetesClusterCreationWithAutoscaler (this one checks cluster creation with Autoscaler). Both check that the autoscaler is created and the information is retrieved (set in the structure) correctly.

TEST_VCD_CSE=1 go test -tags cse -run '^Test_Cse' -v -timeout 0

Anyway, tests only check that the YAML definition is correct. One should check that the autoscaler works, manually:

kubectl --kubeconfig=kubeconfig-n kube-system describe deploy cluster-autoscaler
kubectl --kubeconfig=kubeconfig-n kube-system get po | grep autoscaler
kubectl --kubeconfig=kubeconfig -n kube-system logs cluster-autoscaler-xxxxxxxx-xxxx -f

abarreiro added 9 commits May 9, 2024 09:39
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro self-assigned this May 16, 2024
abarreiro added 18 commits May 22, 2024 16:46
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro marked this pull request as ready for review June 6, 2024 08:06
@adambarreiro adambarreiro requested a review from lvirbalas as a code owner June 6, 2024 08:06
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running test TestAccVcdCseKubernetesClusterCreationWithAutoscaler

go.mod Outdated Show resolved Hide resolved
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test passed. The only question I have is:

Removal process will remove the CSE cluster that might come out with default envs.

Start leftovers removal
[vcd_nsxt_alb_controller] cse_alb_controller (keep)
[vcd_provider_vdc] pvdc-2024-06-05-13-36-12.485 (keep)
[vcd_provider_vdc] nsxTPvdc1 (keep)
[vcd_network_pool] NSX-T Overlay 1 (keep)
[vcd_network_pool] unicastNetworkPoolName (keep)
[vcd_org] System (keep)
[vcd_org] tenant_org (keep)
        [vcd_org_vdc] tenant_vdc (keep)
                [vcd_vapp] test1 (DELETE)
                 REMOVING vApp tenant_vdc/test1
[vcd_org] solutions_org (keep)
        [vcd_org_vdc] solutions_vdc (keep)
                [vcd_rde] test1 (DELETE)
                 REMOVING RDE test1 WITH TYPE urn:vcloud:type:vmware:capvcdCluster:1.3.0
ok      github.com/vmware/terraform-provider-vcd/v3/vcd 3241.561s

abarreiro added 5 commits June 6, 2024 11:17
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
#
Signed-off-by: abarreiro <[email protected]>
nit
Signed-off-by: abarreiro <[email protected]>
go.mod Outdated Show resolved Hide resolved
Signed-off-by: abarreiro <[email protected]>
@adambarreiro adambarreiro merged commit 9c832da into vmware:main Jun 19, 2024
3 checks passed
@adambarreiro adambarreiro deleted the add-cse-autoscaler branch June 19, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants