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