Skip to content

Commit

Permalink
feat: receive primary container name in K8SPod
Browse files Browse the repository at this point in the history
Signed-off-by: machichima <[email protected]>
  • Loading branch information
machichima committed Feb 5, 2025
1 parent 167c1e6 commit fee3114
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Check warning on line 209 in flyteplugins/go/tasks/plugins/k8s/spark/spark.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/plugins/k8s/spark/spark.go#L207-L209

Added lines #L207 - L209 were not covered by tests

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
}

Check warning on line 213 in flyteplugins/go/tasks/plugins/k8s/spark/spark.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/plugins/k8s/spark/spark.go#L212-L213

Added lines #L212 - L213 were not covered by tests

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
if err != nil {
Expand Down Expand Up @@ -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())
}

Check warning on line 260 in flyteplugins/go/tasks/plugins/k8s/spark/spark.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/plugins/k8s/spark/spark.go#L258-L260

Added lines #L258 - L260 were not covered by tests

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
}

Check warning on line 264 in flyteplugins/go/tasks/plugins/k8s/spark/spark.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/plugins/k8s/spark/spark.go#L263-L264

Added lines #L263 - L264 were not covered by tests

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
if err != nil {
Expand Down

0 comments on commit fee3114

Please sign in to comment.