Update examples
This commit is contained in:
parent
b715e998b0
commit
cafbdf0dee
@ -14,16 +14,15 @@
|
||||
|
||||
import os
|
||||
|
||||
import k8sclient
|
||||
import k8sutil
|
||||
from kubernetes import client, util
|
||||
|
||||
|
||||
def main():
|
||||
# Configs can be set in Configuration class directly or using helper
|
||||
# utility
|
||||
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
|
||||
v1 = k8sclient.CoreV1Api()
|
||||
v1 = client.CoreV1Api()
|
||||
print("Listing pods with their IPs:")
|
||||
ret = v1.list_pod_for_all_namespaces(watch=False)
|
||||
for i in ret.items:
|
||||
|
||||
@ -14,18 +14,17 @@
|
||||
|
||||
import os
|
||||
|
||||
import k8sclient
|
||||
import k8sutil
|
||||
from kubernetes import client, util
|
||||
|
||||
|
||||
def main():
|
||||
# Configs can be set in Configuration class directly or using helper
|
||||
# utility
|
||||
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
|
||||
v1 = k8sclient.CoreV1Api()
|
||||
v1 = client.CoreV1Api()
|
||||
count = 10
|
||||
watch = k8sutil.Watch()
|
||||
watch = util.Watch()
|
||||
for event in watch.stream(v1.list_namespace, timeout_seconds=10):
|
||||
print("Event: %s %s" % (event['type'], event['object'].metadata.name))
|
||||
count -= 1
|
||||
|
||||
@ -14,19 +14,18 @@
|
||||
|
||||
import os
|
||||
|
||||
import k8sclient
|
||||
import k8sutil
|
||||
from kubernetes import client, util
|
||||
|
||||
|
||||
def main():
|
||||
# Configs can be set in Configuration class directly or using helper
|
||||
# utility
|
||||
k8sutil.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
util.load_kube_config(os.environ["HOME"] + '/.kube/config')
|
||||
|
||||
print("Supported APIs (* is preferred version):")
|
||||
print("%-20s %s" %
|
||||
("core", ",".join(k8sclient.CoreApi().get_api_versions().versions)))
|
||||
for api in k8sclient.ApisApi().get_api_versions().groups:
|
||||
("core", ",".join(client.CoreApi().get_api_versions().versions)))
|
||||
for api in client.ApisApi().get_api_versions().groups:
|
||||
versions = []
|
||||
for v in api.versions:
|
||||
name = ""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user