faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

[Feature request] Create HPAv2 through stack.yml

Open haozibi opened this issue 5 years ago • 3 comments

Hello @alexellis , I want to ask some questions about HPAv2.

I have changed the auto-scaling to HPAv2 by https://docs.openfaas.com/tutorials/kubernetes-hpa/ and it works fine.

But there are some questions about creating the HPAv2 rule, can I add the HPAv2 rule using faas-cli or function yaml instead of kubectl. Because I have to deploy more functions, and I don't have permission to use kubectl

this is my function yaml

version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:9090
functions:
  hpa-002:
    lang: go
    handler: ./hpa-002
    image: hpa-002:latest
    requests:
      memory: 50Mi
      cpu: 200m
    limits:
      memory: 500Mi
      cpu: 3000m
    environment:
      write_debug: true
      read_timeout: 90s
      write_timeout: 90s

Expected Behaviour

Add HPAv2 rule by faas-cli or function yaml

Current Behaviour

Add HPAv2 rule by kubectl

kubectl autoscale deployment -n openfaas-fn \
  nodeinfo \
  --cpu-percent=50 \
  --min=1 \
  --max=10

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):

  • Docker version ( Full output from: docker version ):

  • Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)?

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • Link to your project or a code example to reproduce issue:

haozibi avatar Sep 10 '19 06:09 haozibi

/set title: [Feature request] Create HPAv2 through stack.yml

alexellis avatar Sep 10 '19 12:09 alexellis

is there any update to this? We also want to use kubernetes HPAv2 to scale through stack.yml in openfaas functions deployment

sqaisar avatar Jun 16 '22 07:06 sqaisar

Hi, @sqaisar

Since this issue was opened we did create a new auto-scaling engine for OpenFaas Pro.

It supports scaling to zero and has multiple scaling modes like capacity, rps and cpu based scaling.

The scaling rules are configured by setting labels on the function which can be done through the function yaml file or using the faas-cli.

welteki avatar Jun 17 '22 10:06 welteki