From fee3114f8fce59d898e0d8158d2323b5a46a7c83 Mon Sep 17 00:00:00 2001 From: machichima Date: Wed, 5 Feb 2025 21:43:23 +0800 Subject: [PATCH] feat: receive primary container name in K8SPod Signed-off-by: machichima --- flyteplugins/go/tasks/plugins/k8s/spark/spark.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/k8s/spark/spark.go b/flyteplugins/go/tasks/plugins/k8s/spark/spark.go index 40204526b5..dba91f0620 100644 --- a/flyteplugins/go/tasks/plugins/k8s/spark/spark.go +++ b/flyteplugins/go/tasks/plugins/k8s/spark/spark.go @@ -208,11 +208,9 @@ func createDriverSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCont "Unable to unmarshal driver pod spec [%v], Err: [%v]", driverPod.GetPodSpec(), err.Error()) } - if len(customPodSpec.Containers) != 0 { - // As only the container with the name of primary container set in driver pod will be passed into - // here, we can directly take the container name here as the primaryContainerName - primaryContainerName = customPodSpec.Containers[0].Name - } + if driverPod.GetPrimaryContainerName() != "" { + primaryContainerName = driverPod.PrimaryContainerName + } podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "") if err != nil { @@ -261,11 +259,9 @@ func createExecutorSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCo "Unable to unmarshal executor pod spec [%v], Err: [%v]", executorPod.GetPodSpec(), err.Error()) } - if len(customPodSpec.Containers) != 0 { - // As only the container with the name of primary container set in executor pod will be passed into - // here, we can directly take the container name here as the primaryContainerName - primaryContainerName = customPodSpec.Containers[0].Name - } + if executorPod.GetPrimaryContainerName() != "" { + primaryContainerName = executorPod.PrimaryContainerName + } podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "") if err != nil {