[Twisted-Python] [ANN] txkube 0.1.0
Hello all, I'm pleased to announce the first release of txkube, a Twisted-based library for interacting with Kubernetes using the HTTP API. This release supports several of the most commonly used basic Kubernetes objects, including Services, ConfigMaps, Deployments, ReplicaSets, and Pods. While Kubernetes has many, many more object kinds, this collection of kinds already supports a very useful set of interactions. Here is an example of txkube usage, taken from the README: from __future__ import print_function from twisted.internet.task import react from txkube import v1, network_kubernetes_from_context @react def main(reactor): k8s = network_kubernetes_from_context(reactor, u"minikube") client = k8s.client() d = client.list(v1.Namespace) d.addCallback(print) return d You can download txkube from PyPI https://pypi.python.org/pypi. You can contribute to its development on GitHub https://github.com/LeastAuthority/txkube. Thanks to Least Authority Enterprises https://leastauthority.com/ for sponsoring this development. Jean-Paul Calderone http://as.ynchrono.us/
On Apr 10, 2017, at 11:11 AM, Jean-Paul Calderone
wrote: Hello all,
I'm pleased to announce the first release of txkube, a Twisted-based library for interacting with Kubernetes using the HTTP API.
✨³✨🎉
This release supports several of the most commonly used basic Kubernetes objects, including Services, ConfigMaps, Deployments, ReplicaSets, and Pods. While Kubernetes has many, many more object kinds, this collection of kinds already supports a very useful set of interactions.
Thanks for the announcement! I do have one question about txkube, since this comes up periodically in every higher-level networking layer, and it's a place where I think Twisted has some advantages over other HTTP clients: is there a way to specify custom trust roots, or construct a custom Agent to pass in to txkube?
Here is an example of txkube usage, taken from the README:
from __future__ import print_function from twisted.internet.task import react
from txkube import v1, network_kubernetes_from_context
@react
btw, don't think I didn't notice this https://github.com/twisted/twisted/pull/646#discussion_r96104930...
def main(reactor): k8s = network_kubernetes_from_context(reactor, u"minikube") client = k8s.client() d = client.list(v1.Namespace) d.addCallback(print) return d
You can download txkube from PyPI https://pypi.python.org/pypi. You can contribute to its development on GitHub https://github.com/LeastAuthority/txkube.
Thanks to Least Authority Enterprises https://leastauthority.com/ for sponsoring this development.
Thanks, LAE! -glyph
On Tue, Apr 11, 2017 at 1:15 AM, Glyph Lefkowitz
On Apr 10, 2017, at 11:11 AM, Jean-Paul Calderone < exarkun@twistedmatrix.com> wrote:
Hello all,
I'm pleased to announce the first release of txkube, a Twisted-based library for interacting with Kubernetes using the HTTP API.
✨³✨🎉
This release supports several of the most commonly used basic Kubernetes objects, including Services, ConfigMaps, Deployments, ReplicaSets, and Pods. While Kubernetes has many, many more object kinds, this collection of kinds already supports a very useful set of interactions.
Thanks for the announcement!
I do have one question about txkube, since this comes up periodically in every higher-level networking layer, and it's a place where I think Twisted has some advantages over other HTTP clients: is there a way to specify custom trust roots, or construct a custom Agent to pass in to txkube?
There's another constructor for IKubernetesService https://github.com/LeastAuthority/txkube/blob/b2e81400e40989696f82cabfd575d5..., network_kubernetes https://github.com/LeastAuthority/txkube/blob/b2e81400e40989696f82cabfd575d5.... It takes an IAgent. So one can do: network_kubernetes(base_url=url, agent=Agent(contextFactory=...)) Does that approach fit with any emerging conventions for exposing this kind of functionality? I'd be happy to adapt it if there's a better pattern. Also note that it's common for Kubernetes to be deployed with a self-signed or other non-cartel certificate. So even the API in the example, network_kubernetes_from_context, doesn't trust the usual web-oriented collection of CAs. It only respects the certificate found in the local Kubernetes configuration. This means that there's another way to control this - edit ~/.kube/config and put the desired CA certificate there.
Here is an example of txkube usage, taken from the README:
from __future__ import print_function from twisted.internet.task import react
from txkube import v1, network_kubernetes_from_context
@react
btw, don't think I didn't notice this https://github.com/twisted/twisted/pull/646#discussion_r96104930...
😂 Jean-Paul
def main(reactor): k8s = network_kubernetes_from_context(reactor, u"minikube") client = k8s.client() d = client.list(v1.Namespace) d.addCallback(print) return d
You can download txkube from PyPI https://pypi.python.org/pypi. You can contribute to its development on GitHub https://github.com/LeastAuthority/txkube.
Thanks to Least Authority Enterprises https://leastauthority.com/ for sponsoring this development.
Thanks, LAE!
-glyph
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Apr 11, 2017, at 4:14 AM, Jean-Paul Calderone
wrote: On Tue, Apr 11, 2017 at 1:15 AM, Glyph Lefkowitz
mailto:glyph@twistedmatrix.com> wrote: On Apr 10, 2017, at 11:11 AM, Jean-Paul Calderone
mailto:exarkun@twistedmatrix.com> wrote: Hello all,
I'm pleased to announce the first release of txkube, a Twisted-based library for interacting with Kubernetes using the HTTP API.
✨³✨🎉
This release supports several of the most commonly used basic Kubernetes objects, including Services, ConfigMaps, Deployments, ReplicaSets, and Pods. While Kubernetes has many, many more object kinds, this collection of kinds already supports a very useful set of interactions.
Thanks for the announcement!
I do have one question about txkube, since this comes up periodically in every higher-level networking layer, and it's a place where I think Twisted has some advantages over other HTTP clients: is there a way to specify custom trust roots, or construct a custom Agent to pass in to txkube?
There's another constructor for IKubernetesService https://github.com/LeastAuthority/txkube/blob/b2e81400e40989696f82cabfd575d5..., network_kubernetes https://github.com/LeastAuthority/txkube/blob/b2e81400e40989696f82cabfd575d5.... It takes an IAgent. So one can do:
network_kubernetes(base_url=url, agent=Agent(contextFactory=...))
Does that approach fit with any emerging conventions for exposing this kind of functionality? I'd be happy to adapt it if there's a better pattern.
I think that's the state of the art, and it's a good primitive to build upon. If something needs to change, it's not the way txkube (et. al.) accept their argument, but rather a function in Twisted somewhere that computes the Towers of Hanoi Agent-stacking solution that Treq contains: https://github.com/twisted/treq/blob/b436c6c89b3a1b7fb2ecb5300ae24bcbea20fad...
Also note that it's common for Kubernetes to be deployed with a self-signed or other non-cartel certificate. So even the API in the example, network_kubernetes_from_context, doesn't trust the usual web-oriented collection of CAs. It only respects the certificate found in the local Kubernetes configuration. This means that there's another way to control this - edit ~/.kube/config and put the desired CA certificate there.
Cool. Although this is actually exactly what I'd expect (as I would imagine most Kubernetes users) this behavior sounds like something that might be worth calling out in the README.
Here is an example of txkube usage, taken from the README:
from __future__ import print_function from twisted.internet.task import react
from txkube import v1, network_kubernetes_from_context
@react
btw, don't think I didn't notice this https://github.com/twisted/twisted/pull/646#discussion_r96104930...
😂
Jean-Paul
def main(reactor): k8s = network_kubernetes_from_context(reactor, u"minikube") client = k8s.client() d = client.list(v1.Namespace) d.addCallback(print) return d
You can download txkube from PyPI https://pypi.python.org/pypi. You can contribute to its development on GitHub https://github.com/LeastAuthority/txkube.
Thanks to Least Authority Enterprises https://leastauthority.com/ for sponsoring this development.
Thanks, LAE!
-glyph
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com mailto:Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com mailto:Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
Glyph Lefkowitz
-
Jean-Paul Calderone