mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Revert "Adding converter functions to convert field label selectors to internal version before matching"
This commit is contained in:
@@ -18,6 +18,7 @@ package apiserver
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/httplog"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
|
||||
watchjson "github.com/GoogleCloudPlatform/kubernetes/pkg/watch/json"
|
||||
@@ -54,6 +56,25 @@ func (h *WatchHandler) setSelfLinkAddName(obj runtime.Object, req *http.Request)
|
||||
return h.linker.SetSelfLink(obj, newURL.String())
|
||||
}
|
||||
|
||||
func getWatchParams(query url.Values) (label, field labels.Selector, resourceVersion string, err error) {
|
||||
s, perr := labels.ParseSelector(query.Get("labels"))
|
||||
if perr != nil {
|
||||
err = perr
|
||||
return
|
||||
}
|
||||
label = s
|
||||
|
||||
s, perr = labels.ParseSelector(query.Get("fields"))
|
||||
if perr != nil {
|
||||
err = perr
|
||||
return
|
||||
}
|
||||
field = s
|
||||
|
||||
resourceVersion = query.Get("resourceVersion")
|
||||
return
|
||||
}
|
||||
|
||||
var connectionUpgradeRegex = regexp.MustCompile("(^|.*,\\s*)upgrade($|\\s*,)")
|
||||
|
||||
func isWebsocketRequest(req *http.Request) bool {
|
||||
@@ -96,13 +117,11 @@ func (h *WatchHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
label, field, err := parseSelectorQueryParams(req.URL.Query(), requestInfo.APIVersion, apiResource)
|
||||
label, field, resourceVersion, err := getWatchParams(req.URL.Query())
|
||||
if err != nil {
|
||||
httpCode = errorJSON(err, h.codec, w)
|
||||
return
|
||||
}
|
||||
|
||||
resourceVersion := req.URL.Query().Get("resourceVersion")
|
||||
watching, err := watcher.Watch(ctx, label, field, resourceVersion)
|
||||
if err != nil {
|
||||
httpCode = errorJSON(err, h.codec, w)
|
||||
|
Reference in New Issue
Block a user