Class: Eien::Apps::ListTask

Inherits:
Task
  • Object
show all
Defined in:
lib/eien/apps/list_task.rb

Instance Attribute Summary

Attributes inherited from Task

#context, #namespace, #task_config

Instance Method Summary collapse

Methods inherited from Task

#initialize

Methods included from Helpers::TimeHelpers

#summarize_age

Constructor Details

This class inherits a constructor from Eien::Task

Instance Method Details

#run!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eien/apps/list_task.rb', line 6

def run!
  client = kubeclient_builder.build_eien_kubeclient(context)
  apps = client.get_apps
  table = TTY::Table.new(
    [
      colorize("NAME").yellow,
      colorize("NAMESPACE").yellow,
      colorize("AGE").yellow,
    ],
    apps.map do |app|
      [
        app..name,
        app.spec.namespace,
        summarize_age(Time.parse(app..creationTimestamp)),
      ]
    end,
  )

  output = table.render(:basic)
  puts output
end