File tree Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import os
16
16
17
- import k8sclient
18
- import k8sutil
17
+ from kubernetes import client , util
19
18
20
19
21
20
def main ():
22
21
# Configs can be set in Configuration class directly or using helper
23
22
# utility
24
- k8sutil .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
23
+ util .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
25
24
26
- v1 = k8sclient .CoreV1Api ()
25
+ v1 = client .CoreV1Api ()
27
26
print ("Listing pods with their IPs:" )
28
27
ret = v1 .list_pod_for_all_namespaces (watch = False )
29
28
for i in ret .items :
Original file line number Diff line number Diff line change 14
14
15
15
import os
16
16
17
- import k8sclient
18
- import k8sutil
17
+ from kubernetes import client , util
19
18
20
19
21
20
def main ():
22
21
# Configs can be set in Configuration class directly or using helper
23
22
# utility
24
- k8sutil .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
23
+ util .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
25
24
26
- v1 = k8sclient .CoreV1Api ()
25
+ v1 = client .CoreV1Api ()
27
26
count = 10
28
- watch = k8sutil .Watch ()
27
+ watch = util .Watch ()
29
28
for event in watch .stream (v1 .list_namespace , timeout_seconds = 10 ):
30
29
print ("Event: %s %s" % (event ['type' ], event ['object' ].metadata .name ))
31
30
count -= 1
Original file line number Diff line number Diff line change 14
14
15
15
import os
16
16
17
- import k8sclient
18
- import k8sutil
17
+ from kubernetes import client , util
19
18
20
19
21
20
def main ():
22
21
# Configs can be set in Configuration class directly or using helper
23
22
# utility
24
- k8sutil .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
23
+ util .load_kube_config (os .environ ["HOME" ] + '/.kube/config' )
25
24
26
25
print ("Supported APIs (* is preferred version):" )
27
26
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 :
30
29
versions = []
31
30
for v in api .versions :
32
31
name = ""
You can’t perform that action at this time.
0 commit comments