openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
798 stars 224 forks source link

[Feature request] Create HPAv2 through stack.yml #688

Open haozibi opened 5 years ago

haozibi commented 5 years ago

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

alexellis commented 5 years ago

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

sqaisar commented 2 years ago

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

welteki commented 2 years ago

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.