Do not use namespace in url paths pre v1beta3 from client

This commit is contained in:
derekwaynecarr
2014-12-19 16:32:42 -05:00
parent 5807b3d6bc
commit abb6632d75
10 changed files with 109 additions and 42 deletions

View File

@@ -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")
}