diff --git a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go index 63d0971cac..4a8c0f50f9 100644 --- a/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go +++ b/flyteplugins/go/tasks/pluginmachinery/flytek8s/pod_helper.go @@ -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 } else { diff --git a/flyteplugins/go/tasks/plugins/k8s/spark/spark.go b/flyteplugins/go/tasks/plugins/k8s/spark/spark.go index d39bf27dc8..08d6b27cf5 100644 --- a/flyteplugins/go/tasks/plugins/k8s/spark/spark.go +++ b/flyteplugins/go/tasks/plugins/k8s/spark/spark.go @@ -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()) } } @@ -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()) } podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "") @@ -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()) } podSpec, err = flytek8s.MergePodSpecs(podSpec, customPodSpec, primaryContainerName, "") @@ -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, diff --git a/flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go b/flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go index ef45203b13..ed361374e6 100644 --- a/flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go +++ b/flyteplugins/go/tasks/plugins/k8s/spark/spark_test.go @@ -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"