Class: Cluster
- Inherits:
-
Object
show all
- Includes:
- Utils
- Defined in:
- lib/hetzner/k3s/cluster.rb
Constant Summary
Constants included
from Utils
Utils::CMD_FILE_PATH
Instance Method Summary
collapse
Methods included from Utils
#run, #ssh, #verify_host_key, #wait_for_ssh, #which, #write_file
Constructor Details
#initialize(configuration:) ⇒ Cluster
Returns a new instance of Cluster.
24
25
26
|
# File 'lib/hetzner/k3s/cluster.rb', line 24
def initialize(configuration:)
@configuration = configuration
end
|
Instance Method Details
#create ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/hetzner/k3s/cluster.rb', line 28
def create
@cluster_name = configuration['cluster_name']
@masters_config = configuration['masters']
@worker_node_pools = find_worker_node_pools(configuration)
@masters_location = configuration['location']
@servers = []
@ssh_networks = configuration['ssh_allowed_networks']
@api_networks = configuration['api_allowed_networks']
@private_ssh_key_path = File.expand_path(configuration['private_ssh_key_path'])
@public_ssh_key_path = File.expand_path(configuration['public_ssh_key_path'])
create_resources
kubernetes_client.deploy(masters: masters, workers: workers, master_definitions: master_definitions_for_create, worker_definitions: workers_definitions_for_marking)
end
|
#delete ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/hetzner/k3s/cluster.rb', line 44
def delete
@cluster_name = configuration['cluster_name']
@kubeconfig_path = File.expand_path(configuration['kubeconfig_path'])
@public_ssh_key_path = File.expand_path(configuration['public_ssh_key_path'])
@masters_config = configuration['masters']
@worker_node_pools = find_worker_node_pools(configuration)
delete_resources
end
|
#upgrade(new_k3s_version:, config_file:) ⇒ Object
54
55
56
57
58
59
60
61
|
# File 'lib/hetzner/k3s/cluster.rb', line 54
def upgrade(new_k3s_version:, config_file:)
@cluster_name = configuration['cluster_name']
@kubeconfig_path = File.expand_path(configuration['kubeconfig_path'])
@new_k3s_version = new_k3s_version
@config_file = config_file
kubernetes_client.upgrade
end
|