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

Fix kubectl api-versions caching #48016

Merged
merged 1 commit into from
Jun 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/kubectl/cmd/apiversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func RunApiVersions(f cmdutil.Factory, w io.Writer) error {
return err
}

// Always request fresh data from the server
discoveryclient.Invalidate()

groupList, err := discoveryclient.ServerGroups()
if err != nil {
return fmt.Errorf("Couldn't get available api versions from server: %v\n", err)
Expand Down
4 changes: 3 additions & 1 deletion pkg/kubectl/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ func RunVersion(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {

func retrieveServerVersion(f cmdutil.Factory) (*apimachineryversion.Info, error) {
discoveryClient, err := f.DiscoveryClient()

if err != nil {
return nil, err
}

// Always request fresh data from the server
discoveryClient.Invalidate()

serverVersion, err := discoveryClient.ServerVersion()
if err != nil {
return nil, err
Expand Down