Skip to content

Commit 699d71c

Browse files
committed
Make example code using config.load_kube_config() more portable
1 parent 9850b70 commit 699d71c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

examples/example1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
v1 = client.CoreV1Api()
2626
print("Listing pods with their IPs:")

examples/example2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
v1 = client.CoreV1Api()
2626
count = 10

examples/example3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def main():
2121
# Configs can be set in Configuration class directly or using helper
2222
# utility
23-
config.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
config.load_kube_config(os.path.join(os.path.expanduser('~'), '.kube', 'config')
2424

2525
print("Supported APIs (* is preferred version):")
2626
print("%-20s %s" %

0 commit comments

Comments
 (0)