kopf icon indicating copy to clipboard operation
kopf copied to clipboard

kopf.timer + kopf.on.create ==> can't delete

Open johnnyrun opened this issue 4 years ago • 0 comments

Long story short

If you use kopf.timer ans kopf create/update on the same resource, "kubectl delete" hangs.

Description

kubectl delete logconfigs xxx

^-- this command hangs. Logs say that the delete function has run with success:

Handler 'delete_fn' succeeded.
All handlers succeeded for deletion.

the kubectl command does not return.

The code snippet to reproduce the issue
import kopf

@kopf.timer('scc.demo.it', 'v1', 'logconfigs', interval=50)
def patch_drifts(body, meta, name, namespace, spec, logger, **kwargs):
    logger.info('timer')
    pass

@kopf.on.create('scc.demo.it', 'v1', 'logconfigs')
def create_fn(body, meta, name, namespace, spec, logger, **kwargs):
    logger.info('create')
    pass

@kopf.on.delete('scc.demo.it', 'v1', 'logconfigs')
def delete_fn(body, meta, spec, name, namespace, logger, **kwargs):
    logger.info('delete')
    pass
The full output of the command that failed
[2020-05-01 16:06:02,676] kopf.objects         [INFO    ] [default/simple-logconfig] Handler 'create_fn' succeeded.
[2020-05-01 16:06:02,677] kopf.objects         [INFO    ] [default/simple-logconfig] All handlers succeeded for creation.
[2020-05-01 16:06:06,112] kopf.objects         [INFO    ] [default/simple-logconfig] delete
[2020-05-01 16:06:06,115] kopf.objects         [INFO    ] [default/simple-logconfig] Handler 'delete_fn' succeeded.
[2020-05-01 16:06:06,116] kopf.objects         [INFO    ] [default/simple-logconfig] All handlers succeeded for deletion.

Environment

  • Kopf version: 0.27rc5
  • Kubernetes version: v1.15.3
  • Python version: 3.8.1
  • OS/platform: osx
Python packages installed
aiohttp==3.6.2
aiojobs==0.2.2
async-timeout==3.0.1
attrs==19.3.0
cachetools==4.1.0
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
decorator==4.4.2
google-auth==1.14.1
idna==2.9
iso8601==0.1.12
Jinja2==2.11.2
jsonpath-ng==1.5.1
kopf==0.27rc5
kubernetes==11.0.0
MarkupSafe==1.1.1
multidict==4.7.5
oauthlib==3.1.0
pip==20.1
ply==3.11
pyasn1==0.4.8
pyasn1-modules==0.2.8
pykube-ng==20.4.1
python-dateutil==2.8.1
PyYAML==5.3.1
requests==2.23.0
requests-oauthlib==1.3.0
rsa==4.0
setuptools==46.1.3
six==1.14.0
typing-extensions==3.7.4.2
urllib3==1.25.9
websocket-client==0.57.0
wheel==0.34.2
yarl==1.4.2

johnnyrun avatar May 01 '20 14:05 johnnyrun