mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
update negotiation to reflect current kubectl state
This commit is contained in:
parent
2bb1e75815
commit
2b5b04d074
@ -104,8 +104,8 @@ func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion
|
|||||||
return &clientRegisteredGVs[0], nil
|
return &clientRegisteredGVs[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("failed to negotiate an api version; server supports: %v, client supports: %v",
|
// fall back to an empty GroupVersion. Most client commands no longer respect a GroupVersion anyway
|
||||||
serverVersions, clientVersions)
|
return &schema.GroupVersion{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GroupVersionResources converts APIResourceLists to the GroupVersionResources.
|
// GroupVersionResources converts APIResourceLists to the GroupVersionResources.
|
||||||
|
@ -118,8 +118,8 @@ func TestNegotiateVersion(t *testing.T) {
|
|||||||
statusCode: http.StatusNotFound,
|
statusCode: http.StatusNotFound,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, no fallback GroupVersion",
|
name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, fallback to empty GroupVersion",
|
||||||
expectErr: func(err error) bool { return strings.Contains(err.Error(), "failed to negotiate an api version;") },
|
expectedVersion: &schema.GroupVersion{},
|
||||||
statusCode: http.StatusForbidden,
|
statusCode: http.StatusForbidden,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user