SHARE
TWEET

Untitled

a guest Apr 21st, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. from kubernetes import client, config, watch
  3.  
  4.  
  5. def main():
  6.     # Configs can be set in Configuration class directly or using helper
  7.     # utility. If no argument provided, the config will be loaded from
  8.     # default location.
  9.     config.load_kube_config()
  10.  
  11.     v1 = client.CoreV1Api()
  12.     count = 10
  13.     w = watch.Watch()
  14.     for event in w.stream(v1.list_namespace, timeout_seconds=10):
  15.         print("Event: %s %s" % (event['type'], event['object'].metadata.name))
  16.         count -= 1
  17.         if not count:
  18.             w.stop()
  19.  
  20.     print("Ended.")
  21.  
  22.  
  23. if __name__ == '__main__':
  24.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top