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

Use client-go's service account token client refresh #6924

Closed
nrfox opened this issue Dec 5, 2023 · 1 comment · Fixed by #7023
Closed

Use client-go's service account token client refresh #6924

nrfox opened this issue Dec 5, 2023 · 1 comment · Fixed by #7023
Assignees
Labels
enhancement This is the preferred way to describe new end-to-end features.

Comments

@nrfox
Copy link
Contributor

nrfox commented Dec 5, 2023

What do you want to improve?

This is a "tech debt" issue. To address: #5070, the ability to watch the service account token file and refresh Kiali's kube client/cache was added. It turns out this functionality already exists in the kubernetes go client. In order for this to work however, when you create the rest.Config you need to set the TokenFile field per: https://github.com/kubernetes/client-go/blob/84a6fe7e4032ae1b8bc03b5208e771c5f7103549/transport/round_trippers.go#L283-L302

The way that Kiali is constructing the rest.Config, Kiali does not set this.

baseConfig := rest.Config{
Host: config.Host, // TODO: do we need this? remote cluster clients should ignore this
TLSClientConfig: config.TLSClientConfig,
QPS: conf.KubernetesConfig.QPS,
Burst: conf.KubernetesConfig.Burst,
}

Kiali should only set this for the Kiali Service Account Client but once that field is set, the client should be able to refresh itself which would simplify the client and cache.

What is the new behavior?

Token refresh works by relying on the underlying client-go to do the refresh.

@nrfox nrfox added the enhancement This is the preferred way to describe new end-to-end features. label Dec 5, 2023
@jmazzitelli jmazzitelli self-assigned this Jan 12, 2024
@jmazzitelli
Copy link
Collaborator

In order for this to work however, when you create the rest.Config you need to set the TokenFile field per:

I believe you mean BearerTokenFile as declared here: https://github.com/kubernetes/client-go/blob/v12.0.0/rest/config.go#L74-L77

jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 12, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 16, 2024
jmazzitelli added a commit to jmazzitelli/kiali that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is the preferred way to describe new end-to-end features.
Projects
Development

Successfully merging a pull request may close this issue.

2 participants