chore: OpenFaas function to get metrics from Kubernetes
Description
Adds an OpenFaas function to generate a report containing the resource usage per namespace. The report includes:
- cpu minutes used
- memory used
- how many VMs the above is equivalent to.
Testing instructions
I've set up the service at https://openfaas.kgcluster.opencraft.hosting/ui/. Password can be found in vault path: shared/openfaas-ingresskgcluster
It can be tested with the following URLs:
curl --insecure -u admin:pass https://openfaas.kgcluster.opencraft.hosting/function/usage-reporter
curl --insecure -u admin:pass https://openfaas.kgcluster.opencraft.hosting/function/usage-reporter -H "Content-Type: application/json" --request POST --data '{"provider": "k8s-metrics"}'
curl --insecure -u admin:pass https://openfaas.kgcluster.opencraft.hosting/function/usage-reporter -H "Content-Type: application/json" --request POST --data '{"provider": "prometheus": "timestamp": "2022-10-01"}'
Checklist
If any of the items below is not applicable, do not remove them, but put a check in it.
-
All providers include the new feature/change -
All affected providers can provision new clusters -
Unit tests are added/updated -
Documentation is added/updated -
The TOOLS_CONTAINER_IMAGE_VERSION
in ci_vars.yml is updated -
The grove-template repository is updated
Edited by Keith Grootboom