From bc8f8a2fdd63a3b0ab95d34e67404d6c94bc2942 Mon Sep 17 00:00:00 2001 From: Andrei Neagoe Date: Mon, 16 May 2022 17:26:56 +0200 Subject: [PATCH] Fixes https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/issues/1467 (issue when deleting SparkApplication without metrics server) (#1530) --- charts/spark-operator-chart/Chart.yaml | 4 ++-- pkg/controller/sparkapplication/controller.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/charts/spark-operator-chart/Chart.yaml b/charts/spark-operator-chart/Chart.yaml index 53bbadd1b..b305847f6 100644 --- a/charts/spark-operator-chart/Chart.yaml +++ b/charts/spark-operator-chart/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: spark-operator description: A Helm chart for Spark on Kubernetes operator -version: 1.1.21 -appVersion: v1beta2-1.3.5-3.1.1 +version: 1.1.22 +appVersion: v1beta2-1.3.6-3.1.1 keywords: - spark home: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator diff --git a/pkg/controller/sparkapplication/controller.go b/pkg/controller/sparkapplication/controller.go index 4740fd31a..024882f03 100644 --- a/pkg/controller/sparkapplication/controller.go +++ b/pkg/controller/sparkapplication/controller.go @@ -446,7 +446,9 @@ func (c *Controller) getAndUpdateAppState(app *v1beta2.SparkApplication) error { } func (c *Controller) handleSparkApplicationDeletion(app *v1beta2.SparkApplication) { - c.metrics.exportMetricsOnDelete(app) + if c.metrics != nil { + c.metrics.exportMetricsOnDelete(app) + } // SparkApplication deletion requested, lets delete driver pod. if err := c.deleteSparkResources(app); err != nil { glog.Errorf("failed to delete resources associated with deleted SparkApplication %s/%s: %v", app.Namespace, app.Name, err)