Skip to content

Commit cfb1345

Browse files
authored
Merge pull request #40 from mtougeron/fix-attribute-path
Fix the path to the VolumeHandle field
2 parents c54c9bc + 7bb4406 commit cfb1345

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

kubernetes.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const (
5050
regexpAWSVolumeID = `^aws:\/\/\w{2}-\w{4,9}-\d\w\/(vol-\w+)$`
5151
)
5252

53-
func buildClient(kubeconfig string, kubeContext string) (*kubernetes.Clientset, error) {
53+
func BuildClient(kubeconfig string, kubeContext string) (*kubernetes.Clientset, error) {
5454
config, err := rest.InClusterConfig()
5555
if err != nil {
5656
if kubeconfig == "" {
@@ -258,7 +258,7 @@ func processPersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim) (string, ma
258258
log.Errorf("cannot get volume.beta.kubernetes.io/storage-provisioner annotation")
259259
return "", nil, errors.New("cannot get volume.beta.kubernetes.io/storage-provisioner annotation")
260260
} else if provisionedBy == "ebs.csi.aws.com" {
261-
volumeID = pv.Spec.CSI.VolumeHandle
261+
volumeID = pv.Spec.PersistentVolumeSource.CSI.VolumeHandle
262262
} else if provisionedBy == "kubernetes.io/aws-ebs" {
263263
volumeID = parseAWSVolumeID(pv.Spec.PersistentVolumeSource.AWSElasticBlockStore.VolumeID)
264264
}

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func main() {
161161
os.Exit(1)
162162
}
163163

164-
k8sClient, err = buildClient(kubeconfig, kubeContext)
164+
k8sClient, err = BuildClient(kubeconfig, kubeContext)
165165
if err != nil {
166166
log.Fatalln("Unable to create kubernetes client", err)
167167
os.Exit(1)

0 commit comments

Comments
 (0)