The kube package has some niceties around interacting with Kubernetes as a more powerful alternative to the controller-runtime clients.
- Operational fetching of kubernetes objects via generics rather than having to initialize objects independently
- A server-side apply wrapper of
client.Clientfor consistency - Various "Waiter" routines that allow you to apply some object and then wait for a condition to become true (very useful in tests)
- Port-forwarding and Exec implementations to ease forwarding into pod ports and execing commands on them programmatically
- A Dialer implementation that leverages Kubernetes lookups based on quasi-service/pod-based hostnames and can port-forward into a pod from a local network (useful for tests where needing to do validations against listeners running inside pods, also heavily leveraged in the operator tests)
- An environment variable expander that allows us to mimic the expansion behavior into environment variables based on Secret or ConfigMap values from a pod's
EnvFromdefinitions - Wrappers arounds encoding/decoding YAML similar to how
kubectlallows for framed manifest deserialization intoclient.Objects - A "Syncer" that server-side applies an arbitrary group of
client.Objectvalues and tracks when they should be GC'd because a subsequent render causes them to become no longer needed.