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

Watcher fails because empty vault is used during re-authentication #1133

Open
aa2811 opened this issue Oct 31, 2024 · 0 comments
Open

Watcher fails because empty vault is used during re-authentication #1133

aa2811 opened this issue Oct 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aa2811
Copy link

aa2811 commented Oct 31, 2024

Long story short

We are seeing issues where our watcher fails after the first credential expiration, because the empty vault is used during re-authentication.

From code reading, it looks like the _select function should block during re-authentication, but logs show this isn't happening.

We are using the piggybacking authentication with the login_with_service_account method

Kopf version

1.37.2

Kubernetes version

1.30 (AKS)

Python version

3.9.19

Code

No response

Logs

{"message": "Re-authentication has been initiated.", "timestamp": "2024-10-16T17:40:00.488688+00:00", "severity": "info"}
{"message": "Activity 'login_with_service_account' is invoked.", "timestamp": "2024-10-16T17:40:00.488932+00:00", "severity": "debug"}
{"message": "Stopping the watch-stream for servicemonitors.v1.monitoring.coreos.com cluster-wide.", "timestamp": "2024-10-16T17:40:00.489383+00:00", "severity": "debug"}
{"message": "Watcher for servicemonitors.v1.monitoring.coreos.com@none has failed: Ran out of valid credentials. Consider installing an API client library or adding a login handler. See more: https://kopf.readthedocs.io/en/stable/authentication/", "exc_info": "Traceback (most recent call last):\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/aiokits/aiotasks.py\", line 96, in guard\n    await coro\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_core/reactor/queueing.py\", line 175, in watcher\n    async for raw_event in stream:\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/clients/watching.py\", line 86, in infinite_watch\n    async for raw_event in stream:\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/clients/watching.py\", line 201, in continuous_watch\n    async for raw_input in stream:\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/clients/watching.py\", line 266, in watch_objs\n    async for raw_input in api.stream(\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/clients/api.py\", line 200, in stream\n    response = await request(\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/clients/auth.py\", line 48, in wrapper\n    async for key, info, context in vault.extended(APIContext, 'contexts'):\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/structs/credentials.py\", line 158, in extended\n    async for key, item in self._items():\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/structs/credentials.py\", line 195, in _items\n    yielded_key, yielded_item = self.select()\n  File \"/opt/python/venvs/heracles/lib/python3.9/site-packages/kopf/_cogs/structs/credentials.py\", line 214, in select\n    raise LoginError(\"Ran out of valid credentials. Consider installing \"\nkopf._cogs.structs.credentials.LoginError: Ran out of valid credentials. Consider installing an API client library or adding a login handler. See more: https://kopf.readthedocs.io/en/stable/authentication/", "timestamp": "2024-10-16T17:40:00.490222+00:00", "severity": "error"}
{"message": "Activity 'login_with_service_account' succeeded.", "timestamp": "2024-10-16T17:40:00.491191+00:00", "severity": "info"}
{"message": "Re-authentication has finished.", "timestamp": "2024-10-16T17:40:00.491303+00:00", "severity": "info"}

Additional information

If it's useful, we're using aiohttp==3.10.10

@aa2811 aa2811 added the bug Something isn't working label Oct 31, 2024
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