Files
ubicloud/model/kubernetes/kubernetes_nodepool.rb
Eren Başak 6a5abdacbc Add migration for kubernetes vm size specification
This patch adds new columns to kubernetes models so that we allow
specific compute and storage sizes on Kubernetes VMs.

This change applies to both KubernetesCluster model for control plane
nodes and KubernetesNodepool model for worker nodes.

For both models, the compute specification is not null and the default
will be set in the nexus.

The theory is that, kubernetes community usually are
not interested in the actual size of the nodes, and slap cluster
autoscaler to handle the number of nodes.

Even less important, is the storage size of the nodes, so
that's left as null-able. In clover, we usually pick the lowest available
storage size of the selected compute size by default, so we can implement
the same logic for k8s nodes as well.
2025-02-04 13:43:16 +02:00

31 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require_relative "../../model"
class KubernetesNodepool < Sequel::Model
one_to_one :strand, key: :id
many_to_one :cluster, key: :kubernetes_cluster_id, class: :KubernetesCluster
many_to_many :vms, order: :created_at
include ResourceMethods
include SemaphoreMethods
semaphore :destroy
end
# Table: kubernetes_nodepool
# Columns:
# id | uuid | PRIMARY KEY
# name | text | NOT NULL
# node_count | integer | NOT NULL
# created_at | timestamp with time zone | NOT NULL DEFAULT CURRENT_TIMESTAMP
# kubernetes_cluster_id | uuid | NOT NULL
# target_node_size | text | NOT NULL
# target_node_storage_size_gib | bigint |
# Indexes:
# kubernetes_nodepool_pkey | PRIMARY KEY btree (id)
# Foreign key constraints:
# kubernetes_nodepool_kubernetes_cluster_id_fkey | (kubernetes_cluster_id) REFERENCES kubernetes_cluster(id)
# Referenced By:
# kubernetes_nodepools_vms | kubernetes_nodepools_vms_kubernetes_nodepool_id_fkey | (kubernetes_nodepool_id) REFERENCES kubernetes_nodepool(id)