class Chef::Knife::IonoscloudNodeReplace
Attributes
description[R]
required_options[R]
Public Class Methods
new(args = [])
click to toggle source
Calls superclass method
# File lib/chef/knife/ionoscloud_node_replace.rb, line 23 def initialize(args = []) super(args) @description = "You can recreate a single Kubernetes Node.\n\n"\ "Managed Kubernetes starts a process which based on the nodepool\'s "\ "template creates & configures a new node, waits for status \"ACTIVE\", "\ "and migrates all the pods from the faulty node, deleting it once empty. "\ "While this operation occurs, the nodepool will have an extra billable \"ACTIVE\" node." @required_options = [:cluster_id, :nodepool_id, :ionoscloud_username, :ionoscloud_password] end
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/ionoscloud_node_replace.rb, line 34 def run $stdout.sync = true handle_extra_config validate_required_params(@required_options, config) kubernetes_api = Ionoscloud::KubernetesApi.new(api_client) @name_args.each do |node_id| begin kubernetes_api.k8s_nodepools_nodes_replace_post(config[:cluster_id], config[:nodepool_id], node_id) rescue Ionoscloud::ApiError => err raise err unless err.code == 404 ui.error("K8s Node ID #{node_id} not found. Skipping.") next end ui.warn("Recreated K8s Node #{node_id}.") end end