Class: Eien::Domains::UpdateTask
- Defined in:
- lib/eien/domains/update_task.rb
Constant Summary collapse
- ALLOWED_ATTRIBUTES =
[:enabled, :name].freeze
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, name, **attributes) ⇒ UpdateTask
constructor
A new instance of UpdateTask.
- #run! ⇒ Object
Methods included from Helpers::TimeHelpers
Constructor Details
#initialize(context, app, name, **attributes) ⇒ UpdateTask
Returns a new instance of UpdateTask.
10 11 12 13 14 15 |
# File 'lib/eien/domains/update_task.rb', line 10 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.
8 9 10 |
# File 'lib/eien/domains/update_task.rb', line 8 def app @app end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
8 9 10 |
# File 'lib/eien/domains/update_task.rb', line 8 def attributes @attributes end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
8 9 10 |
# File 'lib/eien/domains/update_task.rb', line 8 def domain @domain end |
Instance Method Details
#run! ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/eien/domains/update_task.rb', line 17 def run! client = kubeclient_builder.build_eien_kubeclient(context) domains = client.get_domains(namespace: app.spec.namespace) domains.map do |domain_resource| domain_resource.spec = (domain_resource.spec&.to_h || {}).merge(attributes) client.update_domain(domain_resource) end end |