Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Anmol Khurana committed Sep 4, 2020
1 parent 637137f commit 4186122
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions go/tasks/plugins/k8s/spark/spark.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Config struct {
Features []Feature `json:"features" pflag:",List of optional features supported."`
}

// Optional feature with name and corresponding spark-config to use.
type Feature struct {
Name string `json:"name"`
SparkConfig map[string]string `json:"spark-config"`
Expand Down Expand Up @@ -201,22 +202,24 @@ func (sparkResourceHandler) BuildResource(ctx context.Context, taskCtx pluginsCo

func addConfig(sparkConfig map[string]string, key string, value string) {

if strings.TrimSpace(value) != "true" {
if strings.ToLower(strings.TrimSpace(value)) != "true" {
return
}

matches := featureRegex.FindAllStringSubmatch(key, -1)
if len(matches) == 0 {
if len(matches) == 0 || len(matches[0]) == 0 {
return
}
featureName := matches[0][len(matches[0])-1]

// Use the first matching feature in-case of duplicates.
for _, feature := range GetSparkConfig().Features {
if feature.Name == featureName {
for k, v := range feature.SparkConfig {
sparkConfig[k] = v
}
break
}

}
}

Expand Down

0 comments on commit 4186122

Please sign in to comment.