Skip to content

Commit a118e59

Browse files
authored
Merge pull request kubernetes#81507 from eloyekunle/fix/scale-client
update scale client to support non-namespaced resources
2 parents 52a9f18 + fcd44b4 commit a118e59

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

staging/src/k8s.io/client-go/scale/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (c *namespacedScaleClient) Get(resource schema.GroupResource, name string)
150150

151151
result := c.client.clientBase.Get().
152152
AbsPath(path).
153-
Namespace(c.namespace).
153+
NamespaceIfScoped(c.namespace, c.namespace != "").
154154
Resource(gvr.Resource).
155155
Name(name).
156156
SubResource("scale").
@@ -191,7 +191,7 @@ func (c *namespacedScaleClient) Update(resource schema.GroupResource, scale *aut
191191

192192
result := c.client.clientBase.Put().
193193
AbsPath(path).
194-
Namespace(c.namespace).
194+
NamespaceIfScoped(c.namespace, c.namespace != "").
195195
Resource(gvr.Resource).
196196
Name(scale.Name).
197197
SubResource("scale").
@@ -211,7 +211,7 @@ func (c *namespacedScaleClient) Patch(gvr schema.GroupVersionResource, name stri
211211
groupVersion := gvr.GroupVersion()
212212
result := c.client.clientBase.Patch(pt).
213213
AbsPath(c.client.apiPathFor(groupVersion)).
214-
Namespace(c.namespace).
214+
NamespaceIfScoped(c.namespace, c.namespace != "").
215215
Resource(gvr.Resource).
216216
Name(name).
217217
SubResource("scale").

staging/src/k8s.io/client-go/scale/interfaces.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ import (
2323
)
2424

2525
// ScalesGetter can produce a ScaleInterface
26-
// for a particular namespace.
2726
type ScalesGetter interface {
27+
// Scales produces a ScaleInterface for a particular namespace.
28+
// Set namespace to the empty string for non-namespaced resources.
2829
Scales(namespace string) ScaleInterface
2930
}
3031

0 commit comments

Comments
 (0)