This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into typehints-lazydictview
- Loading branch information
Showing
14 changed files
with
102 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
All the structures coming from/to the Kubernetes API. | ||
""" | ||
|
||
|
||
def build_object_reference(body): | ||
""" | ||
Construct an object reference for the events. | ||
Keep in mind that some fields can be absent: e.g. ``namespace`` | ||
for cluster resources, or e.g. ``apiVersion`` for ``kind: Node``, etc. | ||
""" | ||
ref = dict( | ||
apiVersion=body.get('apiVersion'), | ||
kind=body.get('kind'), | ||
name=body.get('metadata', {}).get('name'), | ||
uid=body.get('metadata', {}).get('uid'), | ||
namespace=body.get('metadata', {}).get('namespace'), | ||
) | ||
return {key: val for key, val in ref.items() if val} | ||
|
||
|
||
def build_owner_reference(body): | ||
""" | ||
Construct an owner reference object for the parent-children relationships. | ||
The structure needed to link the children objects to the current object as a parent. | ||
See https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/ | ||
Keep in mind that some fields can be absent: e.g. ``namespace`` | ||
for cluster resources, or e.g. ``apiVersion`` for ``kind: Node``, etc. | ||
""" | ||
ref = dict( | ||
controller=True, | ||
blockOwnerDeletion=True, | ||
apiVersion=body.get('apiVersion'), | ||
kind=body.get('kind'), | ||
name=body.get('metadata', {}).get('name'), | ||
uid=body.get('metadata', {}).get('uid'), | ||
) | ||
return {key: val for key, val in ref.items() if val} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" | ||
Helper tools to test the Kopf-based operators. | ||
This module is a part of the framework's public interface. | ||
""" | ||
from kopf.toolkits.runner import KopfRunner | ||
|
||
__all__ = [ | ||
'KopfRunner', | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Toolkits to improve the developer experience in the context of Kopf. | ||
They are not needed to use the framework or to run the operator | ||
(unlike all other packages), but they can make the development | ||
of the operators much easier. | ||
Some things can be considered as the clients' responsibilities | ||
rather than the operator framework's responsibilities. | ||
In that case, the decision point is whether the functions work | ||
"in the context of Kopf" at least to some extent | ||
(e.g. by using its contextual information of the current handler). | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters