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

Fall back to rudimentary login handlers if the clients are absent #771

Merged
merged 2 commits into from
May 14, 2021

Conversation

nolar
Copy link
Owner

@nolar nolar commented May 13, 2021

This will make Kopf runnable in the majority of cases even with no pykube-ng and kubernetes client libraries installed. This was not a problem till recently, but then pykube-ng was removed from the implicit dependencies (#655), so users get frustrated by "unauthenticated" or "ran out of credentials" errors (#349 #187, partially solved in #770).

Two extra functions are added to the public interface:

  • kopf.login_with_kubeconfig()
  • kopf.login_with_service_account()

They can only read the rudimentary (but usually sufficient) data and pass them to the API requests "as is", with no post-processing or interpretation (or token rotation, or whatever the client libraries can provide).

To avoid running too many login handlers at startup, the rudimentary login handlers are added strictly when the client libraries are absent, not always. This can be overridden with custom login handlers calling these functions (as documented).

TODOs:

  • Tests.

@nolar nolar added the enhancement New feature or request label May 13, 2021
@nolar nolar force-pushed the rudimentary-logins branch 2 times, most recently from 1dca7fd to 5e2c007 Compare May 13, 2021 21:39
@nolar nolar marked this pull request as ready for review May 13, 2021 22:24
nolar added 2 commits May 14, 2021 09:49
Positional args are not used, and positional args are not a protocol for handlers anymore. They were originally added to match the callback signatures when invocation had positional args (when filters/lifecycles were called via the invocation routines) — but this is not the case anymore. So, remove them. Keep only the kwargs.

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
This will make Kopf runnable in the majority of cases even with no `pykube-ng` and `kubernetes` client libraries installed. This was not a problem till recently, but then `pykube-ng` was removed from the implicit dependencies, so users get frustrated by "unauthenticated" or "ran out of credentials" errors.

To avoid running too many login handlers at startup, the rudimentary login handlers are added strictly when the client libraries are absent, not always. This can be overridden with custom login handlers calling these functions (as documented).

Signed-off-by: Sergey Vasilyev <nolar@nolar.info>
@nolar nolar merged commit 9674f06 into main May 14, 2021
@nolar nolar deleted the rudimentary-logins branch May 14, 2021 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant