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] Consolidate all K8s API calls in one place #71

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

[PR] Consolidate all K8s API calls in one place #71

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive automation CI/CD: testing, linting, releasing automatically

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

A pull request by nolar at 2019-05-24 09:48:56+00:00
Original URL: zalando-incubator/kopf#71
Merged by nolar at 2019-05-28 14:10:01+00:00

Issue : #13

This is purely a refactoring: moving all Kubernetes-client-related routines into one place.

And a lot of new tests for these K8s-client call (in addition to the existing ones).

Previously, the API calls were spread all over the codebase. And the official Kubernetes client is quite wordy, so the places were also unnecessary wordy (not to their main point).


Few notes:

The peering objects (cluster-scoped, namespace-scoped, and the legacy one) use exactly the same unified logic now, with no exceptions.

There are no changes in the APIs, DSLs, signatures, behaviour or anything user-facing or k8s-facing. Only the internal code moves. Except for this:

  • When patching AND the object is a cluster-scoped resource (no namespace by design), patch_cluster_custom_object() is used instead of patch_namespaced_custom_object(namespace=None), which would fail. This would also affect the patching of peering objects (cluster-scoped and legacy), but is fixed in place.

Patching of a namespaced resource uses the namespace of the resource itself (even for the cluster-scoped operator).


This PR is also a part of the following chain of changes:

  • (This PR): Extraction of the K8s-API-related methods to a single place, both for served objects and for peering objects (the logic must be aligned).
    • (Needed for): Testing of peering logic, regardless of the API calls. Tests automation #13
    • (Needed for): Testing of how the framework handles the events and which API methods it calls (mocking the central place instead of individual API client calls all around). Tests automation #13
      • (Needed for): Safe changes of the handling logic (i.e. silent spies, etc). <<< MAIN GOAL.
    • (Needed for): Switching to pykube-ng (Consider pykube-ng? #15), and generally being K8s-client-agnostic.
    • (Needed for): Making the whole framework async, eliminating the blocking API calls (or putting them to the asyncio thread executors).
@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
This was referenced Aug 19, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] [PR] Consolidate all K8s API calls in one place Aug 19, 2020
@kopf-archiver kopf-archiver bot added the automation CI/CD: testing, linting, releasing automatically label Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive automation CI/CD: testing, linting, releasing automatically
Projects
None yet
Development

No branches or pull requests

0 participants