Class: Reschedule::Reschedulers::MemoryThreshold
- Defined in:
- lib/reschedule/reschedulers/memory_threshold.rb
Instance Attribute Summary collapse
-
#heapster_api ⇒ Object
readonly
Returns the value of attribute heapster_api.
-
#kubernetes_api ⇒ Object
readonly
Returns the value of attribute kubernetes_api.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MemoryThreshold
constructor
A new instance of MemoryThreshold.
- #run ⇒ Object
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(={}) super @heapster_api = Reschedule::Heapster::Api.new @kubernetes_api = Reschedule::Kubernetes::Api.new end |
Instance Attribute Details
#heapster_api ⇒ Object (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_api ⇒ Object (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
#run ⇒ Object
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 |