From ca532c6fb2c08f859eca13e0557f3b2aec9a18e0 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 11 Dec 2019 21:51:03 -0500 Subject: [PATCH] Ensure that error is returned on NodePublish --- pkg/kubelet/volumemanager/cache/actual_state_of_world.go | 3 ++- pkg/volume/csi/csi_client.go | 2 +- pkg/volume/util/types/types.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/kubelet/volumemanager/cache/actual_state_of_world.go b/pkg/kubelet/volumemanager/cache/actual_state_of_world.go index 6ebd6b78e2d..c5d84ee3cde 100644 --- a/pkg/kubelet/volumemanager/cache/actual_state_of_world.go +++ b/pkg/kubelet/volumemanager/cache/actual_state_of_world.go @@ -24,7 +24,7 @@ import ( "fmt" "sync" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog" @@ -490,6 +490,7 @@ func (asw *actualStateOfWorld) AddPodToVolume(markVolumeOpts operationexecutor.M // If pod exists, reset remountRequired value podObj.remountRequired = false + podObj.volumeMountStateForPod = markVolumeOpts.VolumeMountState asw.attachedVolumes[volumeName].mountedPods[podName] = podObj return nil } diff --git a/pkg/volume/csi/csi_client.go b/pkg/volume/csi/csi_client.go index 9da810cd3c0..1dce2eccc4c 100644 --- a/pkg/volume/csi/csi_client.go +++ b/pkg/volume/csi/csi_client.go @@ -262,7 +262,7 @@ func (c *csiDriverClient) NodePublishVolume( if err != nil && !isFinalError(err) { return volumetypes.NewUncertainProgressError(err.Error()) } - return nil + return err } func (c *csiDriverClient) NodeExpandVolume(ctx context.Context, volumeID, volumePath string, newSize resource.Quantity) (resource.Quantity, error) { diff --git a/pkg/volume/util/types/types.go b/pkg/volume/util/types/types.go index 199365c3520..1a34a7d3153 100644 --- a/pkg/volume/util/types/types.go +++ b/pkg/volume/util/types/types.go @@ -82,7 +82,7 @@ func NewUncertainProgressError(msg string) *UncertainProgressError { } // IsOperationFinishedError checks if given error is of type that indicates -// operation is finished with an error. +// operation is finished with a FINAL error. func IsOperationFinishedError(err error) bool { if _, ok := err.(*UncertainProgressError); ok { return false