Class: Eien::Processes::CreateTask
- Defined in:
- lib/eien/processes/create_task.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#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, **attributes) ⇒ CreateTask
constructor
A new instance of CreateTask.
- #run! ⇒ Object
Methods included from Helpers::TimeHelpers
Constructor Details
#initialize(context, app, name, **attributes) ⇒ CreateTask
Returns a new instance of CreateTask.
8 9 10 11 12 13 |
# File 'lib/eien/processes/create_task.rb', line 8 def initialize(context, app, name, **attributes) @app = Eien.app_from_name(context, app) @name = name @attributes = attributes super(context) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/eien/processes/create_task.rb', line 6 def app @app end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/eien/processes/create_task.rb', line 6 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/eien/processes/create_task.rb', line 6 def name @name end |
Instance Method Details
#run! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/eien/processes/create_task.rb', line 15 def run! client = kubeclient_builder.build_eien_kubeclient(context) process = Kubeclient::Resource.new( metadata: { name: name, namespace: app.spec.namespace, labels: { "#{::Eien::LABEL_PREFIX}/app": app..name, }, }, spec: attributes, ) client.create_process(process) end |