Class: UffizziCore::TemplateService

Inherits:
Object
  • Object
show all
Defined in:
app/services/uffizzi_core/template_service.rb

Class Method Summary collapse

Class Method Details

.valid_containers_memory_limit?(template) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
# File 'app/services/uffizzi_core/template_service.rb', line 5

def valid_containers_memory_limit?(template)
  containers_attributes = template.payload['containers_attributes']
  container_memory_limit = template.project..container_memory_limit
  return true if container_memory_limit.nil?

  containers_attributes.all? { |container| container['memory_limit'].to_i <= container_memory_limit }
end

.valid_containers_memory_request?(template) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'app/services/uffizzi_core/template_service.rb', line 13

def valid_containers_memory_request?(template)
  containers_attributes = template.payload['containers_attributes']
  container_memory_limit = template.project..container_memory_limit
  return true if container_memory_limit.nil?

  containers_attributes.all? { |container| container['memory_request'].to_i <= container_memory_limit }
end