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

feat(kuma-cp) add horizontal pod autoscaler #1271

Merged
merged 12 commits into from
Dec 14, 2020
Merged

feat(kuma-cp) add horizontal pod autoscaler #1271

merged 12 commits into from
Dec 14, 2020

Conversation

austince
Copy link
Contributor

@austince austince commented Dec 2, 2020

Summary

Lifts the HPA configuration from the Kong chart to enable Control Plane horizontal autoscaling.

Will rebase and resync chart readme after we merge #1209. done!

Full changelog

  • Add HorizontalPodAutoscaler with default target CPU of 80%, with min 2 and max 5 pods
  • Add kind/deploy/metrics-server make task for installing the k8s metrics-server, which is necessary for HPA
    • Should this go in another makefile?

Issues resolved

Fix #1207

Documentation

  • N/A

@austince austince requested a review from a team as a code owner December 2, 2020 17:50
@austince austince changed the title feat(deployments) add horizontal pod autoscaler feat(kuma-cp) add horizontal pod autoscaler Dec 3, 2020
@austince
Copy link
Contributor Author

austince commented Dec 3, 2020

@tharun208 would you mind taking a look at this too?

Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
Signed-off-by: austin ce <austin.cawley@gmail.com>
mk/kind.mk Outdated
@@ -116,6 +116,13 @@ kind/deploy/metrics: build/kumactl
@${BUILD_ARTIFACTS_DIR}/kumactl/kumactl install metrics $(KUMACTL_INSTALL_METRICS_IMAGES) | kubectl apply -f -
@KUBECONFIG=$(KIND_KUBECONFIG) kubectl wait --timeout=60s --for=condition=Ready -n kuma-metrics pods -l app=prometheus

.PHONY: kind/deploy/metrics-server
kind/deploy/metrics-server:
@KUBECONFIG=$(KIND_KUBECONFIG) kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.4.1/components.yaml
Copy link
Contributor

@nickolaev nickolaev Dec 4, 2020

Choose a reason for hiding this comment

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

Please parametrize the version so we can bump it easier.

@KUBECONFIG=$(KIND_KUBECONFIG) kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.4.1/components.yaml
@KUBECONFIG=$(KIND_KUBECONFIG) kubectl patch -n kube-system deployment/metrics-server \
--patch='{"spec":{"template":{"spec":{"containers":[{"name":"metrics-server","args":["--cert-dir=/tmp", "--secure-port=4443", "--kubelet-insecure-tls", "--kubelet-preferred-address-types=InternalIP"]}]}}}}'
@KUBECONFIG=$(KIND_KUBECONFIG) kubectl wait --timeout=60s --for=condition=Available -n kube-system deployment/metrics-server
Copy link
Contributor

Choose a reason for hiding this comment

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

So, how kind specific is this? You say in the readme or on a cluster with a similarly self-signed certz, what are these clusters? Is this a public cloud, or on-prem?
My point is, is, does this belong to kind.mk or can go a bit more generic?

Copy link
Contributor Author

@austince austince Dec 4, 2020

Choose a reason for hiding this comment

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

Definitely more generic, just wasn't sure which makefile to put it in -- maybe dev.mk? It should be up to the user to configure the metrics-server separately from kuma, this make target is just meant to make the dev setup easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might also be the case for things like minikube and microk8s. Do you generally use kind for local dev?

| controlPlane.autoscaling.minReplicas | int | `2` | The minimum CP pods to allow |
| controlPlane.autoscaling.maxReplicas | int | `5` | The max CP pods to scale to |
| controlPlane.autoscaling.targetCPUUtilizationPercentage | int | `80` | For clusters that don't support autoscaling/v2beta, autoscaling/v1 is used |
| controlPlane.autoscaling.metrics | list | `[{"resource":{"name":"cpu","target":{"averageUtilization":80,"type":"Utilization"}},"type":"Resource"}]` | For clusters that do support autoscaling/v2beta, use metrics |
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, how are we setting these on the command line? is it even possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is set dynamically by helm in the Capabilities.APIVersions builtin object based on what is available in the target cluster. I think it is similar to the kubectl api-versions command.

@nickolaev
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Dec 4, 2020

Command update: success

Branch has been successfully updated

@CLAassistant
Copy link

CLAassistant commented Dec 4, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ nickolaev
✅ austince
❌ mergify[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

austince and others added 3 commits December 4, 2020 10:07
Signed-off-by: austin ce <austin.cawley@gmail.com>
…arts/hpa

Signed-off-by: austin ce <austin.cawley@gmail.com>
@nickolaev nickolaev merged commit 7d703bc into master Dec 14, 2020
@nickolaev nickolaev deleted the feat/charts/hpa branch December 14, 2020 14:47
mergify bot pushed a commit that referenced this pull request Dec 14, 2020
* feat(deployments) add horizontal pod autoscaler

* test(deployments) add e2e test for helm autoscaling

* docs(kuma-cp) add annotations to chart values

* docs(kuma-cp) fix tag value doc

* chore(*) parameterize metrics-server make target

Signed-off-by: austin ce <austin.cawley@gmail.com>
(cherry picked from commit 7d703bc)

# Conflicts:
#	app/kumactl/pkg/install/k8s/control-plane/helmtemplates_vfsdata.go
nickolaev pushed a commit that referenced this pull request Dec 16, 2020
* feat(kuma-cp) add horizontal pod autoscaler (#1271)

* feat(deployments) add horizontal pod autoscaler

* test(deployments) add e2e test for helm autoscaling

* docs(kuma-cp) add annotations to chart values

* docs(kuma-cp) fix tag value doc

* chore(*) parameterize metrics-server make target

Signed-off-by: austin ce <austin.cawley@gmail.com>
(cherry picked from commit 7d703bc)

# Conflicts:
#	app/kumactl/pkg/install/k8s/control-plane/helmtemplates_vfsdata.go

* fix(*) conflicts

Signed-off-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>

Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com>
Co-authored-by: Nikolay Nikolaev <nikolay.nikolaev@konghq.com>
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.

HELM: Horizontal Pod Autoscaler
4 participants