lib/metatron/templates/pod.rb in metatron-0.1.9 vs lib/metatron/templates/pod.rb in metatron-0.2.0
- old
+ new
@@ -6,11 +6,10 @@
class Pod < Template
include Concerns::Annotated
include Concerns::PodProducer
include Concerns::Namespaced
- # rubocop:disable Metrics/MethodLength
# rubocop:disable Metrics/AbcSize
def render
{
apiVersion:,
kind:,
@@ -18,30 +17,17 @@
labels: { "#{label_namespace}/name": name }.merge(additional_labels),
name:
}.merge(formatted_annotations).merge(formatted_namespace),
spec: {
terminationGracePeriodSeconds:,
- containers: [
- {
- name: "app",
- image:,
- imagePullPolicy:,
- stdin: true,
- tty: true,
- resources: { limits: resource_limits, requests: resource_requests }
- }.merge(probes)
- .merge(formatted_environment)
- .merge(formatted_envfrom)
- .merge(formatted_ports)
- .merge(formatted_volume_mounts)
- .merge(formatted_container_security_context)
- ] + additional_containers
+ containers: containers.map(&:render),
+ init_containers: init_containers.any? ? init_containers.map(&:render) : nil
}.merge(formatted_volumes)
.merge(formatted_security_context)
.merge(formatted_tolerations)
+ .compact
}
end
# rubocop:enable Metrics/AbcSize
- # rubocop:enable Metrics/MethodLength
end
end
end