drop v1 support
This commit is contained in:
parent
e81ded31b9
commit
0039abf4a2
|
|
@ -79,14 +79,12 @@ func main() {
|
|||
func makeHandler(upstreamRegistry string) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// right now we just need to serve a redirect, but all
|
||||
// valid requests should be at /v2/ or /v1/, so we leave this check
|
||||
// valid requests should be at /v2/, so we leave this check
|
||||
// in the future we will selectively redirect clients to different copies
|
||||
path := r.URL.Path
|
||||
switch {
|
||||
case strings.HasPrefix(path, "/v2/"):
|
||||
doV2(w, r, upstreamRegistry)
|
||||
case strings.HasPrefix(path, "/v1/"):
|
||||
doV1(w, r, upstreamRegistry)
|
||||
default:
|
||||
klog.V(2).InfoS("unknown request", "path", path)
|
||||
http.NotFound(w, r)
|
||||
|
|
@ -99,10 +97,3 @@ func doV2(w http.ResponseWriter, r *http.Request, upstreamRegistry string) {
|
|||
klog.V(2).InfoS("v2 request", "path", path)
|
||||
http.Redirect(w, r, upstreamRegistry+path, http.StatusPermanentRedirect)
|
||||
}
|
||||
|
||||
// TODO: should we even be supporting v1 API anymore?
|
||||
func doV1(w http.ResponseWriter, r *http.Request, upstreamRegistry string) {
|
||||
path := r.URL.Path
|
||||
klog.V(2).InfoS("v1 request", "path", path)
|
||||
http.Redirect(w, r, upstreamRegistry+path, http.StatusPermanentRedirect)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue