The problem is that the code is expecting __get__ and __call__ to be executed in order. In https://github.com/miracle2k/k8s-snapshots we inadvertently ended up with a situation where that is not the case. Because we are watching two resources, in two separate threads, what happens during setup is that the methods are called in this order:
ObjectManager.get (for the PersistentVolume resource)
ObjectManager.get (for the PersistentVolumeClaim resource)
ObjectManager.call (for the PersistentVolume resource, but with self.api_obj_class set to PersistentVolumeClaim!)
ObjectManager.call (for the PersistentVolumeClaim resource)
In case it helps, a minimal example to reproduce this (Python 3.6) is here:
The code in question is here:
https://github.com/kelproject/pykube/blob/e8a46298a592ad9037587afb707ac75b3114eff9/pykube/objects.py#L14-L23
The problem is that the code is expecting
__get__
and__call__
to be executed in order. In https://github.com/miracle2k/k8s-snapshots we inadvertently ended up with a situation where that is not the case. Because we are watching two resources, in two separate threads, what happens during setup is that the methods are called in this order:In case it helps, a minimal example to reproduce this (Python 3.6) is here:
https://github.com/miracle2k/k8s-snapshots/tree/pykube-bug