Skip to content

Commit

Permalink
pvc_annotator: remove already being provisioned check
Browse files Browse the repository at this point in the history
  • Loading branch information
chaireze committed Jul 12, 2023
1 parent ba0a18e commit 1ce30ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
4 changes: 0 additions & 4 deletions pkg/blob/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe

err = annotator.SendProvisionVolume(pv, d.cloud.Config.AzureAuthConfig, providedAuth)
if err != nil {
if err == cv.ErrVolumeAlreadyBeingProvisioned {
return &csi.NodeStageVolumeResponse{}, nil
}

return nil, err
}

Expand Down
14 changes: 1 addition & 13 deletions pkg/edgecache/cachevolume/pvc_annotator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package cachevolume

import (
"errors"
"fmt"

"golang.org/x/exp/maps"
Expand All @@ -42,8 +41,7 @@ const (
)

var (
validStorageAuthentications = []string{"WorkloadIdentity", "AccountKey"}
ErrVolumeAlreadyBeingProvisioned = errors.New("pv is already being provisioned")
validStorageAuthentications = []string{"WorkloadIdentity", "AccountKey"}
)

type BlobAuth struct {
Expand Down Expand Up @@ -135,22 +133,12 @@ func (c *PVCAnnotator) buildAnnotations(pv *v1.PersistentVolume, cfg config.Azur
}

func (c *PVCAnnotator) SendProvisionVolume(pv *v1.PersistentVolume, cloudConfig config.AzureAuthConfig, providedAuth BlobAuth) error {
pvc, err := blobcsiutil.GetPVCByName(c.client, pv.Spec.ClaimRef.Name, pv.Spec.ClaimRef.Namespace)
if err != nil {
return err
}

if valid := c.requestAuthIsValid(providedAuth.authType); !valid {
err := fmt.Errorf("requested storage auth %s is not a member of valid auths %+v", providedAuth.authType, validStorageAuthentications)
klog.Error(err)
return err
}

if prepare := c.needsToBeProvisioned(pvc); !prepare {
klog.Info("pv is already being provisioned")
return ErrVolumeAlreadyBeingProvisioned
}

annotations, err := c.buildAnnotations(pv, cloudConfig, providedAuth)
if err != nil {
return err
Expand Down

0 comments on commit 1ce30ad

Please sign in to comment.