Skip to content

Commit cafbdf0

Browse files
committed
Update examples
1 parent b715e99 commit cafbdf0

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

examples/example1.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414

1515
import os
1616

17-
import k8sclient
18-
import k8sutil
17+
from kubernetes import client, util
1918

2019

2120
def main():
2221
# Configs can be set in Configuration class directly or using helper
2322
# utility
24-
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
2524

26-
v1 = k8sclient.CoreV1Api()
25+
v1 = client.CoreV1Api()
2726
print("Listing pods with their IPs:")
2827
ret = v1.list_pod_for_all_namespaces(watch=False)
2928
for i in ret.items:

examples/example2.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414

1515
import os
1616

17-
import k8sclient
18-
import k8sutil
17+
from kubernetes import client, util
1918

2019

2120
def main():
2221
# Configs can be set in Configuration class directly or using helper
2322
# utility
24-
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
2524

26-
v1 = k8sclient.CoreV1Api()
25+
v1 = client.CoreV1Api()
2726
count = 10
28-
watch = k8sutil.Watch()
27+
watch = util.Watch()
2928
for event in watch.stream(v1.list_namespace, timeout_seconds=10):
3029
print("Event: %s %s" % (event['type'], event['object'].metadata.name))
3130
count -= 1

examples/example3.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,18 @@
1414

1515
import os
1616

17-
import k8sclient
18-
import k8sutil
17+
from kubernetes import client, util
1918

2019

2120
def main():
2221
# Configs can be set in Configuration class directly or using helper
2322
# utility
24-
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
23+
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
2524

2625
print("Supported APIs (* is preferred version):")
2726
print("%-20s %s" %
28-
("core", ",".join(k8sclient.CoreApi().get_api_versions().versions)))
29-
for api in k8sclient.ApisApi().get_api_versions().groups:
27+
("core", ",".join(client.CoreApi().get_api_versions().versions)))
28+
for api in client.ApisApi().get_api_versions().groups:
3029
versions = []
3130
for v in api.versions:
3231
name = ""

0 commit comments

Comments
 (0)