Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Move the modules around to cleanup the code #124

Merged
merged 8 commits into from
Jul 1, 2019

Conversation

nolar
Copy link
Contributor

@nolar nolar commented Jul 1, 2019

Issue : prepares #111, prepares #117, closes #121.

Description

Kopf has grown since the last time the package/module structure was defined. As such, some things do not keep to each other, some upcoming things form different topics.

This PR restructures the layout of internal modules. All public interfaces are kept intact.

Specifically:

  • kopf.reactor is cleaned up, only the reacting things are left there.
  • kopf.utilities is created for different runtime-environment-related stuff (e.g. module importing).
  • kopf.engines is created for all reactor-supporting but not reactor-required activities. Now, it is peering. Soon, it will be k8s-event posting in background & logging to k8s-event (PRs #??? -- add later).
  • kopf.k8s is renamed to kopf.clients, as (1) the whole framework is anyway about k8s, (2) that package contain the client wrappers/adapters, (3) it can also contain other client adapters, not only k8s.
  • K8s automatic authentication is moved from kopf.config to kopf.clients.auth, where it belongs (it is an adapter/wrapper for the k8s client library).

Unless users import the internal objects (on their own risk), this should work fine. There are no changes in the logic or behaviour itself, only the structure.

Except for this one:

  • asyncio tasks creation (create_tasks() internal routine) now requires the loop. Usage of asyncio.Task is officially "discouraged" in the Python docs, so the tasks should be created in the specific loop.

The upcoming changes (few PRs that follow) are built on top of this new structure: e.g. background k8s-event poster is the new "engine", new logging with transparent k8s-event posting is also one of them.

This PR also extracts the complexity from them to make the review easier — as all package moves and cleanups are here.

Types of Changes

  • Refactor/improvements

@nolar nolar requested a review from samurang87 as a code owner July 1, 2019 08:36
@zincr
Copy link

zincr bot commented Jul 1, 2019

🤖 zincr found 0 problems , 0 warnings

✅ Large Commits
✅ Approvals
✅ Specification
✅ Dependency Licensing

@nolar nolar merged commit b977f12 into zalando-incubator:master Jul 1, 2019
@nolar nolar deleted the renames-and-moves branch July 1, 2019 09:14
@nolar nolar added the refactoring Code cleanup without new features added label Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
refactoring Code cleanup without new features added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected File?
2 participants