From 6dc603239ad4d05b5aebee53dc908d560e18241b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Eckerstr=C3=B6m?= Date: Fri, 22 Dec 2017 21:34:37 +0100 Subject: [PATCH] Switched to environment variable arguments (#3118) * Switched to environment variable arguments Environment variables are evaluated before command-line arguments causing parsing of SPARK_MASTER_PORT to crash if left to the default value set by kubernetes. * Fixed lint errors: missing starting space in comment --- stable/spark/Chart.yaml | 2 +- stable/spark/templates/spark-master-deployment.yaml | 8 +++++++- stable/spark/templates/spark-worker-deployment.yaml | 4 +++- stable/spark/values.yaml | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/stable/spark/Chart.yaml b/stable/spark/Chart.yaml index 9728fce36f..d91b550eec 100755 --- a/stable/spark/Chart.yaml +++ b/stable/spark/Chart.yaml @@ -1,5 +1,5 @@ name: spark -version: 0.1.4 +version: 0.1.5 description: Fast and general-purpose cluster computing system. home: http://spark.apache.org icon: http://spark.apache.org/images/spark-logo-trademark.png diff --git a/stable/spark/templates/spark-master-deployment.yaml b/stable/spark/templates/spark-master-deployment.yaml index d96c4db5a4..05c4b0c714 100644 --- a/stable/spark/templates/spark-master-deployment.yaml +++ b/stable/spark/templates/spark-master-deployment.yaml @@ -59,7 +59,7 @@ spec: - name: {{ template "master-fullname" . }} image: "{{ .Values.Master.Image }}:{{ .Values.Master.ImageTag }}" command: ["/bin/sh","-c"] - args: ["echo $(hostname -i) {{ template "master-fullname" . }} >> /etc/hosts; /opt/spark/bin/spark-class org.apache.spark.deploy.master.Master --ip {{ template "master-fullname" . }} --port {{ .Values.Master.ServicePort }} --webui-port {{ .Values.WebUi.ContainerPort }}"] + args: ["echo $(hostname -i) {{ template "master-fullname" . }} >> /etc/hosts; /opt/spark/bin/spark-class org.apache.spark.deploy.master.Master"] ports: - containerPort: {{ .Values.Master.ContainerPort }} - containerPort: {{ .Values.WebUi.ContainerPort }} @@ -70,3 +70,9 @@ spec: env: - name: SPARK_DAEMON_MEMORY value: {{ default "1g" .Values.Master.DaemonMemory | quote }} + - name: SPARK_MASTER_HOST + value: {{ template "master-fullname" . }} + - name: SPARK_MASTER_PORT + value: {{ .Values.Master.ServicePort | quote }} + - name: SPARK_MASTER_WEBUI_PORT + value: {{ .Values.WebUi.ContainerPort | quote }} diff --git a/stable/spark/templates/spark-worker-deployment.yaml b/stable/spark/templates/spark-worker-deployment.yaml index 0cd6689c57..436d3a5915 100644 --- a/stable/spark/templates/spark-worker-deployment.yaml +++ b/stable/spark/templates/spark-worker-deployment.yaml @@ -25,7 +25,7 @@ spec: containers: - name: {{ template "worker-fullname" . }} image: "{{ .Values.Worker.Image }}:{{ .Values.Worker.ImageTag }}" - command: ["/opt/spark/bin/spark-class", "org.apache.spark.deploy.worker.Worker", "spark://{{ template "master-fullname" . }}:{{ .Values.Master.ServicePort }}", "--webui-port", "{{ .Values.Worker.ContainerPort }}"] + command: ["/opt/spark/bin/spark-class", "org.apache.spark.deploy.worker.Worker", "spark://{{ template "master-fullname" . }}:{{ .Values.Master.ServicePort }}"] ports: - containerPort: {{ .Values.Worker.ContainerPort }} resources: @@ -37,3 +37,5 @@ spec: value: {{ default "1g" .Values.Worker.DaemonMemory | quote }} - name: SPARK_WORKER_MEMORY value: {{ default "1g" .Values.Worker.ExecutorMemory | quote }} + - name: SPARK_WORKER_WEBUI_PORT + value: {{ .Values.WebUi.ContainerPort | quote }} diff --git a/stable/spark/values.yaml b/stable/spark/values.yaml index 7672e4bd5c..d733c14180 100644 --- a/stable/spark/values.yaml +++ b/stable/spark/values.yaml @@ -14,7 +14,7 @@ Master: ServicePort: 7077 ContainerPort: 7077 # Set Master JVM memory. Default 1g - #DaemonMemory: 1g + # DaemonMemory: 1g WebUi: Name: webui @@ -31,9 +31,9 @@ Worker: Memory: "512Mi" ContainerPort: 8081 # Set Worker JVM memory. Default 1g - #DaemonMemory: 1g + # DaemonMemory: 1g # Set how much total memory workers have to give executors - #ExecutorMemory: 1g + # ExecutorMemory: 1g Zeppelin: Name: zeppelin