Merge pull request #53781 from sttts/sttts-kill-pkg-api-util
Automatic merge from submit-queue (batch tested with PRs 47039, 53681, 53303, 53181, 53781). 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>. Get rid of pkg/api/util Old helpers we can replace with apimachinery tools.
This commit is contained in:
@@ -14,7 +14,6 @@ go_library(
|
||||
"validation.go",
|
||||
],
|
||||
deps = [
|
||||
"//pkg/api/util:go_default_library",
|
||||
"//pkg/kubectl/cmd/util/openapi:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library",
|
||||
|
@@ -24,7 +24,6 @@ import (
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
"k8s.io/apimachinery/pkg/util/json"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
apiutil "k8s.io/kubernetes/pkg/api/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
|
||||
)
|
||||
|
||||
@@ -112,8 +111,10 @@ func getObjectKind(object interface{}) (schema.GroupVersionKind, error) {
|
||||
if _, ok := apiVersion.(string); !ok {
|
||||
return schema.GroupVersionKind{}, errors.New("apiVersion isn't string type")
|
||||
}
|
||||
version := apiutil.GetVersion(apiVersion.(string))
|
||||
group := apiutil.GetGroup(apiVersion.(string))
|
||||
gv, err := schema.ParseGroupVersion(apiVersion.(string))
|
||||
if err != nil {
|
||||
return schema.GroupVersionKind{}, err
|
||||
}
|
||||
kind := fields["kind"]
|
||||
if kind == nil {
|
||||
return schema.GroupVersionKind{}, errors.New("kind not set")
|
||||
@@ -122,5 +123,5 @@ func getObjectKind(object interface{}) (schema.GroupVersionKind, error) {
|
||||
return schema.GroupVersionKind{}, errors.New("kind isn't string type")
|
||||
}
|
||||
|
||||
return schema.GroupVersionKind{Group: group, Version: version, Kind: kind.(string)}, nil
|
||||
return schema.GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: kind.(string)}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user