mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Chart for Spark operator (#6239)
* Chart for Spark operator Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added maintainer Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added appVersion Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Forced the label and image tag to be the same Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Updated with option to enable webhooks. Removed initializers Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Fixed kubeVersion so that it works with GKE Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Removed extra linebreak Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Addressed review comments Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Removed licensing headers. Fixed README default Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Automated creation of webhook secret as a Job Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added support for exposing metrics for Prometheus Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added a Limitations section in README Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Consolidated YAMLs; supporting both metrics and webhook enabled Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added a post-delete hook, obviating the need for manual namespace deletion Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Added hook delete policy to auto-delete hook when done Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Updated default namespace Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Updated default namespace in the doc to match what's in the yaml Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Changed job name to improve clarity Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Now using post-install hook to initialize secrets Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com> * Updated comments Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
name: sparkoperator
|
||||
description: A Helm chart for Spark on Kubernetes operator
|
||||
version: 0.1.0
|
||||
appVersion: latest
|
||||
kubeVersion: ">=1.8.0-0"
|
||||
keywords:
|
||||
- spark
|
||||
home: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator
|
||||
maintainers:
|
||||
- name: yuchaoran2011
|
||||
email: yuchaoran2011@gmail.com
|
||||
@@ -0,0 +1,33 @@
|
||||
### Helm Chart for Spark Operator
|
||||
|
||||
This is the Helm chart for the [Spark-on-Kubernetes Operator](https://github.com/GoogleCloudPlatform/spark-on-k8s-operator).
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
The Operator requires Kubernetes version 1.8 and above because it relies on garbage collection of custom resources. If customization of driver and executor pods (through mounting custom configMaps and volumes) is desired, then the [Mutating Admission Webhook](https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/master/docs/quick-start-guide.md#using-the-mutating-admission-webhook) needs to be enabled and it only became beta in Kubernetes 1.9.
|
||||
|
||||
#### Installing the chart
|
||||
|
||||
The chart can be installed by running:
|
||||
|
||||
```bash
|
||||
$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
|
||||
$ helm install incubator/sparkoperator
|
||||
```
|
||||
|
||||
By default, the operator is installed in a namespace called "spark-operator". It would be created if it does not exist.
|
||||
|
||||
#### Configuration
|
||||
|
||||
The following table lists the configurable parameters of the Spark operator chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
| ------------------- | ----------------------------------------------------- | ------------------------- |
|
||||
| `operatorImageName` | The name of the operator image | `lightbend/sparkoperator` |
|
||||
| `operatorVersion` | The version of the operator to install | `2.3.1` |
|
||||
| `operatorNamespace` | K8s namespace where operator is installed | `spark-operator` |
|
||||
| `enableWebhook` | Whether to enable mutating admission webhook | true |
|
||||
| `enableMetrics` | Whether to expose metrics to be scraped by Premetheus | true |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: sparkoperator
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["services", "configmaps", "secrets"]
|
||||
verbs: ["create", "get", "delete"]
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get"]
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["create", "update", "patch"]
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["create", "get", "update", "delete"]
|
||||
- apiGroups: ["admissionregistration.k8s.io"]
|
||||
resources: ["mutatingwebhookconfigurations"]
|
||||
verbs: ["create", "get", "update", "delete"]
|
||||
- apiGroups: ["sparkoperator.k8s.io"]
|
||||
resources: ["sparkapplications", "scheduledsparkapplications"]
|
||||
verbs: ["*"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: sparkoperator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: sparkoperator
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: sparkoperator
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,143 @@
|
||||
# If the admission webhook is enabled, then a post-install step is required
|
||||
# to generate and install the secret in the operator namespace.
|
||||
|
||||
# In the post-install hook, the token corresponding to the operator service account
|
||||
# is used to authenticate with the Kubernetes API server to install the secret bundle.
|
||||
|
||||
{{ if .Values.enableWebhook }}
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .Values.operatorNamespace }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: sparkoperator
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: sparkoperator-init
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": post-install
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
labels:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
spec:
|
||||
serviceAccountName: sparkoperator
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: main
|
||||
image: {{ .Values.operatorImageName }}:{{ .Values.operatorVersion }}
|
||||
imagePullPolicy: Always
|
||||
command: ["/usr/bin/gencerts.sh", "-n", "{{ .Values.operatorNamespace }}", "-p"]
|
||||
{{ else }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .Values.operatorNamespace }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: sparkoperator
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
{{ end }}
|
||||
---
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sparkoperator
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.enableMetrics }}
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "10254"
|
||||
prometheus.io/path: "/metrics"
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
initializers:
|
||||
pending: []
|
||||
spec:
|
||||
serviceAccountName: sparkoperator
|
||||
{{- if .Values.enableWebhook }}
|
||||
volumes:
|
||||
- name: webhook-certs
|
||||
secret:
|
||||
secretName: spark-webhook-certs
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: sparkoperator
|
||||
image: {{ .Values.operatorImageName }}:{{ .Values.operatorVersion }}
|
||||
imagePullPolicy: Always
|
||||
{{- if .Values.enableWebhook }}
|
||||
volumeMounts:
|
||||
- name: webhook-certs
|
||||
mountPath: /etc/webhook-certs
|
||||
{{- end }}
|
||||
{{- if .Values.enableMetrics }}
|
||||
ports:
|
||||
- containerPort: 10254
|
||||
{{ end }}
|
||||
command: ["/usr/bin/spark-operator"]
|
||||
{{- if and (.Values.enableMetrics) (.Values.enableWebhook) }}
|
||||
args:
|
||||
- -enable-metrics=true
|
||||
- -metrics-labels=app_type
|
||||
- -enable-webhook=true
|
||||
- -logtostderr
|
||||
{{- else if (.Values.enableMetrics) }}
|
||||
args:
|
||||
- -enable-metrics=true
|
||||
- -metrics-labels=app_type
|
||||
- -logtostderr
|
||||
{{- else if (.Values.enableWebhook) }}
|
||||
args:
|
||||
- -enable-webhook=true
|
||||
- -logtostderr
|
||||
{{- else }}
|
||||
args:
|
||||
- -logtostderr
|
||||
{{- end }}
|
||||
---
|
||||
{{ if .Values.enableWebhook }}
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: spark-webhook
|
||||
namespace: {{ .Values.operatorNamespace }}
|
||||
spec:
|
||||
ports:
|
||||
- port: 443
|
||||
targetPort: 8080
|
||||
name: webhook
|
||||
selector:
|
||||
app.kubernetes.io/name: sparkoperator
|
||||
app.kubernetes.io/version: {{ .Values.operatorVersion }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,38 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: spark
|
||||
namespace: default
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: Role
|
||||
metadata:
|
||||
namespace: default
|
||||
name: spark-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "" # "" indicates the core API group
|
||||
resources:
|
||||
- "pods"
|
||||
verbs:
|
||||
- "*"
|
||||
- apiGroups:
|
||||
- "" # "" indicates the core API group
|
||||
resources:
|
||||
- "services"
|
||||
verbs:
|
||||
- "*"
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: spark-role-binding
|
||||
namespace: default
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: spark
|
||||
namespace: default
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: spark-role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,6 @@
|
||||
operatorImageName: lightbend/sparkoperator
|
||||
operatorVersion: 2.3.1
|
||||
operatorNamespace: spark-operator
|
||||
|
||||
enableWebhook: true
|
||||
enableMetrics: true
|
||||
Reference in New Issue
Block a user