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

Bug/credentials id token #70

Merged
merged 3 commits into from
Sep 16, 2019
Merged

Conversation

davidB
Copy link
Contributor

@davidB davidB commented Sep 16, 2019

Our environment use OpenIDConnect (oidc) to setup some access to k8s (bare-metal).
Existing code failed because we have auth-provider but no access-token and certificate use relative inside the .kube/config.

This fix allow:

  • use relative path for certificate
  • use id-token if present
  • not crash if auth-provider is present but access-token is absent

Current, auto-refresh of expired id-token is not supported

@clux
Copy link
Member

clux commented Sep 16, 2019

Thanks a lot. This certainly looks sensible. Will try it out against my normal clusters.

@clux clux merged commit c4d12b9 into kube-rs:master Sep 16, 2019
@clux
Copy link
Member

clux commented Sep 16, 2019

All seems fine here. Will add to the next release. Thanks again!

clux added a commit that referenced this pull request Sep 16, 2019
@davidB
Copy link
Contributor Author

davidB commented Sep 17, 2019

Thanks, I guess supporting refresh of id-token requires a dependency to jsonwebtoken and maybe to be able to update kubeconfig.

@clux
Copy link
Member

clux commented Sep 17, 2019

Ah that's why this stuff is always broken everywhere. Even with main kubectl I've frequently had to delete lines from the auth provider line to trigger a refresh with certain oidc providers.

@clux
Copy link
Member

clux commented Sep 17, 2019

Should be fine to pull that in though, doesn't look like it pulls in too many deps. Especially if we're trying to move to rustls long term #66. Happy to take a PR for it if it's somewhat maintainable. 🙂

@davidB
Copy link
Contributor Author

davidB commented Sep 17, 2019

maybe because some provider also update the refresh token, when you update the access-token (in fact allowing a refresh-token to be re-use is a security issue, iirc RFC)

@davidB
Copy link
Contributor Author

davidB commented Sep 17, 2019

I'll be busy during the next 2 or 3 weeks, but I'll take a look after if I don't forgot. If my k8s user use the cli I made with kube-rs, I things they will complain about this randow error message about invalid token ;-).

@clux
Copy link
Member

clux commented Sep 17, 2019

Ok, I've made #72 to track it at least. I'd appreciate the help when you have time!

@davidB
Copy link
Contributor Author

davidB commented Oct 22, 2019

Do you have an ETA for 0.17.0 ?
I would like to be able to build my crate based on kube-rs and to allow my users to use it (with oidc).

FYI my crate is a kubectl plugin: kubectl-view-allocations and output thing like:

Resource                                                  Requested  %Requested  Limit  %Limit  Allocatable   Free
  cpu                                                              6           3     40      20          200    160
  ├─ node1                                                     0           0      0       0           12     12
  │  ├─ kube-flannel-ds-amd64-hqxgb                                0         NaN      0     NaN            0      0
  │  ├─ node-exporter-gpu-b4w7s                                    0         NaN      0     NaN            0      0
  │  └─ weave-scope-agent-x6hqz                                    0         NaN      0     NaN            0      0
  ├─ node2                                                     0           0      0       0           24     24
  │  ├─ kube-flannel-ds-amd64-p26rr                                0         NaN      0     NaN            0      0
  │  ├─ node-exporter-gpu-xqchb                                    0         NaN      0     NaN            0      0
  │  └─ weave-scope-agent-m9mn6                                    0         NaN      0     NaN            0      0
  ├─ node3                                                     0           0      0       0           32     32
  │  ├─ kube-flannel-ds-amd64-k9kmm

Thanks

@clux
Copy link
Member

clux commented Oct 22, 2019

You can always pin to a git sha in Cargo.toml, but yeah, t's been a little too long. I'll try to make a version now.

@clux
Copy link
Member

clux commented Oct 22, 2019

Released 0.17.0 now.

@davidB
Copy link
Contributor Author

davidB commented Oct 23, 2019

Thanks, I release my crates: https://crates.io/crates/kubectl-view-allocations

twz123 added a commit to twz123/kube-rs that referenced this pull request Feb 13, 2021
This basically restores the functionality that has been added in kube-rs#70.
Same caveats apply here: auto-refresh of expired id-token is not
supported.
twz123 added a commit to twz123/kube-rs that referenced this pull request Feb 13, 2021
This basically restores the functionality that has been added in kube-rs#70.
Same caveats apply here: auto-refresh of expired id-token is not
supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants