Created
October 12, 2017 06:19
-
-
Save fleeto/10bda96d2a0e1d3325d40996c29ddc19 to your computer and use it in GitHub Desktop.
GlusterFS as default storage class of Kubernetes, Usage: pvc2gluster.py [pvc name]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import subprocess | |
import sys | |
pvc_json = subprocess.check_output( | |
["kubectl", "get", "pvc", sys.argv[1], "-o", "json", "--all-namespaces"]) | |
pvc_obj = json.loads(pvc_json) | |
pv_name = pvc_obj["spec"]["volumeName"] | |
pv_json = subprocess.check_output( | |
["kubectl", "get", "pv", pv_name, "-o", "json"]) | |
pv_obj = json.loads(pv_json) | |
gluster_name = pv_obj["spec"]["glusterfs"]["path"] | |
print gluster_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment