Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kopf does not tolerate annotations while patching finalizer #1055

Open
lkoniecz opened this issue Sep 20, 2023 · 1 comment
Open

kopf does not tolerate annotations while patching finalizer #1055

lkoniecz opened this issue Sep 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lkoniecz
Copy link

lkoniecz commented Sep 20, 2023

Long story short

I tried to distinquish an operator that works in my cluster with those than my team and I run locally.
Used https://kopf.readthedocs.io/en/stable/filters/#metadata-filters for resource filtering.

It works and the handlers are being invoked correctly, but working operators go into a patching war, one putting a finalizer while other constantly removing it.

Yes, I know peering - but from what I read the highest prio wins. I need more than one working simultanously.

Kopf version

1.36.2

Kubernetes version

1.24

Python version

3.9

Code

import kopf

def metadata_filter() -> dict:
    return {
        'dev.operator.env.name': os.getenv('ENV_NAME', default='some-env')
    }

@kopf.on.create('awsrequests', annotations=metadata_filter())
def handler(patch, **kwargs):
    # do some stuff
    pass

Logs

{"message": "Patching with: {'metadata': {'finalizers': []}}", "timestamp": "2023-09-20T10:46:39.601150+00:00", "object": {"apiVersion": "redacted/v1", "kind": "HTTPRequest", "name": "generate-token", "uid": "bb884f9b-dfa0-4144-a706-a455ad13f08d", "namespace": "operators"}, "severity": "debug"}
{"message": "Removing the finalizer, as there are no handlers requiring it.", "timestamp": "2023-09-20T10:46:39.969490+00:00", "object": {"apiVersion": "redacted/v1", "kind": "HTTPRequest", "name": "generate-token", "uid": "bb884f9b-dfa0-4144-a706-a455ad13f08d", "namespace": "operators"}, "severity": "debug"}
{"message": "Patching with: {'metadata': {'finalizers': []}}", "timestamp": "2023-09-20T10:46:41.108854+00:00", "object": {"apiVersion": "redacted/v1", "kind": "HTTPRequest", "name": "generate-token", "uid": "bb884f9b-dfa0-4144-a706-a455ad13f08d", "namespace": "operators"}, "severity": "debug"}
{"message": "Removing the finalizer, as there are no handlers requiring it.", "timestamp": "2023-09-20T10:46:41.473737+00:00", "object": {"apiVersion": "redacted/v1", "kind": "HTTPRequest", "name": "generate-token", "uid": "bb884f9b-dfa0-4144-a706-a455ad13f08d", "namespace": "operators"}, "severity": "debug"}
{"message": "Patching with: {'metadata': {'finalizers': []}}", "timestamp": "2023-09-20T10:46:41.474058+00:00", "object": {"apiVersion": "redacted/v1", "kind": "HTTPRequest", "name": "generate-token", "uid": "bb884f9b-dfa0-4144-a706-a455ad13f08d", "namespace": "operators"}, "severity": "debug"}

Additional information

No response

@lkoniecz lkoniecz added the bug Something isn't working label Sep 20, 2023
@lkoniecz
Copy link
Author

settings.persistence.finalizer settings does seem to solve the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant