mirror of https://github.com/k3s-io/k3s
Merge pull request #37678 from tsmetana/issue_37377
Automatic merge from submit-queue (batch tested with PRs 37608, 37103, 37320, 37607, 37678) Fix issue #37377: Report an event on successful PVC provisioning This is a simple patch to fix the issue #37377: On a successful PVC provisioning an event is emitted so it's clear the provisioning actually succeeded. cc: @jsafranepull/6/head
commit
6fd00e9f56
|
@ -113,7 +113,7 @@ func TestProvisionSync(t *testing.T) {
|
||||||
newClaimArray("claim11-1", "uid11-1", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation),
|
newClaimArray("claim11-1", "uid11-1", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation),
|
||||||
// Binding will be completed in the next syncClaim
|
// Binding will be completed in the next syncClaim
|
||||||
newClaimArray("claim11-1", "uid11-1", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation, annStorageProvisioner),
|
newClaimArray("claim11-1", "uid11-1", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation, annStorageProvisioner),
|
||||||
noevents, noerrors, wrapTestWithProvisionCalls([]provisionCall{provision1Success}, testSyncClaim),
|
[]string{"Normal ProvisioningSucceeded"}, noerrors, wrapTestWithProvisionCalls([]provisionCall{provision1Success}, testSyncClaim),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Provision failure - plugin not found
|
// Provision failure - plugin not found
|
||||||
|
@ -185,7 +185,7 @@ func TestProvisionSync(t *testing.T) {
|
||||||
newClaimArray("claim11-8", "uid11-8", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation),
|
newClaimArray("claim11-8", "uid11-8", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation),
|
||||||
// Binding will be completed in the next syncClaim
|
// Binding will be completed in the next syncClaim
|
||||||
newClaimArray("claim11-8", "uid11-8", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation, annStorageProvisioner),
|
newClaimArray("claim11-8", "uid11-8", "1Gi", "", v1.ClaimPending, storageutil.StorageClassAnnotation, annStorageProvisioner),
|
||||||
noevents,
|
[]string{"Normal ProvisioningSucceeded"},
|
||||||
[]reactorError{
|
[]reactorError{
|
||||||
// Inject error to the first
|
// Inject error to the first
|
||||||
// kubeclient.PersistentVolumes.Create() call. All other calls
|
// kubeclient.PersistentVolumes.Create() call. All other calls
|
||||||
|
@ -306,7 +306,7 @@ func TestProvisionSync(t *testing.T) {
|
||||||
claimWithClass("silver", newClaimArray("claim11-13", "uid11-13", "1Gi", "", v1.ClaimPending)),
|
claimWithClass("silver", newClaimArray("claim11-13", "uid11-13", "1Gi", "", v1.ClaimPending)),
|
||||||
// Binding will be completed in the next syncClaim
|
// Binding will be completed in the next syncClaim
|
||||||
claimWithClass("silver", newClaimArray("claim11-13", "uid11-13", "1Gi", "", v1.ClaimPending, annStorageProvisioner)),
|
claimWithClass("silver", newClaimArray("claim11-13", "uid11-13", "1Gi", "", v1.ClaimPending, annStorageProvisioner)),
|
||||||
noevents, noerrors, wrapTestWithProvisionCalls([]provisionCall{provision2Success}, testSyncClaim),
|
[]string{"Normal ProvisioningSucceeded"}, noerrors, wrapTestWithProvisionCalls([]provisionCall{provision2Success}, testSyncClaim),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Provision error - non existing class
|
// Provision error - non existing class
|
||||||
|
|
|
@ -1382,6 +1382,8 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interfa
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.V(2).Infof("volume %q provisioned for claim %q", volume.Name, claimToClaimKey(claim))
|
glog.V(2).Infof("volume %q provisioned for claim %q", volume.Name, claimToClaimKey(claim))
|
||||||
|
msg := fmt.Sprintf("Successfully provisioned volume %s using %s", volume.Name, plugin.GetPluginName())
|
||||||
|
ctrl.eventRecorder.Event(claim, v1.EventTypeNormal, "ProvisioningSucceeded", msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue