Class: Reschedule::Reschedulers::MemoryThreshold

Inherits:
Base
  • Object
show all
Defined in:
lib/reschedule/reschedulers/memory_threshold.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#options

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ MemoryThreshold

Returns a new instance of MemoryThreshold.



11
12
13
14
15
# File 'lib/reschedule/reschedulers/memory_threshold.rb', line 11

def initialize(options={})
  super
  @heapster_api = Reschedule::Heapster::Api.new
  @kubernetes_api = Reschedule::Kubernetes::Api.new
end

Instance Attribute Details

#heapster_apiObject (readonly)

Returns the value of attribute heapster_api.



4
5
6
# File 'lib/reschedule/reschedulers/memory_threshold.rb', line 4

def heapster_api
  @heapster_api
end

#kubernetes_apiObject (readonly)

Returns the value of attribute kubernetes_api.



4
5
6
# File 'lib/reschedule/reschedulers/memory_threshold.rb', line 4

def kubernetes_api
  @kubernetes_api
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/reschedule/reschedulers/memory_threshold.rb', line 17

def run
  super
  node_names = rescheduleable_node_names
  Reschedule.logger.debug "Found #{node_names.length} rescheduleable nodes"
  return if node_names.blank?

  pods = get_pods
  Reschedule.logger.debug "Found #{pods.length} total pods"
  replication_controller_names = pods_and_node_names_to_replication_controller_names(pods, node_names)
  replication_controller_names.each do |replication_controller_name|
    reschedule_replication_controller(replication_controller_name)
  end
end