Merge pull request #81507 from eloyekunle/fix/scale-client

update scale client to support non-namespaced resources
This commit is contained in:
Kubernetes Prow Robot 2019-08-23 10:57:17 -07:00 committed by GitHub
commit a118e59912
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -150,7 +150,7 @@ func (c *namespacedScaleClient) Get(resource schema.GroupResource, name string)
result := c.client.clientBase.Get().
AbsPath(path).
Namespace(c.namespace).
NamespaceIfScoped(c.namespace, c.namespace != "").
Resource(gvr.Resource).
Name(name).
SubResource("scale").
@ -191,7 +191,7 @@ func (c *namespacedScaleClient) Update(resource schema.GroupResource, scale *aut
result := c.client.clientBase.Put().
AbsPath(path).
Namespace(c.namespace).
NamespaceIfScoped(c.namespace, c.namespace != "").
Resource(gvr.Resource).
Name(scale.Name).
SubResource("scale").
@ -211,7 +211,7 @@ func (c *namespacedScaleClient) Patch(gvr schema.GroupVersionResource, name stri
groupVersion := gvr.GroupVersion()
result := c.client.clientBase.Patch(pt).
AbsPath(c.client.apiPathFor(groupVersion)).
Namespace(c.namespace).
NamespaceIfScoped(c.namespace, c.namespace != "").
Resource(gvr.Resource).
Name(name).
SubResource("scale").

View File

@ -23,8 +23,9 @@ import (
)
// ScalesGetter can produce a ScaleInterface
// for a particular namespace.
type ScalesGetter interface {
// Scales produces a ScaleInterface for a particular namespace.
// Set namespace to the empty string for non-namespaced resources.
Scales(namespace string) ScaleInterface
}