Skip to content

Commit

Permalink
fix: based on suggested change
Browse files Browse the repository at this point in the history
Signed-off-by: machichima <[email protected]>
  • Loading branch information
machichima committed Dec 28, 2024
1 parent 70cfdff commit 48902c9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,11 @@ func createSparkPodSpec(
config.GetK8sPluginConfig().DefaultLabels,
pluginsUtils.CopyMap(taskCtx.TaskExecutionMetadata().GetLabels()),
)
if k8sPod != nil && k8sPod.GetMetadata() != nil {
if k8sPod.Metadata.Annotations != nil {
annotations = pluginsUtils.UnionMaps(annotations, k8sPod.GetMetadata().GetAnnotations())
}
if k8sPod.Metadata.Labels != nil {
labels = pluginsUtils.UnionMaps(labels, k8sPod.GetMetadata().GetLabels())
}
if k8sPod.GetMetadata().GetAnnotations() != nil {
annotations = pluginsUtils.UnionMaps(annotations, k8sPod.GetMetadata().GetAnnotations())
}
if k8sPod.GetMetadata().GetLabels() != nil {
labels = pluginsUtils.UnionMaps(labels, k8sPod.GetMetadata().GetLabels())
}

sparkEnv := make([]v1.EnvVar, 0)
Expand Down Expand Up @@ -207,7 +205,7 @@ func createDriverSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCont
err = utils.UnmarshalStructToObj(driverPod.GetPodSpec(), &customPodSpec)
if err != nil {
return nil, errors.Errorf(errors.BadTaskSpecification,
"Unable to unmarshal pod spec [%v], Err: [%v]", driverPod.GetPodSpec(), err.Error())
"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

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
Expand Down Expand Up @@ -254,7 +252,7 @@ func createExecutorSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCo
err = utils.UnmarshalStructToObj(executorPod.GetPodSpec(), &customPodSpec)
if err != nil {
return nil, errors.Errorf(errors.BadTaskSpecification,
"Unable to unmarshal pod spec [%v], Err: [%v]", executorPod.GetPodSpec(), err.Error())
"Unable to unmarshal executor pod spec [%v], Err: [%v]", executorPod.GetPodSpec(), err.Error())
}

Check warning on line 256 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#L254-L256

Added lines #L254 - L256 were not covered by tests

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
Expand Down

0 comments on commit 48902c9

Please sign in to comment.