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

add: install example-spark-pi #228

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions cmd/install/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/awslabs/eksdemo/pkg/application/example/inflate"
"github.com/awslabs/eksdemo/pkg/application/example/kube_ops_view"
"github.com/awslabs/eksdemo/pkg/application/example/podinfo"
"github.com/awslabs/eksdemo/pkg/application/example/sparkpi"
"github.com/awslabs/eksdemo/pkg/application/example/wordpress"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -58,6 +59,7 @@ func init() {
inflate.NewApp,
kube_ops_view.NewApp,
podinfo.NewApp,
sparkpi.NewApp,
wordpress.NewApp,
}
}
32 changes: 32 additions & 0 deletions pkg/application/example/sparkpi/manifest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package sparkpi

// https://github.com/kubeflow/spark-operator/blob/master/examples/spark-pi.yaml
const manifestTemplate = `---
apiVersion: sparkoperator.k8s.io/v1beta2
kind: SparkApplication
metadata:
name: spark-pi
namespace: {{ .Namespace }}
spec:
type: Scala
mode: cluster
image: spark:3.5.0
imagePullPolicy: IfNotPresent
mainClass: org.apache.spark.examples.SparkPi
mainApplicationFile: local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar
sparkVersion: 3.5.0
driver:
labels:
version: 3.5.0
cores: 1
coreLimit: 1200m
memory: 512m
serviceAccount: {{ .ServiceAccount }}
executor:
labels:
version: 3.5.0
instances: 1
cores: 1
coreLimit: 1200m
memory: 512m
`
34 changes: 34 additions & 0 deletions pkg/application/example/sparkpi/spark_pi.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package sparkpi

import (
"github.com/awslabs/eksdemo/pkg/application"
"github.com/awslabs/eksdemo/pkg/cmd"
"github.com/awslabs/eksdemo/pkg/installer"
"github.com/awslabs/eksdemo/pkg/template"
)

// GitHub: https://github.com/kubeflow/spark-operator/blob/master/examples/

func NewApp() *application.Application {
return &application.Application{
Command: cmd.Command{
Parent: "example",
Name: "spark-pi",
Description: "Apache Spark SparkPi Example",
Aliases: []string{"spark"},
},

Installer: &installer.ManifestInstaller{
AppName: "example-spark-pi",
ResourceTemplate: &template.TextTemplate{
Template: manifestTemplate,
},
},

Options: &application.ApplicationOptions{
Namespace: "default",
DisableVersionFlag: true,
ServiceAccount: "spark-operator-spark",
},
}
}