ubicloud/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 Stop using serializer for inference endpoint route 2025-08-26 02:08:44 +09:00
dns_zone Convert SemaphoreMethods to Sequel plugin 2025-07-09 00:42:44 +09:00
github Do not try to abort multipart uploads if the bucket is already deleted 2025-09-17 21:48:01 +03:00
kubernetes Add install_rhizome function to update rhizome in control plane nodes 2025-09-24 14:19:38 +02:00
minio Add ResourceMethods plugin encrypted_columns argument 2025-07-09 05:45:18 +09:00
postgres Start using az selection capabilities of the VM for PG Standby 2025-09-19 16:19:50 +02:00
access_control_entry.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
account.rb Support configurable labels for links on admin site 2025-09-04 02:37:23 +09:00
account_identity.rb Add identities association to the account 2024-12-30 12:22:26 +03:00
action_tag.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
action_type.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
address.rb Revert "Revert the use of the ipv4_address table to speed up VmHost#ip4_random_vm_network" 2025-06-21 07:53:00 +09:00
api_key.rb Add ApiKey#path 2025-08-26 02:08:44 +09:00
archived_record.rb Create ArchivedRecord model 2024-12-14 11:48:31 +01:00
assigned_host_address.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
assigned_vm_address.rb Fix AssignedVmAddress#vm association 2025-06-25 05:12:03 +09:00
aws_instance.rb Add migration for EC2 DNS name 2025-08-05 16:26:18 +02:00
billing_info.rb Allow customers to add additional note to invoice 2025-09-05 13:46:45 +03:00
billing_record.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
boot_image.rb Change all create_with_id to create 2025-08-06 01:55:51 +09:00
cert.rb Rename CertsLoadBalancers to LoadBalancerCert 2025-08-08 00:31:44 +09:00
connected_subnet.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
discount_code.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
firewall.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
firewall_rule.rb Add Firewall#display_port_range 2025-08-08 01:52:14 +09:00
github_installation.rb Fix free premium runner upgrade logic 2025-07-03 18:14:55 +03:00
github_runner.rb Round VM and runner provisioning times in logs 2025-09-17 21:45:01 +03:00
globally_blocked_dnsname.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
host_provider.rb Move aws subnet to nic 2025-09-19 16:19:50 +02:00
invoice.rb Allow authorization methods to accept objects in addition to ids 2025-09-18 02:56:28 +09:00
ipsec_tunnel.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
load_balancer.rb Add LoadBalancer#health_check_url 2025-08-27 04:31:08 +09:00
load_balancer_cert.rb Rename CertsLoadBalancers to LoadBalancerCert 2025-08-08 00:31:44 +09:00
load_balancer_port.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
load_balancer_vm.rb Rename LoadBalancersVms to LoadBalancerVm 2025-08-08 00:31:44 +09:00
load_balancer_vm_port.rb Set last pulse of monitorable resources 2025-09-26 09:04:02 +02:00
location.rb Use arch while selecting the target AMI for Postgres 2025-07-07 10:52:33 +03:00
location_credential.rb Setup individual instance IAMs to be used by cloudwatch agent 2025-07-28 09:44:57 +03:00
locked_domain.rb Make locked_domain.domain column citext instead of text 2025-07-17 00:44:40 +09:00
nic.rb Stop using serializers in the private subnet show template 2025-08-08 01:52:14 +09:00
nic_aws_resource.rb Move aws subnet info to nic - migration 2025-09-19 16:19:50 +02:00
object_metatag.rb Avoid explicitly casting string arrays used for = ANY/!= ALL 2025-04-30 06:05:53 +09:00
object_tag.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
oidc_provider.rb Replace unnecessary new_with_id calls with new 2025-08-06 01:55:51 +09:00
page.rb Add Page.group_by_vm_host dataset method 2025-09-03 02:39:04 +09:00
payment_method.rb Add PaymentMethod#path 2025-08-26 02:08:44 +09:00
pci_device.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
pg_aws_ami.rb Migration to add arch column to pg_aws_ami 2025-07-07 10:52:33 +03:00
private_subnet.rb Move aws subnet to nic 2025-09-19 16:19:50 +02:00
private_subnet_aws_resource.rb Cleanup AWS subnet info from private_subnet_aws_resource - migration 2025-09-19 16:19:50 +02:00
private_subnet_firewall.rb Rename FirewallsPrivateSubnets to PrivateSubnetFirewall 2025-08-08 00:31:44 +09:00
project.rb Calculate effective vCPUs quota for Kubernetes clusters of projects 2025-09-26 13:43:45 +03:00
project_discount_code.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
project_invitation.rb Move unrestrict primary key calls inside the related model 2025-06-04 04:55:45 +09:00
project_quota.rb Move unrestrict primary key calls inside the related model 2025-06-04 04:55:45 +09:00
semaphore.rb Make Semaphore.incr use a single query 2025-06-04 05:26:37 +09:00
spdk_installation.rb Use ResourceMethods plugin in SpdkInstallation 2025-06-04 04:55:45 +09:00
sshable.rb Log prog information in event of SSH session contention 2025-09-24 20:14:15 -07:00
storage_device.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
storage_key_encryption_key.rb Add ResourceMethods plugin encrypted_columns argument 2025-07-09 05:45:18 +09:00
strand.rb Use FOR NO KEY UPDATE instead of FOR UPDATE 2025-07-04 09:26:06 +09:00
subject_tag.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
usage_alert.rb Convert ResourceMethods to a plugin 2025-06-04 04:55:45 +09:00
vhost_block_backend.rb Clover: Ubiblk setup 2025-06-11 11:24:17 -07:00
victoria_metrics_resource.rb Make VictoriaMetricsResource.redacted_columns unique 2025-07-17 00:44:14 +09:00
victoria_metrics_server.rb Add ResourceMethods plugin encrypted_columns argument 2025-07-09 05:45:18 +09:00
vm.rb Support VMs without IPv6 2025-09-04 14:15:35 +02:00
vm_host.rb Enable retry logic for VmHost monitor healthchecks 2025-09-08 11:47:10 +02:00
vm_host_cpu.rb Move unrestrict primary key calls inside the related model 2025-06-04 04:55:45 +09:00
vm_host_slice.rb Convert SemaphoreMethods to Sequel plugin 2025-07-09 00:42:44 +09:00
vm_pool.rb Convert SemaphoreMethods to Sequel plugin 2025-07-09 00:42:44 +09:00
vm_storage_volume.rb Use vring_workers as num_queues of Ubiblk backed volumes. 2025-09-09 11:58:45 -07:00