diff --git a/cmd/install/example.go b/cmd/install/example.go index 4e910b9..c407d0f 100644 --- a/cmd/install/example.go +++ b/cmd/install/example.go @@ -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" ) @@ -58,6 +59,7 @@ func init() { inflate.NewApp, kube_ops_view.NewApp, podinfo.NewApp, + sparkpi.NewApp, wordpress.NewApp, } } diff --git a/pkg/application/example/sparkpi/manifest.go b/pkg/application/example/sparkpi/manifest.go new file mode 100644 index 0000000..fe73a9e --- /dev/null +++ b/pkg/application/example/sparkpi/manifest.go @@ -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 +` diff --git a/pkg/application/example/sparkpi/spark_pi.go b/pkg/application/example/sparkpi/spark_pi.go new file mode 100644 index 0000000..6691667 --- /dev/null +++ b/pkg/application/example/sparkpi/spark_pi.go @@ -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", + }, + } +}