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

Support autoscaling with KEDA #1042

Merged
merged 18 commits into from
Feb 8, 2025
Merged

Support autoscaling with KEDA #1042

merged 18 commits into from
Feb 8, 2025

Conversation

roypaulin
Copy link
Collaborator

@roypaulin roypaulin commented Jan 27, 2025

KEDA (Kubernetes-based Event Driven Autoscaling) is an open-source that allows for fine-grained autoscaling (including to/from zero) for event driven Kubernetes workloads. This PR integrates KEDA's ScaledObject to the VerticaAutoscaler CR. Now users can pick which autoscaler to use (scaledObject/hpa).
API changes were made now the customAutoscaler field has 3 subfields: type, hpa and scaledObject. When type is "HPA", hpa must be set with the metric's definition. The metric can either be cpu/mem or a prometheus metric.
A new test case was added to scale based on a scaledObject.

@@ -80,3 +80,5 @@ commands:
- script: if [ "$NEED_PROMETHEUS" = "true" ]; then make deploy-prometheus; fi
- script: make undeploy-prometheus-adapter || true
- script: if [ "$NEED_PROMETHEUS" = "true" ]; then make deploy-prometheus-adapter; fi
- script: make undeploy-keda || true
- script: if [ "$NEED_PROMETHEUS" = "true" ]; then make deploy-keda; fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does all tests in e2e-leg-12 need keda?

Copy link
Collaborator Author

@roypaulin roypaulin Feb 5, 2025

Choose a reason for hiding this comment

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

No, but we will be adding many tests that need it and keda operator is cluster-scope so one instance will manage multiple namespaces.

@cchen-vertica
Copy link
Collaborator

KEDA (Kubernetes-based Event Driven Autoscaling) is an open-source that allows for fine-grained autoscaling (including to/from zero) for event driven Kubernetes workloads. This PR integrates KEDA's ScaledObject to the VerticaAutoscaler CR. Now users can pick which autoscaler to use (scaledObject/hpa). API changes were made now the customAutoscaler field has 3 subfields: type, hpa and scaledObject. When type is "HPA", scaledObject must be set with the metric's definition. The metric can either be cpu/mem or a prometheus metric. Anew test case was added to scale based on a scaledObject.

Is "When type is "HPA", scaledObject must be set with the metric's definition" true a typo? I think they are mutual exclusive.

The type can only be "HPA“ or "scaledObject", right? HPA means no-keda, and scaledObject means keda, right?

@roypaulin
Copy link
Collaborator Author

Is "When type is "HPA", scaledObject must be set with the metric's definition" true a typo? I think they are mutual exclusive.

The type can only be "HPA“ or "scaledObject", right? HPA means no-keda, and scaledObject means keda, right?

Yes that's a typo.

@roypaulin
Copy link
Collaborator Author

We need to make some server changes to support scaling entire db with keda. Prometheus queries on keda do not rely on the selector but use the labels to find the target pods. We do not have a label that can regroup all pods that belong to the same cluster. I will create a follow-up ticket.

Copy link
Collaborator

@cchen-vertica cchen-vertica left a comment

Choose a reason for hiding this comment

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

Looks good. Leave some minor comments. You can fix them in a follow-up jira if you want.

@@ -1,25 +1,28 @@
module github.com/vertica/vertica-kubernetes

go 1.23.2
go 1.23.4
Copy link
Collaborator

Choose a reason for hiding this comment

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

This minimum version should match the toolchain version 1.23.5.

@@ -85,6 +85,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

// start webhook server using Manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this comment.

@@ -43,10 +43,20 @@
"type": "counter"
},
{
"description": "A summary of the pause duration of garbage collection cycles.",
"description": "A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

How the changes in this file is generated? The prometheus metrics should be the same as before, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are prometheus go built-in metrics, so the change with the library version.

@cchen-vertica
Copy link
Collaborator

We need to make some server changes to support scaling entire db with keda. Prometheus queries on keda do not rely on the selector but use the labels to find the target pods. We do not have a label that can regroup all pods that belong to the same cluster. I will create a follow-up ticket.

We need another follow-up jira to change the term "scale up" to "scale out", and "scale down" to "scale in" in K8s repo.

@roypaulin roypaulin merged commit cba7170 into main Feb 8, 2025
41 checks passed
@roypaulin roypaulin deleted the roypaulin/keda branch February 8, 2025 08:38
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.

2 participants