mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-07 23:31:58 +08:00
All the logics related to k8s (provisioning, bootstrapping, upgrades) now all rely on the KuberneteNode object. The former methods for Vm are still kept in place until the code is deployed and in another commit those parts with their DB tables will be removed altogether. Code will no longer try to add vms to the join tables for the many_to_many tables of both KubernetesCluster and KubernetesNodepool Instead kubernetes_node object will be used to find the right Vms of nodepools and clusters.
20 lines
624 B
Ruby
20 lines
624 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Serializers::KubernetesCluster < Serializers::Base
|
|
def self.serialize_internal(kc, options = {})
|
|
base = {
|
|
id: kc.ubid,
|
|
name: kc.name,
|
|
location: kc.location.display_name,
|
|
display_state: kc.display_state,
|
|
cp_node_count: kc.cp_node_count,
|
|
node_size: kc.target_node_size,
|
|
version: kc.version
|
|
}
|
|
if options[:detailed]
|
|
base[:cp_vms] = Serializers::Vm.serialize(kc.cp_vms_via_nodes_dataset.all)
|
|
base[:nodepools] = Serializers::KubernetesNodepool.serialize(kc.nodepools_dataset.all, {detailed: true})
|
|
end
|
|
base
|
|
end
|
|
end
|