Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocean Spark cluster spark config #226

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/service/ocean/spark/cluster/create/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ func main() {
2000,
}),
},
Spark: &spark.SparkConfig{
AppNamespaces: spotinst.StringSlice([]string{
"spark-apps",
"spark-apps-extra-ns-1",
"spark-apps-extra-ns-2",
}),
},
},
},
})
Expand Down
7 changes: 7 additions & 0 deletions examples/service/ocean/spark/cluster/update/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ func main() {
2000,
}),
},
Spark: &spark.SparkConfig{
AppNamespaces: spotinst.StringSlice([]string{
"spark-apps",
"spark-apps-extra-ns-1",
"spark-apps-extra-ns-2",
}),
},
},
},
})
Expand Down
32 changes: 32 additions & 0 deletions service/ocean/spark/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Config struct {
Webhook *WebhookConfig `json:"webhook,omitempty"`
Compute *ComputeConfig `json:"compute,omitempty"`
LogCollection *LogCollectionConfig `json:"logCollection,omitempty"`
Spark *SparkConfig `json:"spark,omitempty"`

forceSendFields []string
nullFields []string
Expand Down Expand Up @@ -58,6 +59,13 @@ type WebhookConfig struct {
nullFields []string
}

type SparkConfig struct {
AppNamespaces []*string `json:"appNamespaces,omitempty"`

forceSendFields []string
nullFields []string
}

type IngressConfig struct {
// Deprecated: Use LoadBalancer.ServiceAnnotations instead.
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
Expand Down Expand Up @@ -205,6 +213,13 @@ func (c *Config) SetLogCollection(v *LogCollectionConfig) *Config {
return c
}

func (c *Config) SetSpark(v *SparkConfig) *Config {
if c.Spark = v; c.Spark == nil {
c.nullFields = append(c.nullFields, "Spark")
}
return c
}

// endregion

// region Ingress
Expand Down Expand Up @@ -419,3 +434,20 @@ func (l *LogCollectionConfig) SetCollectDriverLogs(v *bool) *LogCollectionConfig
}

// endregion

// region Spark

func (s SparkConfig) MarshalJSON() ([]byte, error) {
type noMethod SparkConfig
raw := noMethod(s)
return jsonutil.MarshalJSON(raw, s.forceSendFields, s.nullFields)
}

func (s *SparkConfig) SetAppNamespaces(v []*string) *SparkConfig {
if s.AppNamespaces = v; s.AppNamespaces == nil {
s.nullFields = append(s.nullFields, "AppNamespaces")
}
return s
}

// endregion