Skip to content

Commit

Permalink
Update for RoleSpec
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Dye <[email protected]>
  • Loading branch information
andrewwdye committed Oct 8, 2023
1 parent 583808b commit ad57897
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (sparkResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsCo
serviceAccountName = sparkTaskType
}

tolerations, err := getTolerations(sparkJob.GetDriverPod().GetPodSpec())
tolerations, err := getTolerations(sparkJob.GetDriverSpec().GetPod().GetPodSpec())
if err != nil {
return nil, err
}

Check warning on line 116 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#L115-L116

Added lines #L115 - L116 were not covered by tests
Expand All @@ -131,7 +131,7 @@ func (sparkResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsCo
ServiceAccount: &serviceAccountName,
}

tolerations, err = getTolerations(sparkJob.GetExecutorPod().GetPodSpec())
tolerations, err = getTolerations(sparkJob.GetExecutorSpec().GetPod().GetPodSpec())
if err != nil {
return nil, err
}

Check warning on line 137 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#L136-L137

Added lines #L136 - L137 were not covered by tests
Expand Down
16 changes: 10 additions & 6 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,11 @@ func TestBuildResourcePodTemplate(t *testing.T) {
driverPodSpecPb := structpb.Struct{}
err = utils.MarshalStruct(&podSpec, &driverPodSpecPb)
assert.NoError(t, err)
sparkJob.DriverPodValue = &plugins.SparkJob_DriverPod{
DriverPod: &core.K8SPod{
PodSpec: &driverPodSpecPb,
sparkJob.DriverSpec = &plugins.RoleSpec{
PodValue: &plugins.RoleSpec_Pod{
Pod: &core.K8SPod{
PodSpec: &driverPodSpecPb,
},
},
}
extraExecutorToleration := corev1.Toleration{
Expand All @@ -719,9 +721,11 @@ func TestBuildResourcePodTemplate(t *testing.T) {
execPodSpecPb := structpb.Struct{}
err = utils.MarshalStruct(&podSpec, &execPodSpecPb)
assert.NoError(t, err)
sparkJob.ExecutorPodValue = &plugins.SparkJob_ExecutorPod{
ExecutorPod: &core.K8SPod{
PodSpec: &execPodSpecPb,
sparkJob.ExecutorSpec = &plugins.RoleSpec{
PodValue: &plugins.RoleSpec_Pod{
Pod: &core.K8SPod{
PodSpec: &execPodSpecPb,
},
},
}
taskTemplate := dummySparkTaskTemplate("blah-1", sparkJob)
Expand Down

0 comments on commit ad57897

Please sign in to comment.