lib/metatron/templates/cron_job.rb in metatron-0.2.2 vs lib/metatron/templates/cron_job.rb in metatron-0.2.3
- old
+ new
@@ -8,36 +8,25 @@
include Concerns::PodProducer
include Concerns::Namespaced
attr_accessor :schedule, :suspend, :concurrency_policy, :starting_deadline_seconds,
:successful_jobs_history_limit, :failed_jobs_history_limit,
- :automount_service_account_token, :backoff_limit, :active_deadline_seconds,
- :dns_policy, :restart_policy,
- :scheduler_name, :service_account, :service_account_name
+ :backoff_limit
- alias automountServiceAccountToken automount_service_account_token
alias backoffLimit backoff_limit
- alias activeDeadlineSeconds active_deadline_seconds
alias concurrencyPolicy concurrency_policy
- alias dnsPolicy dns_policy
- alias restartPolicy restart_policy
- alias schedulerName scheduler_name
- alias serviceAccount service_account
- alias serviceAccountName service_account_name
alias startingDeadlineSeconds starting_deadline_seconds
alias successfulJobsHistoryLimit successful_jobs_history_limit
alias failedJobsHistoryLimit failed_jobs_history_limit
def initialize(name, schedule = "* * * * *")
super(name)
@schedule = schedule
@api_version = "batch/v1"
- @restart_policy = "OnFailure"
end
# rubocop:disable Metrics/AbcSize
- # rubocop:disable Metrics/MethodLength
def render
{
apiVersion:,
kind:,
metadata: {
@@ -52,32 +41,15 @@
successfulJobsHistoryLimit:,
failedJobsHistoryLimit:,
jobTemplate: {
spec: {
activeDeadlineSeconds:,
- backoffLimit:,
- template: {
- spec: {
- automountServiceAccountToken:,
- terminationGracePeriodSeconds:,
- dnsPolicy:,
- restartPolicy:,
- schedulerName:,
- serviceAccount:,
- serviceAccountName:,
- containers: containers.map(&:render),
- init_containers: init_containers.any? ? init_containers.map(&:render) : nil
- }.merge(formatted_volumes)
- .merge(formatted_security_context)
- .compact
- }.compact
- }.compact
- }.merge(formatted_tolerations)
- .compact
+ backoffLimit:
+ }.merge(pod_template).compact
+ }.merge(formatted_tolerations).compact
}.compact
}
end
# rubocop:enable Metrics/AbcSize
- # rubocop:enable Metrics/MethodLength
end
end
end