Validate key subscript for metadata.annotations and metadata.labels separately

This commit is contained in:
Yang Guo
2017-11-22 12:38:09 -08:00
parent 34a7b3dea8
commit c74b97b29d
8 changed files with 153 additions and 71 deletions

View File

@@ -28,7 +28,6 @@ import (
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/fieldpath"
)
// This is a "fast-path" that avoids reflection for common types. It focuses on the objects that are
@@ -157,8 +156,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
// Add field conversion funcs.
err = scheme.AddFieldLabelConversionFunc("v1", "Pod",
func(label, value string) (string, string, error) {
path, _ := fieldpath.SplitMaybeSubscriptedPath(label)
switch path {
switch label {
case "metadata.name",
"metadata.namespace",
"spec.nodeName",