Skip to content

Kubernetes Python Client done Async Twisted Style

License

Notifications You must be signed in to change notification settings

JessicaGreben/txk8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

txk8s

A Twisted implementation of Kubernetes

Example program: save and retrieve a secret in the default namespace

import base64

from twisted.internet import defer, task

import txk8s


@defer.inlineCallbacks
def main(reactor):
    txcli = txk8s.TxKubernetesClient()

    # let's create and store a secret
    sec_b64 = base64.b64encode("oh this should definitely not be hardcoded")
    meta = txcli.V1ObjectMeta(name='mysecret')
    body = txcli.V1Secret(data={'myuser': sec_b64}, metadata=meta)

    res = yield txcli.call(txcli.coreV1.create_namespaced_secret, 'default', body)
    print 'Create and store: %r: %r\n' % (res.metadata.self_link, res.data)

    # now let's get the same secret back out
    retrieved_secret = yield txcli.call(txcli.coreV1.read_namespaced_secret, 'mysecret', 'default')
    print 'Retrieve:', retrieved_secret.data

    defer.returnValue(retrieved_secret)


task.react(main)

Please see top-level doc/ dir for more information

For maintainers: How to build

  1. Increment __version__ in _version.py.
  2. Update the Change Log below.
  3. Run the following:
python setup.py sdist bdist_wheel
twine upload dist/*<version>*

Change Log

[0.1.4] - 2018-01-15

Fixed

  • No longer output errors to stdout (#7)

0.1.2 - 2018-01-04

Changed

  • tests fixed from lambdification

0.1.1 - 2017-12-28

Added

  • doc/ dir and first doc on module!

Changed

  • Removed a response parameter to many funcs & converted to lambda function

0.1.0 - 2017-12-27

Changed

  • Version incremented to 0.1.0 and is no longer pre-alpha!!
  • Fixed version import in init

Older - 2017-12-27

Added

  • v1
  • Example usage for secret creation/retrieval
  • Coverage report for tox tests
  • Test fixtures from previous internal project
  • Project code reviewed for first public release!

Changed

  • Loosened requirements for dependencies in setup AND requirements
  • Fixed module self-dependency nonsense
  • Testing approach altered significantly

About

Kubernetes Python Client done Async Twisted Style

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages