Merge pull request #60445 from oracle/for/upstream/master/60444

Automatic merge from submit-queue (batch tested with PRs 63291, 63490, 60445, 63507, 63524). 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>.

Fixes fake client generation for non-namespaced subresources

**What this PR does / why we need it**:

Fixes code generation for non-namespaced subresources fake clients.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #60444

**Special notes for your reviewer**:

**Release note**:

```dev-release-note
Fixes fake client generation for non-namespaced subresources
```

/cc @mfojtik @liggitt

I'm not sure the best way to add tests for this. Any pointers?

Kubernetes-commit: 8203d35ea830b02a542c3099e302d58344a86305
This commit is contained in:
Kubernetes Publisher 2018-05-08 13:16:19 -07:00
commit e06cc6501b
2 changed files with 76 additions and 69 deletions

108
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{
"ImportPath": "k8s.io/client-go",
"GoVersion": "go1.9",
"GoVersion": "go1.10",
"GodepVersion": "v80",
"Packages": [
"./..."
@ -368,215 +368,215 @@
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "bd236513a4e35622d9007dff11eab07631645cd5"
"Rev": "b7d77fa220f5130ec63c2ca7167dd9653449c64d"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

View File

@ -58,6 +58,16 @@ func NewGetSubresourceAction(resource schema.GroupVersionResource, namespace, su
return action
}
func NewRootGetSubresourceAction(resource schema.GroupVersionResource, subresource, name string) GetActionImpl {
action := GetActionImpl{}
action.Verb = "get"
action.Resource = resource
action.Subresource = subresource
action.Name = name
return action
}
func NewRootListAction(resource schema.GroupVersionResource, kind schema.GroupVersionKind, opts interface{}) ListActionImpl {
action := ListActionImpl{}
action.Verb = "list"
@ -81,20 +91,6 @@ func NewListAction(resource schema.GroupVersionResource, kind schema.GroupVersio
return action
}
func NewListSubresourceAction(resource schema.GroupVersionResource, name, subresource string, kind schema.GroupVersionKind, namespace string, opts interface{}) ListActionImpl {
action := ListActionImpl{}
action.Verb = "list"
action.Resource = resource
action.Subresource = subresource
action.Kind = kind
action.Namespace = namespace
action.Name = name
labelSelector, fieldSelector, _ := ExtractFromListOptions(opts)
action.ListRestrictions = ListRestrictions{labelSelector, fieldSelector}
return action
}
func NewRootCreateAction(resource schema.GroupVersionResource, object runtime.Object) CreateActionImpl {
action := CreateActionImpl{}
action.Verb = "create"
@ -114,12 +110,23 @@ func NewCreateAction(resource schema.GroupVersionResource, namespace string, obj
return action
}
func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, namespace string, object runtime.Object) CreateActionImpl {
func NewRootCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource string, object runtime.Object) CreateActionImpl {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = resource
action.Subresource = subresource
action.Name = name
action.Object = object
return action
}
func NewCreateSubresourceAction(resource schema.GroupVersionResource, name, subresource, namespace string, object runtime.Object) CreateActionImpl {
action := CreateActionImpl{}
action.Verb = "create"
action.Resource = resource
action.Namespace = namespace
action.Subresource = subresource
action.Name = name
action.Object = object