[Twisted-Python] [ANN] txkube 0.1.0
Jean-Paul Calderone
exarkun at twistedmatrix.com
Tue Apr 11 05:14:27 MDT 2017
On Tue, Apr 11, 2017 at 1:15 AM, Glyph Lefkowitz <glyph at twistedmatrix.com>
wrote:
>
> On Apr 10, 2017, at 11:11 AM, Jean-Paul Calderone <
> exarkun at 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/b2e81400e40989696f82cabfd575d5283f7180e8/src/txkube/_interface.py>,
network_kubernetes
<https://github.com/LeastAuthority/txkube/blob/b2e81400e40989696f82cabfd575d5283f7180e8/src/txkube/_network.py#L41-L56>.
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 at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20170411/05ff22f5/attachment-0002.html>
More information about the Twisted-Python
mailing list