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 #678

Merged
merged 31 commits into from
Jun 14, 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.

Built on top of #674

Description

A new autoscaler.tmpl file has been added to the collection. A new configuration block Autoscaler has been added to both the CseWorkerPoolSettings (settings to create a worker pool in a new cluster) and CseWorkerPoolUpdateInput (input to update a worker pool in an existing cluster).

When any of the Worker Pools settings has an Autoscaler struct set, we add the autoscaler.tmpl rendered YAML to the final bunch of YAML documents that describe the whole cluster. Also, each of the worker pool deployments will have special metadata entries, and won't render the replicas field (as it conflicts with the autoscaler).

When none of the Worker Pools settings have the Autoscaler struct set, we do nothing, we just work with replicas as usual and no extra steps are required. This case would define an existing use case for regression tests.

With these two scenarios, the cluster is then created with or without autoscaling elements present in the cluster, and also the new metadata entries in each worker pool, if needed.

What about updating a cluster?

In this case, a user can enable or disable the Autoscaler in the same way, using CseWorkerPoolUpdateInput to update existing worker pools or CseWorkerPoolSettings to create new worker pools (this mechanism doesn't change). Both have the new Autoscaler struct (this is the new feature).

When updating a cluster, we search for the Autoscaler YAML document, to check whether it is present in the cluster or not.

  • If we need autoscaling capabilities and the YAML is not there (that would mean that the cluster was created without autoscaling), we update/add the YAML and the required metadata to the existing/new worker pools.
  • If we need autoscaling capabilities and the YAML is there, we just update/add the YAML and the required metadata to the existing/new worker pools.
  • If we don't need autoscaling, then we need to check whether it is enabled in the cluster, and disable the Autoscaler if so (this doesn't remove the autoscaler YAML, just deactivates it).

Tests

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

GOVCD_SKIP_VAPP_CREATION=1 TEST_VCD_CSE=1 go test -tags cse -check.f '^Test_Cse' -check.vv -timeout=0

abarreiro added 6 commits May 10, 2024 16:01
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
abarreiro added 20 commits May 16, 2024 12:07
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
nit
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Fix
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Fix
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
@adambarreiro adambarreiro marked this pull request as ready for review May 30, 2024 14:11
@adambarreiro adambarreiro requested a review from lvirbalas as a code owner May 30, 2024 14:11
Signed-off-by: abarreiro <abarreiro@vmware.com>
Signed-off-by: abarreiro <abarreiro@vmware.com>
abarreiro added 2 commits June 6, 2024 09:35
Fix
Signed-off-by: abarreiro <abarreiro@vmware.com>
Fix
Signed-off-by: abarreiro <abarreiro@vmware.com>
#
Signed-off-by: abarreiro <abarreiro@vmware.com>
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.

Tests passed

@adambarreiro adambarreiro merged commit af1e038 into vmware:main Jun 14, 2024
2 checks passed
@adambarreiro adambarreiro deleted the add-cse-autoscaler branch June 14, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants