Class: UffizziCore::ContainerService
- Inherits:
-
Object
- Object
- UffizziCore::ContainerService
- Defined in:
- app/services/uffizzi_core/container_service.rb
Class Method Summary collapse
- .continuously_deploy_enabled?(container) ⇒ Boolean
- .defines_env?(container, name) ⇒ Boolean
- .pod_name(container) ⇒ Object
- .target_port_value(container) ⇒ Object
- .valid_memory_limit?(container) ⇒ Boolean
- .valid_memory_request?(container) ⇒ Boolean
Class Method Details
.continuously_deploy_enabled?(container) ⇒ Boolean
22 23 24 |
# File 'app/services/uffizzi_core/container_service.rb', line 22 def continuously_deploy_enabled?(container) container.aasm(:continuously_deploy).current_state == UffizziCore::Container::STATE_ENABLED end |
.defines_env?(container, name) ⇒ Boolean
16 17 18 19 20 |
# File 'app/services/uffizzi_core/container_service.rb', line 16 def defines_env?(container, name) return false if container.variables.nil? container.variables.select { |v| v['name'].downcase.to_sym == name.to_sym }.any? end |
.pod_name(container) ⇒ Object
5 6 7 8 9 10 |
# File 'app/services/uffizzi_core/container_service.rb', line 5 def pod_name(container) return container.controller_name if container.controller_name.present? formatted_name = container.image_name formatted_name.parameterize.gsub('_', '-') end |
.target_port_value(container) ⇒ Object
12 13 14 |
# File 'app/services/uffizzi_core/container_service.rb', line 12 def target_port_value(container) container.port end |
.valid_memory_limit?(container) ⇒ Boolean
26 27 28 29 30 31 32 |
# File 'app/services/uffizzi_core/container_service.rb', line 26 def valid_memory_limit?(container) max_memory_limit = container.deployment.project.account.container_memory_limit container_memory_limit = container.memory_limit return true if max_memory_limit.nil? || container_memory_limit.nil? container_memory_limit <= max_memory_limit end |
.valid_memory_request?(container) ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'app/services/uffizzi_core/container_service.rb', line 34 def valid_memory_request?(container) max_memory_limit = container.deployment.project.account.container_memory_limit container_memory_request = container.memory_request return true if max_memory_limit.nil? || container_memory_request.nil? container_memory_request <= max_memory_limit end |