From c7778bb5ba306c3acbeeae42413376c0c3ae799a Mon Sep 17 00:00:00 2001 From: cliveseldon Date: Thu, 10 Oct 2019 21:21:03 +0100 Subject: [PATCH] fix podinfo volume mount check --- .../api/v1alpha2/seldondeployment_webhook.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/operator/api/v1alpha2/seldondeployment_webhook.go b/operator/api/v1alpha2/seldondeployment_webhook.go index f2ee52d03e..f616cb2a59 100644 --- a/operator/api/v1alpha2/seldondeployment_webhook.go +++ b/operator/api/v1alpha2/seldondeployment_webhook.go @@ -275,10 +275,19 @@ func (r *SeldonDeployment) DefaultSeldonDeployment() { portNum = existingPort.ContainerPort } - con.VolumeMounts = append(con.VolumeMounts, corev1.VolumeMount{ - Name: PODINFO_VOLUME_NAME, - MountPath: PODINFO_VOLUME_PATH, - }) + //downward api used to make pod info available to container + volMount := false + for _, vol := range con.VolumeMounts { + if vol.Name == PODINFO_VOLUME_NAME { + volMount = true + } + } + if !volMount { + con.VolumeMounts = append(con.VolumeMounts, corev1.VolumeMount{ + Name: PODINFO_VOLUME_NAME, + MountPath: PODINFO_VOLUME_PATH, + }) + } } // Set ports and hostname in predictive unit so engine can read it from SDep // if this is the firstPuPortNum then we've not added engine yet so put the engine in here