Skip to content

Commit

Permalink
[build][feat] add event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongpiger committed Jul 1, 2024
1 parent 89820cc commit e8c46b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package driver
import (
lctx "context"
lerr "errors"
lfmt "fmt"
lstrconv "strconv"
lstr "strings"
ltime "time"
Expand Down Expand Up @@ -211,13 +212,15 @@ func (s *controllerService) CreateVolume(pctx lctx.Context, preq *lcsi.CreateVol
cvr = cvr.WithEncrypted(pvc.GetCsiEncryptedAnnotation())
}

resp, sdkErr := s.cloud.EitherCreateResizeVolume(cvr.ToSdkCreateVolumeRequest())
newVol, sdkErr := s.cloud.EitherCreateResizeVolume(cvr.ToSdkCreateVolumeRequest())
if sdkErr != nil {
llog.ErrorS(sdkErr.GetError(), "[ERROR] - CreateVolume: failed to create volume", sdkErr.GetErrorMessages())
return nil, sdkErr.GetError()
}

return newCreateVolumeResponse(resp, cvr, respCtx), nil
s.k8sClient.PersistentVolumeClaimEventNormal(pctx, cvr.PvcNamespaceTag, cvr.PvcNameTag,
"CsiCreateVolumeSuccess", lfmt.Sprintf("Volume created successfully with ID %s for PVC %s", newVol.Id, newVol.Name))
return newCreateVolumeResponse(newVol, cvr, respCtx), nil
}

func (s *controllerService) DeleteVolume(_ lctx.Context, preq *lcsi.DeleteVolumeRequest) (*lcsi.DeleteVolumeResponse, error) {
Expand Down

0 comments on commit e8c46b1

Please sign in to comment.