From 9395ca14a144a01daa70e24e96c997759423b7e6 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 29 Mar 2024 10:30:12 +0100 Subject: [PATCH] Only pull images if they are not available locally Avoid excessive downloads and only pull images if needed. This makes the rollout faster and also helps to reduce traffic when cronjobs are used. --- lib/cuber/templates/deployment.yml.erb | 8 ++++---- lib/cuber/templates/pod.yml.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cuber/templates/deployment.yml.erb b/lib/cuber/templates/deployment.yml.erb index 1bb213b..fff87a6 100644 --- a/lib/cuber/templates/deployment.yml.erb +++ b/lib/cuber/templates/deployment.yml.erb @@ -100,7 +100,7 @@ spec: containers: - name: migration image: <%= @options[:image] %>:<%= @options[:release] %> - imagePullPolicy: Always + imagePullPolicy: IfNotPresent <%- if @options[:buildpacks] -%> command: ["launcher"] args: <%= @options[:migrate][:cmd].shellsplit %> @@ -152,7 +152,7 @@ spec: containers: - name: <%= procname %>-proc image: <%= @options[:image] %>:<%= @options[:release] %> - imagePullPolicy: Always + imagePullPolicy: IfNotPresent <%- if @options[:buildpacks] -%> command: ["launcher"] args: <%= proc[:cmd].shellsplit %> @@ -202,7 +202,7 @@ spec: initContainers: - name: migration-check image: <%= @options[:image] %>:<%= @options[:release] %> - imagePullPolicy: Always + imagePullPolicy: IfNotPresent <%- if @options[:buildpacks] -%> command: ["launcher"] args: <%= @options[:migrate][:check].shellsplit %> @@ -257,7 +257,7 @@ spec: containers: - name: task image: <%= @options[:image] %>:<%= @options[:release] %> - imagePullPolicy: Always + imagePullPolicy: IfNotPresent <%- if @options[:buildpacks] -%> command: ["launcher"] args: <%= cron[:cmd].shellsplit %> diff --git a/lib/cuber/templates/pod.yml.erb b/lib/cuber/templates/pod.yml.erb index efd1d76..6228a0d 100644 --- a/lib/cuber/templates/pod.yml.erb +++ b/lib/cuber/templates/pod.yml.erb @@ -11,7 +11,7 @@ spec: containers: - name: pod-proc image: <%= @options[:image] %>:<%= @options[:release] %> - imagePullPolicy: Always + imagePullPolicy: IfNotPresent command: ["sleep", "infinity"] envFrom: - configMapRef: