Make the README example code more portable
Also, the `$HOME` variable can be modified while `os.path.expanduser()` does the right thing. This works on windows as well whereas the previous code did not.
This commit is contained in:
parent
ff9295b967
commit
9850b70283
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user