Skip to content

Commit

Permalink
add: install example-spark-pi (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroniscode authored Sep 3, 2024
1 parent a55367b commit 5d813ea
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
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",
},
}
}

0 comments on commit 5d813ea

Please sign in to comment.