Merge pull request #43852 from ailusazh/AddSuccessfulMountVolumeMsgToEvent

Automatic merge from submit-queue

Add SuccessfulMountVolume message to the events of pod

**What this PR does / why we need it:**
When creating a pod with volume, the volume mount may failed at first, but eventually succeed after retry several times. kubectl describe pod can only see the failed messages, so i think it will be better to add the SuccessfulMountVolume message to the pod events too.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
Fixes #42867
This commit is contained in:
Kubernetes Submit Queue 2017-06-05 01:46:36 -07:00 committed by GitHub
commit 974606544d

View File

@ -465,11 +465,14 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
return detailedErr
}
simpleMsg, detailedMsg := volumeToMount.GenerateMsg("MountVolume.SetUp succeeded", "")
verbosity := glog.Level(1)
if isRemount {
verbosity = glog.Level(7)
} else {
og.recorder.Eventf(volumeToMount.Pod, v1.EventTypeNormal, kevents.SuccessfulMountVolume, simpleMsg)
}
glog.V(verbosity).Infof(volumeToMount.GenerateMsgDetailed("MountVolume.SetUp succeeded", ""))
glog.V(verbosity).Infof(detailedMsg)
// Update actual state of world
markVolMountedErr := actualStateOfWorld.MarkVolumeAsMounted(