lib/metatron/templates/concerns/pod_producer.rb in metatron-0.1.3 vs lib/metatron/templates/concerns/pod_producer.rb in metatron-0.1.4
- old
+ new
@@ -9,11 +9,12 @@
# base.extend ClassMethods
base.class_eval do
attr_accessor :image, :image_pull_policy, :additional_labels, :env, :envfrom,
:resource_limits, :resource_requests, :probes, :ports, :security_context,
:volume_mounts, :volumes, :additional_containers,
- :container_security_context, :affinity, :termination_grace_period_seconds
+ :container_security_context, :affinity, :termination_grace_period_seconds,
+ :tolerations
initializer :pod_producer_initialize
alias_method :imagePullPolicy, :image_pull_policy
alias_method :volumeMounts, :volume_mounts
@@ -38,15 +39,14 @@
@security_context = {}
@container_security_context = {}
@additional_containers = []
@additional_labels = {}
@termination_grace_period_seconds = 60
+ @tolerations = []
end
- def formatted_affinity
- affinity && !affinity.empty? ? { affinity: } : {}
- end
+ def formatted_affinity = affinity && !affinity.empty? ? { affinity: } : {}
def formatted_environment
env && !env.empty? ? { env: env.map { |k, v| { name: k, value: v } } } : {}
end
@@ -56,13 +56,11 @@
else
{}
end
end
- def formatted_ports
- ports&.any? ? { ports: } : {}
- end
+ def formatted_ports = ports&.any? ? { ports: } : {}
def formatted_security_context
security_context && !security_context.empty? ? { securityContext: } : {}
end
@@ -72,16 +70,12 @@
else
{}
end
end
- def formatted_volume_mounts
- volume_mounts&.any? ? { volumeMounts: } : {}
- end
-
- def formatted_volumes
- volumes&.any? ? { volumes: } : {}
- end
+ def formatted_tolerations = tolerations&.any? ? { tolerations: } : {}
+ def formatted_volume_mounts = volume_mounts&.any? ? { volumeMounts: } : {}
+ def formatted_volumes = volumes&.any? ? { volumes: } : {}
end
end
end
end