Skip to content

Commit

Permalink
fix: fix lint issue
Browse files Browse the repository at this point in the history
Signed-off-by: machichima <[email protected]>
  • Loading branch information
machichima committed Dec 21, 2024
1 parent b7daee1 commit 70cfdff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func BuildRawPod(ctx context.Context, tCtx pluginsCore.TaskExecutionContext) (*v

// If primaryContainerName is set in taskTemplate config, use it instead
// of c.Name
if val, ok := taskTemplate.Config[PrimaryContainerKey]; ok {
if val, ok := taskTemplate.GetConfig()[PrimaryContainerKey]; ok {
primaryContainerName = val
c.Name = primaryContainerName

Check warning on line 287 in flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go

View check run for this annotation

Codecov / codecov/patch

flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go#L286-L287

Added lines #L286 - L287 were not covered by tests
} else {
Expand Down
18 changes: 9 additions & 9 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ func createSparkPodSpec(
config.GetK8sPluginConfig().DefaultLabels,
pluginsUtils.CopyMap(taskCtx.TaskExecutionMetadata().GetLabels()),
)
if k8sPod != nil && k8sPod.Metadata != nil {
if k8sPod != nil && k8sPod.GetMetadata() != nil {
if k8sPod.Metadata.Annotations != nil {
annotations = pluginsUtils.UnionMaps(annotations, k8sPod.Metadata.Annotations)
annotations = pluginsUtils.UnionMaps(annotations, k8sPod.GetMetadata().GetAnnotations())
}
if k8sPod.Metadata.Labels != nil {
labels = pluginsUtils.UnionMaps(labels, k8sPod.Metadata.Labels)
labels = pluginsUtils.UnionMaps(labels, k8sPod.GetMetadata().GetLabels())
}
}

Expand Down Expand Up @@ -204,10 +204,10 @@ func createDriverSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCont
if driverPod != nil {
var customPodSpec *v1.PodSpec

err = utils.UnmarshalStructToObj(driverPod.PodSpec, &customPodSpec)
err = utils.UnmarshalStructToObj(driverPod.GetPodSpec(), &customPodSpec)
if err != nil {
return nil, errors.Errorf(errors.BadTaskSpecification,
"Unable to unmarshal pod spec [%v], Err: [%v]", driverPod.PodSpec, err.Error())
"Unable to unmarshal pod spec [%v], Err: [%v]", driverPod.GetPodSpec(), err.Error())
}

Check warning on line 211 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#L209-L211

Added lines #L209 - L211 were not covered by tests

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
Expand Down Expand Up @@ -247,14 +247,14 @@ func createExecutorSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCo
return nil, err
}

executorPod := sparkJob.ExecutorPod
executorPod := sparkJob.GetExecutorPod()
if executorPod != nil {
var customPodSpec *v1.PodSpec

err = utils.UnmarshalStructToObj(executorPod.PodSpec, &customPodSpec)
err = utils.UnmarshalStructToObj(executorPod.GetPodSpec(), &customPodSpec)
if err != nil {
return nil, errors.Errorf(errors.BadTaskSpecification,
"Unable to unmarshal pod spec [%v], Err: [%v]", executorPod.PodSpec, err.Error())
"Unable to unmarshal pod spec [%v], Err: [%v]", executorPod.GetPodSpec(), err.Error())
}

Check warning on line 258 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#L256-L258

Added lines #L256 - L258 were not covered by tests

podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "")
Expand All @@ -267,7 +267,7 @@ func createExecutorSpec(ctx context.Context, taskCtx pluginsCore.TaskExecutionCo
if err != nil {
return nil, err
}
sparkPodSpec := createSparkPodSpec(taskCtx, podSpec, primaryContainer, sparkJob.ExecutorPod)
sparkPodSpec := createSparkPodSpec(taskCtx, podSpec, primaryContainer, sparkJob.GetExecutorPod())
serviceAccountName := serviceAccountName(taskCtx.TaskExecutionMetadata())
spec := executorSpec{
primaryContainer,
Expand Down
2 changes: 0 additions & 2 deletions flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (

sj "github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1beta2"
sparkOp "github.com/GoogleCloudPlatform/spark-on-k8s-operator/pkg/apis/sparkoperator.k8s.io/v1beta2"
// NOTE: this import also use things inside google.golang structpb one
// structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"google.golang.org/protobuf/types/known/structpb"
Expand Down

0 comments on commit 70cfdff

Please sign in to comment.