Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/hierarchies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ by manipulating their content before it is sent to the Kubernetes API.
It does not provide any means to manipulate the Kubernetes resources
in the cluster or to directly talk to the Kubernetes API in any other way.
Use any of the existing libraries for that purpose,
such as the official `kubernetes client`_, pykorm_, or pykube-ng_.
such as the official `kubernetes client`_, `kubernetes asyncio client`_, pykorm_, or pykube-ng_.

.. _kubernetes client: https://github.com/kubernetes-client/python
.. _kubernetes asyncio client: https://github.com/tomplus/kubernetes_asyncio
.. _pykorm: https://github.com/Frankkkkk/pykorm
.. _pykube-ng: https://github.com/hjacobs/pykube

Expand Down
10 changes: 9 additions & 1 deletion kopf/_cogs/helpers/thirdparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ class _dummy: pass
except ImportError:
PykubeObject = _dummy

V1ObjectMeta = V1OwnerReference = None

try:
from kubernetes_asyncio.client import V1ObjectMeta as V1ObjectMeta, V1OwnerReference as V1OwnerReference

Check notice

Code scanning / CodeQL

Unused import

Import of 'V1OwnerReference' is not used.
except ImportError:

Check notice

Code scanning / CodeQL

Empty except

'except' clause does nothing but pass and there is no explanatory comment.
pass
try:
from kubernetes.client import V1ObjectMeta as V1ObjectMeta, V1OwnerReference as V1OwnerReference
except ImportError:
V1ObjectMeta = V1OwnerReference = None
pass


# Kubernetes client does not have any common base classes, its code is fully generated.
Expand All @@ -35,6 +41,8 @@ def __subclasshook__(cls, subcls: Any) -> Any: # suppress types in this hack
if cls is KubernetesModel:
if any(C.__module__.startswith('kubernetes.client.models.') for C in subcls.__mro__):
return True
if any(C.__module__.startswith('kubernetes_asyncio.client.models.') for C in subcls.__mro__):
return True
return NotImplemented

@property
Expand Down