From 3e56c17d86bdb6f67ac06cd5db605a7c1391d552 Mon Sep 17 00:00:00 2001 From: yanghua Date: Mon, 27 Feb 2023 16:49:37 +0800 Subject: [PATCH] [Addon #603] Add Apache Spark as a experimental addon Signed-off-by: yanghua --- .../spark-kubernetes-operator/template.cue | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/experimental/addons/spark-kubernetes-operator/template.cue b/experimental/addons/spark-kubernetes-operator/template.cue index 69823f82a..5493a5b94 100644 --- a/experimental/addons/spark-kubernetes-operator/template.cue +++ b/experimental/addons/spark-kubernetes-operator/template.cue @@ -4,7 +4,7 @@ output: { kind: "Application" spec: { components: [ - { + { type: "k8s-objects" name: "spark-operator-ns" properties: objects: [{ @@ -13,6 +13,23 @@ output: { metadata: name: parameter.namespace }] }, + { + type: "k8s-objects" + name: "spark-cluster-ns" + properties: objects: [{ + apiVersion: "v1" + kind: "Namespace" + metadata: name: "spark-cluster" + }, + { + apiVersion: "v1" + kind: "ServiceAccount" + metadata: { + name: "spark" + namespace: "spark-cluster" + } + }】 + }, { name: "spark-operator-helm" type: "helm" @@ -52,12 +69,33 @@ output: { ] policies: [ { - name: "gc-dependency", - type: "garbage-collect", - properties: { - order: "dependency" - } + name: "gc-dependency", + type: "garbage-collect", + properties: { + order: "dependency" + } } + { + type: "shared-resource" + name: "shared-resource-via-namespace" + properties: rules: [{ + selector: resourceTypes: ["Namespace"] + }] + } + { + type: "topology" + name: "deploy-operator" + properties: { + namespace: parameter.namespace + if parameter.clusters != _|_ { + clusters: parameter.clusters + } + + if parameter.clusters == _|_ { + clusterLabelSelector: {} + } + } + } ] } }