Class: Pangea::Kubernetes::BareMetal::ClusterReference
- Inherits:
-
Object
- Object
- Pangea::Kubernetes::BareMetal::ClusterReference
- Defined in:
- lib/pangea/kubernetes/bare_metal/cluster_reference.rb
Overview
Synthetic cluster reference for unmanaged Kubernetes (k3s, kubeadm, etc.). Unlike managed K8s (EKS, GKE, AKS), bare-metal clusters don’t have a single terraform resource representing the cluster. This provides a compatible interface using the primary control plane server.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#control_plane_servers ⇒ Object
readonly
Returns the value of attribute control_plane_servers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#worker_servers ⇒ Object
readonly
Returns the value of attribute worker_servers.
Instance Method Summary collapse
-
#all_node_ips ⇒ Object
All node IPs (control plane + workers).
-
#api_endpoint ⇒ Object
Full API endpoint URL.
-
#api_port ⇒ Object
k3s API port.
-
#endpoint ⇒ Object
Primary control plane endpoint.
-
#initialize(name:, control_plane_servers:, worker_servers: [], config: {}) ⇒ ClusterReference
constructor
A new instance of ClusterReference.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, control_plane_servers:, worker_servers: [], config: {}) ⇒ ClusterReference
Returns a new instance of ClusterReference.
27 28 29 30 31 32 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 27 def initialize(name:, control_plane_servers:, worker_servers: [], config: {}) @name = name @control_plane_servers = control_plane_servers @worker_servers = worker_servers @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
25 26 27 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 25 def config @config end |
#control_plane_servers ⇒ Object (readonly)
Returns the value of attribute control_plane_servers.
25 26 27 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 25 def control_plane_servers @control_plane_servers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 25 def name @name end |
#worker_servers ⇒ Object (readonly)
Returns the value of attribute worker_servers.
25 26 27 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 25 def worker_servers @worker_servers end |
Instance Method Details
#all_node_ips ⇒ Object
All node IPs (control plane + workers)
50 51 52 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 50 def all_node_ips (control_plane_servers + worker_servers).map(&:ipv4_address) end |
#api_endpoint ⇒ Object
Full API endpoint URL
45 46 47 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 45 def api_endpoint "https://#{endpoint}:#{api_port}" end |
#api_port ⇒ Object
k3s API port
40 41 42 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 40 def api_port 6443 end |
#endpoint ⇒ Object
Primary control plane endpoint
35 36 37 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 35 def endpoint primary_server&.ipv4_address end |
#to_h ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/pangea/kubernetes/bare_metal/cluster_reference.rb', line 54 def to_h { name: name, endpoint: endpoint, api_port: api_port, control_plane_count: control_plane_servers.size, worker_count: worker_servers.size } end |