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

Minimum client version support #224

Merged
merged 4 commits into from
Dec 4, 2023
Merged

Minimum client version support #224

merged 4 commits into from
Dec 4, 2023

Conversation

majst01
Copy link
Contributor

@majst01 majst01 commented Dec 1, 2023

@majst01 majst01 requested a review from a team as a code owner December 1, 2023 11:37
cmd/login.go Outdated
Comment on lines 73 to 79
// We need to reread the written kubeconfig
err = initConfigWithViperCtx(c)
if err != nil {
return err
}

resp, err := c.client.Version().Info(version.NewInfoParams(), nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This endpoint does not require authentication, so we do not have to re-read the config.

Suggested change
// We need to reread the written kubeconfig
err = initConfigWithViperCtx(c)
if err != nil {
return err
}
resp, err := c.client.Version().Info(version.NewInfoParams(), nil)
resp, err := c.client.Version().Info(version.NewInfoParams(), clientNoAuth())

By passing nil we use the default auther that we configure in metal-go. To circumvent this, we can do somethings like this:

func clientNoAuth() runtime.ClientAuthInfoWriterFunc {
	noAuth := func(_ runtime.ClientRequest, _ strfmt.Registry) error { return nil }
	return runtime.ClientAuthInfoWriterFunc(noAuth)
}

@majst01 majst01 merged commit c23c462 into master Dec 4, 2023
5 checks passed
@majst01 majst01 deleted the minimum-client-version branch December 4, 2023 12:33
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