mirror of https://github.com/k3s-io/k3s
Merge pull request #48016 from liggitt/api-versions-cache
Automatic merge from submit-queue (batch tested with PRs 47869, 48013, 48016, 48005) Fix kubectl api-versions caching xref https://github.com/kubernetes/kubectl/issues/41 The point of the `api-versions` and `version` commands is to ask the server for its API groups or versions, so we don't want to use cached datapull/6/head
commit
a82c9ac2f2
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue