Class: Seira::NodePools

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/seira/node_pools.rb

Constant Summary collapse

VALID_ACTIONS =
%w[help list list-nodes add cordon drain delete].freeze
SUMMARY =
"For managing node pools for a cluster.".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#gcloud, gcloud, kubectl, #kubectl, #tsh, tsh

Constructor Details

#initialize(action:, args:, context:, settings:) ⇒ NodePools

Returns a new instance of NodePools.



15
16
17
18
19
20
# File 'lib/seira/node_pools.rb', line 15

def initialize(action:, args:, context:, settings:)
  @action = action
  @args = args
  @context = context
  @settings = settings
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



13
14
15
# File 'lib/seira/node_pools.rb', line 13

def action
  @action
end

#argsObject (readonly)

Returns the value of attribute args.



13
14
15
# File 'lib/seira/node_pools.rb', line 13

def args
  @args
end

#contextObject (readonly)

Returns the value of attribute context.



13
14
15
# File 'lib/seira/node_pools.rb', line 13

def context
  @context
end

#settingsObject (readonly)

Returns the value of attribute settings.



13
14
15
# File 'lib/seira/node_pools.rb', line 13

def settings
  @settings
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/seira/node_pools.rb', line 22

def run
  case action
  when 'help'
    run_help
  when 'list'
    run_list
  when 'list-nodes'
    run_list_nodes
  when 'add'
    run_add
  when 'cordon'
    run_cordon
  when 'drain'
    run_drain
  when 'delete'
    run_delete
  else
    fail "Unknown command encountered"
  end
end