ubicloud/spec
Enes Cakir c44348131d Calculate effective vCPUs quota for Kubernetes clusters of projects
To determine the total effective vCPU usage for each Kubernetes cluster,
sum the vCPUs of all control plane nodes and all worker nodes via node
pools.

Initially, I implemented something similar to the PostgreSQL vCPU usage
calculation to keep the entire logic within the database.

    (kubernetes_clusters_dataset.association_join(nodes: :vm).sum(:vcpus) || 0) + (kubernetes_clusters_dataset.association_join(nodepools: {nodes: :vm}).sum(:vcpus) || 0)

The issue with summing vCPUs of all control plane and worker nodes is
that it assumes all nodes are already created. Kubernetes clusters
differ from PostgreSQL resources: node pools are created at the next
labels of the nexus, not immediately in the assemble.

If a customer creates many clusters at once, the vCPU usage will show as
0 until the strand runs and actually provisions the nodes. To handle
this, I decided to base part of the calculation on the planned target
node sizes (target_node_sizes) instead of relying solely on existing
nodes.
2025-09-26 13:43:45 +03:00
..
clec Introduce autoloading of a test helper 2024-10-29 07:40:12 -07:00
lib Shutdown broken SSH connections during pulse checks 2025-09-26 09:04:02 +02:00
model Calculate effective vCPUs quota for Kubernetes clusters of projects 2025-09-26 13:43:45 +03:00
prog Fix vm destroy workflow for VMs with load balancer 2025-09-25 15:31:00 +03:00
routes Add suspend action for Account on admin panel 2025-09-26 13:37:45 +03:00
scheduling Make vring_workers configurable in Vm::Nexus.assemble. 2025-09-09 11:58:45 -07:00
serializers Add project-level postgres hostname override 2025-09-15 14:41:18 +02:00
cli_config.ru Support setting of PGPASSWORD in bin/ubi and cli/ubi 2025-08-06 02:10:02 +09:00
cli_spec.rb Prevent nondeterministic leaked thread warning in cli spec 2025-09-23 02:53:26 +09:00
config_spec.rb Increase Config test coverage and delete unused lines 2023-08-07 01:05:05 +03:00
coverage_helper.rb Fix coverage filters 2025-08-23 04:18:37 +09:00
db_spec.rb Check all encrypted columns are redacted 2025-07-17 00:44:14 +09:00
monitor_smoke_test.rb Add debugging output on monitor_smoke_test failure 2025-08-27 04:31:39 +09:00
resource_methods_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
respirate_smoke_test.rb Make partitioned respirate automatically rebalance based on number of workers 2025-06-14 01:46:43 +09:00
ruby_sdk_spec.rb Add pg modify-firewall-rule to the cli/sdk 2025-08-26 02:42:03 +09:00
spec_helper.rb Fix nondeterministic instance double reuse in dispatcher spec 2025-09-25 01:34:51 +09:00
thawed_mock.rb Add Prog::Base.current_prog to find prog information in the stack 2025-09-24 20:14:15 -07:00
ubid_spec.rb Use create_with_id in the specs 2025-08-07 02:13:08 +09:00