mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-10 05:30:26 +00:00
Do not use namespace in url paths pre v1beta3 from client
This commit is contained in:
@@ -117,7 +117,7 @@ func RESTClientFor(config *Config) (*RESTClient, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client := NewRESTClient(baseURL, versionInterfaces.Codec)
|
||||
client := NewRESTClient(baseURL, versionInterfaces.Codec, NamespaceInPathFor(version))
|
||||
|
||||
transport, err := TransportFor(config)
|
||||
if err != nil {
|
||||
@@ -252,3 +252,9 @@ func defaultVersionFor(config *Config) string {
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
||||
// namespaceInPathFor is used to control what api version should use namespace in url paths
|
||||
func NamespaceInPathFor(version string) bool {
|
||||
// we use query param for v1beta1/v1beta2, v1beta3+ will use path param
|
||||
return (version != "v1beta1" && version != "v1beta2")
|
||||
}
|
||||
|
Reference in New Issue
Block a user