The calls: create, get, delete, list and watch, for Pods, Services and Jobs in a namespace, and a pod's log.
var k = Client(Config.load())
_ = k.create(PODS, '{"apiVersion": "v1", "kind": "Pod", ...}')
var pod = k.get(PODS, "smoke") # None if there's none
var w = k.watch(PODS, "app=smoke")
while True:
var e = w.next() # None once the watch ends
if not e or e.value().object.at("/status/phase").string_value() == "Succeeded":
break
_ = k.delete_all(PODS, "app=smoke")
Objects go in as JSON text and come back as json's Value, so a caller
writes the manifests it needs and reads the fields it needs (at takes a
JSON pointer), and this tin knows no schema. An answer that isn't 2xx
raises Error("k8s: <METHOD> <path>: <code> <reason>: <message>") with the
API's own Status message, except a 404 from get and delete, which
answer None and False.
A watch is one long response of JSON lines, one event each (ADDED,
MODIFIED, DELETED, ERROR), which Watch.next reads as they arrive.
The server ends it after timeout_seconds; to see every change, list
first and watch from the list's resource_version, and on a watch that
ended, watch again from the last event's. A 410 (the version is too old)
raises; list again.