Support multiple instances of operator in the same cluster

Signed-off-by: Chaoran Yu <yuchaoran2011@gmail.com>
This commit is contained in:
Chaoran Yu
2018-12-10 11:00:05 +08:00
parent 184f5f21c9
commit 565879616b
5 changed files with 12 additions and 35 deletions
-1
View File
@@ -26,7 +26,6 @@ The following table lists the configurable parameters of the Spark operator char
| `operatorImageName` | The name of the operator image | `gcr.io/spark-operator/spark-operator` |
| `operatorVersion` | The version of the operator to install | `v2.3.1-v1alpha1-latest` |
| `sparkJobNamespace` | K8s namespace where Spark jobs are to be deployed. | `default` |
| `createSparkJobNamespace` | Whether to create the Spark job namespace | false |
| `enableWebhook` | Whether to enable mutating admission webhook | true |
| `enableMetrics` | Whether to expose metrics to be scraped by Premetheus | true |
@@ -1,11 +0,0 @@
{{ if .Values.createSparkJobNamespace }}
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.sparkJobNamespace }}
labels:
app.kubernetes.io/name: {{ include "sparkoperator.name" . }}
helm.sh/chart: {{ include "sparkoperator.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ end }}
@@ -56,26 +56,16 @@ spec:
- containerPort: 10254
{{ end }}
command: ["/usr/bin/spark-operator"]
{{- if and (.Values.enableMetrics) (.Values.enableWebhook) }}
args:
- -logtostderr
- -namespace={{ .Values.sparkJobNamespace }}
{{- if .Values.enableMetrics }}
- -enable-metrics=true
- -metrics-labels=app_type
{{- end }}
{{- if .Values.enableWebhook }}
- -enable-webhook=true
- -webhook-svc-namespace={{ .Release.Namespace }}
- -webhook-svc-name={{ include "sparkoperator.fullname" . }}-webhook
- -logtostderr
{{- else if (.Values.enableMetrics) }}
args:
- -enable-metrics=true
- -metrics-labels=app_type
- -logtostderr
{{- else if (.Values.enableWebhook) }}
args:
- -enable-webhook=true
- -webhook-svc-namespace={{ .Release.Namespace }}
- -webhook-svc-name={{ include "sparkoperator.fullname" . }}-webhook
- -logtostderr
{{- else }}
args:
- -logtostderr
- -webhook-config-name={{ include "sparkoperator.fullname" . }}-webhook-config
{{- end }}
@@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: sparkoperator-cr
name: {{ include "sparkoperator.fullname" . }}-cr
labels:
app.kubernetes.io/name: {{ include "sparkoperator.name" . }}
helm.sh/chart: {{ include "sparkoperator.chart" . }}
@@ -34,7 +34,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sparkoperator-crb
name: {{ include "sparkoperator.fullname" . }}-crb
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "sparkoperator.name" . }}
@@ -47,6 +47,6 @@ subjects:
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: sparkoperator-cr
name: {{ include "sparkoperator.fullname" . }}-cr
apiGroup: rbac.authorization.k8s.io
{{- end }}
+3 -4
View File
@@ -1,6 +1,5 @@
operatorImageName: gcr.io/spark-operator/spark-operator
operatorVersion: v2.4.0-v1alpha1-latest
sparkJobNamespace: default
operatorImageName: lightbend/sparkoperator
operatorVersion: test
imagePullPolicy: IfNotPresent
@@ -15,7 +14,7 @@ serviceAccounts:
create: true
name:
createSparkJobNamespace: false
sparkJobNamespace: default
enableWebhook: true
enableMetrics: true