Class: Eien::Secrets::ListTask
- Defined in:
- lib/eien/secrets/list_task.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Task
#context, #namespace, #task_config
Instance Method Summary collapse
-
#initialize(context, app, name) ⇒ ListTask
constructor
A new instance of ListTask.
- #run! ⇒ Object
Methods included from Helpers::TimeHelpers
Constructor Details
#initialize(context, app, name) ⇒ ListTask
Returns a new instance of ListTask.
8 9 10 11 12 |
# File 'lib/eien/secrets/list_task.rb', line 8 def initialize(context, app, name) @app = app @name = name super(context) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/eien/secrets/list_task.rb', line 6 def app @app end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/eien/secrets/list_task.rb', line 6 def name @name end |
Instance Method Details
#run! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/eien/secrets/list_task.rb', line 14 def run! the_app = Eien.app_from_name(context, app) client = kubeclient_builder.build_v1_kubeclient(context) secret = begin client.get_secret(::Eien.secret_name(name), the_app.spec.namespace) rescue Kubeclient::ResourceNotFoundError nil end return if secret.nil? key_pairs = secret.data.to_h || {} table = TTY::Table.new( [ colorize("KEY").yellow, colorize("VALUE").yellow, ], key_pairs.map do |key, value| [ key, Base64.decode64(value), ] end, ) output = table.render(:basic) puts output end |