Merge pull request #51 from SEJeff/patch-1

Make the README example code more portable
This commit is contained in:
mbohlool 2016-12-01 01:14:16 -08:00 committed by GitHub
commit 738dcde51c
4 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ import os
from kubernetes import client, config
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1=client.CoreV1Api()
print("Listing pods with their IPs:")
@ -48,7 +48,7 @@ import os
from kubernetes import client, config, watch
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1 = client.CoreV1Api()
count = 10

View File

@ -20,7 +20,7 @@ from kubernetes import client, config
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1 = client.CoreV1Api()
print("Listing pods with their IPs:")

View File

@ -20,7 +20,7 @@ from kubernetes import client, config, watch
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
v1 = client.CoreV1Api()
count = 10

View File

@ -20,7 +20,7 @@ from kubernetes import client, config
def main():
# Configs can be set in Configuration class directly or using helper
# utility
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
print("Supported APIs (* is preferred version):")
print("%-20s %s" %