Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

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

Open
johnnyrun opened this issue May 1, 2020 · 0 comments
Open

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

johnnyrun opened this issue May 1, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@johnnyrun
Copy link

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 johnnyrun added the bug Something isn't working label May 1, 2020
@johnnyrun johnnyrun changed the title kopf.timer + kopf.create ==> can't delete kopf.timer + kopf.on.create ==> can't delete May 1, 2020
@nolar nolar self-assigned this May 8, 2020
nolar added a commit to nolar/kopf-fork-from-zalando-incubator that referenced this issue May 8, 2020
Technically: The finalizers removal criteria have changed from
"when done && reason == DELETE" to "when no delays returned"
(see 7adba02).

But the delays were not returned for multi-step deletion (2+ handlers),
so the finalizers were removed immediately after the 1st on-deletion
handler, and the 2nd and further on-deletion handlers were not invoked.

Now, with a delay of 0 for not yet finished (but not delayed) handlers,
it will not be considered as "done", which will prevent the deletion
of finalizers until really all handlers are finished either way.

See zalando-incubator#356
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants