Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR] Move the modules around to cleanup the code #124

Closed
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Closed

[PR] Move the modules around to cleanup the code #124

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive refactoring Code cleanup without new features added

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

A pull request by nolar at 2019-07-01 08:36:00+00:00
Original URL: zalando-incubator/kopf#124
Merged by nolar at 2019-07-01 09:14:23+00:00

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
@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] [PR] Move the modules around to cleanup the code Aug 19, 2020
@kopf-archiver kopf-archiver bot added the refactoring Code cleanup without new features added label Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive refactoring Code cleanup without new features added
Projects
None yet
Development

No branches or pull requests

0 participants