ubicloud/spec/model
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
..
ai Change rubocop TargetRubyVersion to 3.4 2025-04-26 06:51:19 +09:00
dns_zone Change all create_with_id to create 2025-08-06 01:55:51 +09:00
github Log blob storage setup completion 2025-08-20 09:27:49 +02:00
kubernetes Add install_rhizome function to update rhizome in control plane nodes 2025-09-24 14:19:38 +02:00
minio Change all create_with_id to create 2025-08-06 01:55:51 +09:00
postgres Workaround for nil project access in E2E tests 2025-09-16 10:12:05 +02:00
victoria_metrics Change all create_with_id to create 2025-08-06 01:55:51 +09:00
access_control_entry_spec.rb Use create_with_id in the specs 2025-08-07 02:13:08 +09:00
account_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
action_type_spec.rb Add ActionType::NAME_MAP for mapping action names to uuids 2024-12-24 11:02:06 -08:00
address_spec.rb Fix ipv4_address table population in Address#populate_ipv4_addresses 2025-06-21 07:37:04 +09:00
api_key_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
archived_record_spec.rb Add a warning to create more archived_record/audit_log partitions, before it would error 2025-05-20 02:33:19 +09:00
billing_info_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
billing_record_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
boot_image_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
firewall_rule_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
firewall_spec.rb Rename FirewallsPrivateSubnets to PrivateSubnetFirewall 2025-08-08 00:31:44 +09:00
github_installation_spec.rb Use create_with_id in the specs 2025-08-07 02:13:08 +09:00
github_runner_spec.rb Use create_with_id in the specs 2025-08-07 02:13:08 +09:00
host_provider_spec.rb Replace references of HetznerHost with HostProvider 2025-01-31 14:24:34 +01:00
invoice_spec.rb Switch from using [] to using member methods for when using the invoice serializer 2025-08-26 02:08:44 +09:00
ipsec_tunnel_spec.rb Remove refresh_mesh logic 2023-08-22 17:11:00 +02:00
load_balancer_spec.rb Rename LoadBalancersVms to LoadBalancerVm 2025-08-08 00:31:44 +09:00
load_balancer_vm_port_spec.rb Remove duplicate retry logic for LoadBalancerVmPort healthcheck 2025-09-08 11:47:10 +02:00
location_spec.rb Enforce project location access in routes 2025-04-07 08:53:50 -07:00
nic_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
object_metatag_spec.rb Allow authorization methods to accept objects in addition to ids 2025-09-18 02:56:28 +09:00
oidc_provider_spec.rb Handle OIDC providers where issuer includes a path 2025-08-01 04:44:02 +09:00
page_spec.rb Add Page.group_by_vm_host dataset method 2025-09-03 02:39:04 +09:00
payment_method_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
pci_device_spec.rb Get name of PCI device 2025-03-09 15:47:45 +01:00
private_subnet_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
project_quota_spec.rb Add tests to ensure uniqueness of default quotas 2024-07-26 11:51:20 +02:00
project_spec.rb Calculate effective vCPUs quota for Kubernetes clusters of projects 2025-09-26 13:43:45 +03:00
semaphore_spec.rb Make Semaphore.incr use a single query 2025-06-04 05:26:37 +09:00
spec_helper.rb Parallelize unit tests 2024-03-04 10:39:35 +01:00
sshable_spec.rb Log prog information in event of SSH session contention 2025-09-24 20:14:15 -07:00
storage_device_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
strand_spec.rb Use Strand constants for prepared statements 2025-06-27 01:57:33 +09:00
usage_alert_spec.rb Remove all skip_if_frozen{_models} calls in the specs 2024-10-30 12:08:24 -07:00
vm_host_slice_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
vm_host_spec.rb Enable retry logic for VmHost monitor healthchecks 2025-09-08 11:47:10 +02:00
vm_pool_spec.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
vm_spec.rb Avoid the use of serializers for the load balancer show template 2025-08-08 01:52:14 +09:00
vm_storage_volume_spec.rb Use vring_workers as num_queues of Ubiblk backed volumes. 2025-09-09 11:58:45 -07:00