From ee3f1c28a6ae5c216f79e79562f5850a24cb2cd2 Mon Sep 17 00:00:00 2001 From: novahow Date: Wed, 3 Apr 2024 11:43:35 +0800 Subject: [PATCH] add plugins support for k8s imagepullpolicy Signed-off-by: novahow --- .../go/tasks/pluginmachinery/flytek8s/config/config.go | 3 +++ .../go/tasks/pluginmachinery/flytek8s/container_helper.go | 1 + 2 files changed, 4 insertions(+) diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/config/config.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/config/config.go index 404924ef07..de242f327e 100644 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/config/config.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/config/config.go @@ -203,6 +203,9 @@ type K8sPluginConfig struct { // SendObjectEvents indicates whether to send k8s object events in TaskExecutionEvent updates (similar to kubectl get events). SendObjectEvents bool `json:"send-object-events" pflag:",If true, will send k8s object events in TaskExecutionEvent updates."` + + // ImagePullPolicy for the submitted pod. + ImagePullPolicy v1.PullPolicy `json:"image-pull-policy" pflag:"-,Image pull policy for all k8s pods created by FlytePropeller."` } // FlyteCoPilotConfig specifies configuration for the Flyte CoPilot system. FlyteCoPilot, allows running flytekit-less containers diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/container_helper.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/container_helper.go index 268819473a..d0cbe62b07 100644 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/container_helper.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/container_helper.go @@ -226,6 +226,7 @@ func BuildRawContainer(ctx context.Context, tCtx pluginscore.TaskExecutionContex Env: ToK8sEnvVar(taskContainer.GetEnv()), TerminationMessagePolicy: v1.TerminationMessageFallbackToLogsOnError, Resources: *res, + ImagePullPolicy: config.GetK8sPluginConfig().ImagePullPolicy, } return container, nil