Skip to content

Commit

Permalink
fix TestGetPVCInfo failure (#4850)
Browse files Browse the repository at this point in the history
  • Loading branch information
SupriyaKasten authored and Ilya Kislenko committed Jan 30, 2019
1 parent c379c15 commit 6a5195a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions pkg/function/create_volume_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,18 @@ func getPVCInfo(ctx context.Context, kubeCli kubernetes.Interface, namespace str
if err != nil {
return nil, err
}

if pvZone, ok := pvLabels[kube.PVZoneLabelName]; ok {
config[awsebs.ConfigRegion] = region
config[awsebs.AccessKeyID] = tp.Profile.Credential.KeyPair.ID
config[awsebs.SecretAccessKey] = tp.Profile.Credential.KeyPair.Secret
provider, err = getter.Get(blockstorage.TypeEBS, config)
if err != nil {
return nil, errors.Wrap(err, "Could not get storage provider")
}
return &volumeInfo{provider: provider, volumeID: filepath.Base(ebs.VolumeID), sType: blockstorage.TypeEBS, volZone: pvZone, pvc: name, size: size, region: region}, nil
}
if pvZone, ok := pvLabels[kube.PVZoneLabelName]; ok {
config[awsebs.ConfigRegion] = region
config[awsebs.AccessKeyID] = tp.Profile.Credential.KeyPair.ID
config[awsebs.SecretAccessKey] = tp.Profile.Credential.KeyPair.Secret
provider, err = getter.Get(blockstorage.TypeEBS, config)
if err != nil {
return nil, errors.Wrap(err, "Could not get storage provider")
}
return nil, errors.Errorf("PV zone label is empty, pvName: %s, namespace: %s", pvName, namespace)
return &volumeInfo{provider: provider, volumeID: filepath.Base(ebs.VolumeID), sType: blockstorage.TypeEBS, volZone: pvZone, pvc: name, size: size, region: region}, nil
}
return nil, errors.Errorf("PV zone label is empty, pvName: %s, namespace: %s", pvName, namespace)

case pv.Spec.GCEPersistentDisk != nil:
gpd := pv.Spec.GCEPersistentDisk
Expand Down

0 comments on commit 6a5195a

Please sign in to comment.