openfaas / faas-cli

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

Show memory and CPU requests/limits in faas-cli describe #926

Closed alexellis closed 2 years ago

alexellis commented 2 years ago

Expected Behaviour

Show memory and CPU requests/limits in faas-cli describe

Current Behaviour

OpenFaaS Pro shows utilization, but neither Pro or CE show the limit as set on the function spec.

List All Possible Solutions and Workarounds

See if it's present in the API, and display it if it is.

Steps to Reproduce (for bugs)

See example stack.yml here:

https://docs.openfaas.com/reference/yaml/#function-memorycpu-limits

Then run faas-cli describe

Context

Confusing for users - it's not easy to tell if a limit or request has been set for CPU/RAM.

rgee0 commented 2 years ago

What am I misunderstanding in the issue if I suggest the -v flag provides this?

alexellis commented 2 years ago

Thanks for the reminder :facepalm:

I guess that it was so non-obvious that I even forgot how it was implemented.

alex@bq:~$ faas-cli describe imagenet -v
Name:               imagenet
Status:             Ready
Replicas:           1
Available Replicas: 1
Invocations:        4
Image:              alexellis2/imagenet:0.0.11
Function Process:   python index.py
URL:                http://127.0.0.1:8080/function/imagenet
Async URL:          http://127.0.0.1:8080/async-function/imagenet
Labels:
 com.openfaas.scale.target: 800
 com.openfaas.scale.target-proportion: 0.90
 com.openfaas.scale.type: cpu
Annotations:
 com.openfaas.health.http.initialDelay: 5s
 com.openfaas.health.http.path: /health
 com.openfaas.health.http.periodSeconds: 2s
Constraints:  <none>
Environment:
 TF_CPP_MIN_LOG_LEVEL: 3
Secrets:   <none>
Requests:  <none>
Limits:    <none>
Usage:
  RAM:  525.89 MB
  CPU:  2 Mi
LucasRoesler commented 2 years ago

I am pretty sure it is hidden behind the -v for "backwards compatibility". But i don't know any use cases that would break by showing the values by default.