kubernetes-client: PersistentVolumeClaimExample : don't work

there is few errors in PersistentVolumeClaimExample.

line 81 and 83 you have that this :

client.persistentVolumes().create(pv);

client.persistentVolumes().create(pv);

it will failed because the pv already exists.

and in the finally block

you should have this :

finally {
        client.persistentVolumeClaims().withName("test-pv-claim").delete();
        client.persistentVolumes().withName("test-local-pv").delete(); //fixed the name
        client.pods().withName("test-pv-pod").delete(); // you forgot to remove the pod
        client.storage().storageClasses().withName("my-local-storage").delete(); // forgot to remove it
      }

instead of :

finally {
        client.persistentVolumeClaims().withName("test-pv-claim").delete();
        client.persistentVolumes().withName("test-pv").delete(); // don't exist in this example
      }

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (27 by maintainers)

Most upvoted comments

I think this issue is same as #2070