Merge pull request #55650 from smarterclayton/make_unstructured_conversion

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move unstructured conversion into pkg/runtime

Scheme conversion should support unstructured conversion natively to
allow going from unstructured to typed and back. It is not a higher
level responsibility to do that conversion because the scheme is the
only one who knows what types it supports.

@liggitt @kubernetes/sig-cli-api-reviews I am going to make Scheme support unstructured in ConvertToVersion and Convert, which means resource.Builder and the CLI can get simpler for all existing use cases where versioned and unstructured need to coexist.

Kubernetes-commit: a67abac7654cc3e05618d41191d71730cf9565ac
This commit is contained in:
Kubernetes Publisher 2017-11-18 08:47:10 -08:00
commit a9b11fb1b4
2 changed files with 705 additions and 727 deletions

164
Godeps/Godeps.json generated
View File

@ -372,327 +372,323 @@
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1", "ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1", "ImportPath": "k8s.io/api/apps/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta1", "ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta2", "ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1", "ImportPath": "k8s.io/api/authentication/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1beta1", "ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1", "ImportPath": "k8s.io/api/authorization/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1beta1", "ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v1", "ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta1", "ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1", "ImportPath": "k8s.io/api/batch/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1beta1", "ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v2alpha1", "ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/certificates/v1beta1", "ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/core/v1", "ImportPath": "k8s.io/api/core/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/extensions/v1beta1", "ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1", "ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/networking/v1", "ImportPath": "k8s.io/api/networking/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/policy/v1beta1", "ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1", "ImportPath": "k8s.io/api/rbac/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1alpha1", "ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1beta1", "ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1alpha1", "ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/settings/v1alpha1", "ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1", "ImportPath": "k8s.io/api/storage/v1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1alpha1", "ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1beta1", "ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "42558894029e0453e560ff39f84da83a3b673b5a" "Rev": "2de4f10de999ef5b857c77223949ff104db5e9dd"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing", "ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered", "ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/unstructured",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy", "ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand", "ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "cce56d3a154c7e0dd7a79092ce825f8d3b5ec2e1" "Rev": "8d2e26d0cd42a060b527f3c91ebea1015959008e"
}, },
{ {
"ImportPath": "k8s.io/kube-openapi/pkg/common", "ImportPath": "k8s.io/kube-openapi/pkg/common",

View File

@ -49,28 +49,22 @@ func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *Unstructur
return dot return dot
} }
// ObjectKind returns the group,version,kind of the provided object, or an error
// if the object in not runtime.Unstructured or has no group,version,kind
// information.
func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (schema.GroupVersionKind, error) {
if _, ok := obj.(runtime.Unstructured); !ok {
return schema.GroupVersionKind{}, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
}
return obj.GetObjectKind().GroupVersionKind(), nil
}
// ObjectKinds returns a slice of one element with the group,version,kind of the // ObjectKinds returns a slice of one element with the group,version,kind of the
// provided object, or an error if the object is not runtime.Unstructured or // provided object, or an error if the object is not runtime.Unstructured or
// has no group,version,kind information. unversionedType will always be false // has no group,version,kind information. unversionedType will always be false
// because runtime.Unstructured object should always have group,version,kind // because runtime.Unstructured object should always have group,version,kind
// information set. // information set.
func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []schema.GroupVersionKind, unversionedType bool, err error) { func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []schema.GroupVersionKind, unversionedType bool, err error) {
gvk, err := d.ObjectKind(obj) if _, ok := obj.(runtime.Unstructured); !ok {
if err != nil { return nil, false, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
return nil, false, err }
gvk := obj.GetObjectKind().GroupVersionKind()
if len(gvk.Kind) == 0 {
return nil, false, runtime.NewMissingKindErr("unstructured object has no kind")
}
if len(gvk.Version) == 0 {
return nil, false, runtime.NewMissingVersionErr("unstructured object has no version")
} }
return []schema.GroupVersionKind{gvk}, false, nil return []schema.GroupVersionKind{gvk}, false, nil
} }
@ -80,16 +74,4 @@ func (d *UnstructuredObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
return d.registered[gvk] return d.registered[gvk]
} }
// IsUnversioned returns false always because runtime.Unstructured objects
// should always have group,version,kind information set. ok will be true if the
// object's group,version,kind is api.Registry.
func (d *UnstructuredObjectTyper) IsUnversioned(obj runtime.Object) (unversioned bool, ok bool) {
gvk, err := d.ObjectKind(obj)
if err != nil {
return false, false
}
return false, d.registered[gvk]
}
var _ runtime.ObjectTyper = &UnstructuredObjectTyper{} var _ runtime.ObjectTyper = &UnstructuredObjectTyper{}