Merge branch 'master' into keymutex

Kubernetes-commit: e72b32558c8e9ed16690ef5a8e909c12fcc47f87
This commit is contained in:
Kubernetes Publisher 2019-01-31 20:50:57 +08:00
commit 796e63518f
4 changed files with 175 additions and 101 deletions

172
Godeps/Godeps.json generated
View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/client-go", "ImportPath": "k8s.io/client-go",
"GoVersion": "go1.11", "GoVersion": "go1.11",
"GodepVersion": "v80-k8s-r1", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
], ],
@ -56,7 +56,7 @@
}, },
{ {
"ImportPath": "github.com/evanphx/json-patch", "ImportPath": "github.com/evanphx/json-patch",
"Rev": "36442dbdb585210f8d5a1b45e67aa323c197d5c4" "Rev": "d4020504c68b6bfa818032bedfb48e33e9638506"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/proto", "ImportPath": "github.com/gogo/protobuf/proto",
@ -272,339 +272,339 @@
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1beta1", "ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1", "ImportPath": "k8s.io/api/apps/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta1", "ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta2", "ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/auditregistration/v1alpha1", "ImportPath": "k8s.io/api/auditregistration/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1", "ImportPath": "k8s.io/api/authentication/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1beta1", "ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1", "ImportPath": "k8s.io/api/authorization/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1beta1", "ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v1", "ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta1", "ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta2", "ImportPath": "k8s.io/api/autoscaling/v2beta2",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1", "ImportPath": "k8s.io/api/batch/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1beta1", "ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v2alpha1", "ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/certificates/v1beta1", "ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/coordination/v1", "ImportPath": "k8s.io/api/coordination/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/coordination/v1beta1", "ImportPath": "k8s.io/api/coordination/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/core/v1", "ImportPath": "k8s.io/api/core/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/events/v1beta1", "ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/extensions/v1beta1", "ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1", "ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/networking/v1", "ImportPath": "k8s.io/api/networking/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/policy/v1beta1", "ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1", "ImportPath": "k8s.io/api/rbac/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1alpha1", "ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1beta1", "ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1alpha1", "ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1beta1", "ImportPath": "k8s.io/api/scheduling/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/settings/v1alpha1", "ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1", "ImportPath": "k8s.io/api/storage/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1alpha1", "ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1beta1", "ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "d6d898a93caf42e00758b7a9c5a4aec1c71b3a7a"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/naming", "ImportPath": "k8s.io/apimachinery/pkg/util/naming",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Rev": "df262fa1a1ba3c1e5f53fa69c6d6d3da15a07955"
}, },
{ {
"ImportPath": "k8s.io/klog", "ImportPath": "k8s.io/klog",

View File

@ -148,12 +148,19 @@ func (c *threadSafeMap) Index(indexName string, obj interface{}) ([]interface{},
} }
index := c.indices[indexName] index := c.indices[indexName]
// need to de-dupe the return list. Since multiple keys are allowed, this can happen. var returnKeySet sets.String
returnKeySet := sets.String{} if len(indexKeys) == 1 {
for _, indexKey := range indexKeys { // In majority of cases, there is exactly one value matching.
set := index[indexKey] // Optimize the most common path - deduping is not needed here.
for _, key := range set.UnsortedList() { returnKeySet = index[indexKeys[0]]
returnKeySet.Insert(key) } else {
// Need to de-dupe the return list.
// Since multiple keys are allowed, this can happen.
returnKeySet = sets.String{}
for _, indexKey := range indexKeys {
for key := range index[indexKey] {
returnKeySet.Insert(key)
}
} }
} }

View File

@ -25,6 +25,23 @@ go get -u github.com/evanphx/json-patch
* [Comparing JSON documents](#comparing-json-documents) * [Comparing JSON documents](#comparing-json-documents)
* [Combine merge patches](#combine-merge-patches) * [Combine merge patches](#combine-merge-patches)
# Configuration
* There is a global configuration variable `jsonpatch.SupportNegativeIndices`.
This defaults to `true` and enables the non-standard practice of allowing
negative indices to mean indices starting at the end of an array. This
functionality can be disabled by setting `jsonpatch.SupportNegativeIndices =
false`.
* There is a global configuration variable `jsonpatch.ArraySizeLimit`, which
limits the length of any array the patched object can have. It defaults to 0,
which means there is no limit.
* There is a global configuration variable `jsonpatch.ArraySizeAdditionLimit`,
which limits the increase of array length caused by each operation. It
defaults to 0, which means there is no limit.
## Create and apply a merge patch ## Create and apply a merge patch
Given both an original JSON document and a modified JSON document, you can create Given both an original JSON document and a modified JSON document, you can create
a [Merge Patch](https://tools.ietf.org/html/rfc7396) document. a [Merge Patch](https://tools.ietf.org/html/rfc7396) document.

View File

@ -14,6 +14,10 @@ const (
eAry eAry
) )
var SupportNegativeIndices bool = true
var ArraySizeLimit int = 0
var ArraySizeAdditionLimit int = 0
type lazyNode struct { type lazyNode struct {
raw *json.RawMessage raw *json.RawMessage
doc partialDoc doc partialDoc
@ -61,6 +65,19 @@ func (n *lazyNode) UnmarshalJSON(data []byte) error {
return nil return nil
} }
func deepCopy(src *lazyNode) (*lazyNode, error) {
if src == nil {
return nil, nil
}
a, err := src.MarshalJSON()
if err != nil {
return nil, err
}
ra := make(json.RawMessage, len(a))
copy(ra, a)
return newLazyNode(&ra), nil
}
func (n *lazyNode) intoDoc() (*partialDoc, error) { func (n *lazyNode) intoDoc() (*partialDoc, error) {
if n.which == eDoc { if n.which == eDoc {
return &n.doc, nil return &n.doc, nil
@ -354,10 +371,19 @@ func (d *partialArray) set(key string, val *lazyNode) error {
} }
sz := len(*d) sz := len(*d)
if diff := idx + 1 - sz; ArraySizeAdditionLimit > 0 && diff > ArraySizeAdditionLimit {
return fmt.Errorf("Unable to increase the array size by %d, the limit is %d", diff, ArraySizeAdditionLimit)
}
if idx+1 > sz { if idx+1 > sz {
sz = idx + 1 sz = idx + 1
} }
if ArraySizeLimit > 0 && sz > ArraySizeLimit {
return fmt.Errorf("Unable to create array of size %d, limit is %d", sz, ArraySizeLimit)
}
ary := make([]*lazyNode, sz) ary := make([]*lazyNode, sz)
cur := *d cur := *d
@ -385,17 +411,29 @@ func (d *partialArray) add(key string, val *lazyNode) error {
return err return err
} }
ary := make([]*lazyNode, len(*d)+1) sz := len(*d) + 1
if ArraySizeLimit > 0 && sz > ArraySizeLimit {
return fmt.Errorf("Unable to create array of size %d, limit is %d", sz, ArraySizeLimit)
}
ary := make([]*lazyNode, sz)
cur := *d cur := *d
if idx < -len(ary) || idx >= len(ary) { if idx >= len(ary) {
return fmt.Errorf("Unable to access invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d", idx)
} }
if idx < 0 { if SupportNegativeIndices {
idx += len(ary) if idx < -len(ary) {
return fmt.Errorf("Unable to access invalid index: %d", idx)
}
if idx < 0 {
idx += len(ary)
}
} }
copy(ary[0:idx], cur[0:idx]) copy(ary[0:idx], cur[0:idx])
ary[idx] = val ary[idx] = val
copy(ary[idx+1:], cur[idx:]) copy(ary[idx+1:], cur[idx:])
@ -426,11 +464,18 @@ func (d *partialArray) remove(key string) error {
cur := *d cur := *d
if idx < -len(cur) || idx >= len(cur) { if idx >= len(cur) {
return fmt.Errorf("Unable to remove invalid index: %d", idx) return fmt.Errorf("Unable to access invalid index: %d", idx)
} }
if idx < 0 {
idx += len(cur) if SupportNegativeIndices {
if idx < -len(cur) {
return fmt.Errorf("Unable to access invalid index: %d", idx)
}
if idx < 0 {
idx += len(cur)
}
} }
ary := make([]*lazyNode, len(cur)-1) ary := make([]*lazyNode, len(cur)-1)
@ -567,7 +612,12 @@ func (p Patch) copy(doc *container, op operation) error {
return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path) return fmt.Errorf("jsonpatch copy operation does not apply: doc is missing destination path: %s", path)
} }
return con.set(key, val) valCopy, err := deepCopy(val)
if err != nil {
return err
}
return con.add(key, valCopy)
} }
// Equal indicates if 2 JSON documents have the same structural equality. // Equal indicates if 2 JSON documents have the same structural equality.