Class: Eien::Routes::UpdateTask

Inherits:
Task
  • Object
show all
Defined in:
lib/eien/routes/update_task.rb

Constant Summary collapse

ALLOWED_ATTRIBUTES =
[:enabled, :domains, :path, :process, :port].freeze

Instance Attribute Summary collapse

Attributes inherited from Task

#context, #namespace, #task_config

Instance Method Summary collapse

Methods included from Helpers::TimeHelpers

#summarize_age

Constructor Details

#initialize(context, app, name, **attributes) ⇒ UpdateTask

Returns a new instance of UpdateTask.



10
11
12
13
14
15
# File 'lib/eien/routes/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

#appObject (readonly)

Returns the value of attribute app.



8
9
10
# File 'lib/eien/routes/update_task.rb', line 8

def app
  @app
end

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/eien/routes/update_task.rb', line 8

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/eien/routes/update_task.rb', line 8

def name
  @name
end

Instance Method Details

#run!Object



17
18
19
20
21
22
23
# File 'lib/eien/routes/update_task.rb', line 17

def run!
  client = kubeclient_builder.build_eien_kubeclient(context)
  the_route = client.get_route(name, app.spec.namespace)
  the_route.spec = (the_route.spec&.to_h || {}).merge(attributes)

  client.update_route(the_route)
end