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

Authentication fails with custom kubectl plugin #1318

Closed
Razz4780 opened this issue Oct 23, 2023 · 3 comments · Fixed by #1320
Closed

Authentication fails with custom kubectl plugin #1318

Razz4780 opened this issue Oct 23, 2023 · 3 comments · Fixed by #1320
Labels
bug Something isn't working client kube Client related

Comments

@Razz4780
Copy link
Contributor

Razz4780 commented Oct 23, 2023

Current and expected behavior

kube-rs client fails to run custom authentication plugin. The plugin reads KUBERNETES_EXEC_INFO env var, which is a JSON-serialized object with two fields: kind and apiVersion. The plugin fails, because kube-rs client always sets kind to null when executing the command

let exec_info = serde_json::to_string(&ExecCredential {

kubectl works fine though.

Our issue: metalbear-co/mirrord#2023

Possible solution

Not sure yet, probably see how it's handled in client-go and do the same here.

Additional context

> kubectl version                          
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.1-eks-43840fb

Environment

I'll update when I get it

Configuration and features

k8s-openapi = { version = "0.20", features = ["v1_24"] }
kube = { git = "https://github.com/Razz4780/kube", branch = "support_socks5_proxy", default-features = false, features = ["runtime", "derive", "client", "ws", "rustls-tls", "oidc", "socks5"] }

Used kube is a fork of 0.86.0 with added socks5 support, changes do not affect this bug.

Affected crates

kube-client

Would you like to work on fixing this bug?

yes

@Razz4780 Razz4780 added the bug Something isn't working label Oct 23, 2023
@clux
Copy link
Member

clux commented Oct 23, 2023

It looks like we started setting KUBERNETES_EXEC_INFO to the json serialised output based on what's in the ExecConfig in https://github.com/kube-rs/kube/pull/1083/files

maybe it makes sense to not overwrite that evar if it is set?

@clux clux added the client kube Client related label Oct 23, 2023
@Razz4780
Copy link
Contributor Author

It looks like we started setting KUBERNETES_EXEC_INFO to the json serialised output based on what's in the ExecConfig in https://github.com/kube-rs/kube/pull/1083/files

maybe it makes sense to not overwrite that evar if it is set?

In our user's case, this variable is set by the kubectl and the kind value is set to ExecCredential.

@Razz4780
Copy link
Contributor Author

I'm a dumb potato, looks like field kind describes the type of the object itself. Relevant pieces of code from client-go: ExecCredential definition, how it's created and this test

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

Successfully merging a pull request may close this issue.

2 participants