Check openstack quota resources
What does this MR do and why?
Check if Openstack Quota Resources available are enough for deployment
In order to avoid deployment crash because of lack of resources, wrong credentials or openstack unreachability
This Job is ran:
- in the bootstrap cluster only just before deploying management cluster (sylva-system namespace)
Note: it is diffult to run it for workload cluster, it could work during the first deployment but it will be difficult to handle update (for example add machine deployment, control planes) because we need to take into account what is already deployed and what the new need.
explanations
Based on an generic openstack-job (similar to kube-job)
we configure a new kustomize-unit openstack-quota-resources-validation that will trigger an openstack-job
This script will do:
- authentication test
- fails in case of wrong credentials (with human understandable message)
- fails in case of unreachability (with human understandable message)
- executing some quota checks on openstack (cores, ram, disk, floating-ips, instances, server-groups, security-groups, volumes)
- cores: based on flavor and number of CP and MD
- ram: based on flavor and number of CP and MD
- disk: based on rootdisk size (if set) and default on flavor disk size and number of CP and MD
- floating-ip: fixed value =1
- instances: based on flavor and number of CP and MD
- server-groups: depends on if we reuse server-groups for CP and/or MDs
- security-groups: always 5
- security-group rules: always 21
- volumes: based on number of CP and MD (take into account: root, vault, keycloak and harbor vols)
The logs of the openstack-quota-resources-validation-sylva-system Job are similar to:
*** Openstack available resources validation ***
verify enough resources are available before deployment:
- cores
- ram
- disk
- floating-ips
- instances
- server-groups
- security-groups
- volumes
Openstack authentication successful
----------------------------------------
|Flavor chosen m1.xlarge |
----------------------------------------
vcpus | 8 |
ram | 16384 |
disk | 20 |
----------------------------------------
TEST
----------------------------------------
|Required resources |
----------------------------------------
cores | 32 |
ram | 65536 |
disk | 435 |
instances | 4 | 3 cp 1 md
floating-ips | 1 |
server-groups | 2 |
security-groups | 5 |
security-groups-rules | 21 |
volumes | 39 |
----------------------------------------
--------------------------------------------------------------------------------
quota | limit | used | required | test
--------------------------------------------------------------------------------
cores | 200 | 4 | 32 | pass
ram | 512000 | 8192 | 65536 | pass
disk | 10000 | 80 | 435 | pass
instances | 100 | 1 | 4 | pass
floating-ips | 50 | 0 | 1 | pass
server-group | 10 | 0 | 2 | pass
security-groups | 50 | 2 | 5 | pass
security-group rules | 100 | 10 | 21 | pass
volumes | 100 | 1 | 39 | pass
--------------------------------------------------------------------------------
==> Deployment can continue on OpenStack
When job fails, the logs end by something similar to detailing which test fails:
--------------------------------------------------------------------------------
quota | limit | used | required | test
--------------------------------------------------------------------------------
cores | 200 | 4 | 2912 | fail
ram | 512000 | 8192 | 5963776 | fail
disk | 10000 | 80 | 9908 | pass
instances | 100 | 1 | 91 | pass
floating-ips | 50 | 0 | 1 | pass
server-group | 10 | 0 | 2 | pass
security-groups | 50 | 2 | 5 | pass
security-group rules | 100 | 10 | 21 | pass
volumes | 100 | 1 | 357 | fail
--------------------------------------------------------------------------------
==X Deployment can't continue: not enough resources