Commit a2ca4954 authored by Jerzy Szczepkowski's avatar Jerzy Szczepkowski

Fixed kind to resource convertion in scale client.

Fixed kind to resource convertion in scale client.
parent 2f9652c7
......@@ -17,9 +17,7 @@ limitations under the License.
package unversioned
import (
"fmt"
"strings"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/expapi"
)
......@@ -50,30 +48,21 @@ func newScales(c *ExperimentalClient, namespace string) *scales {
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
func (c *scales) Get(kind string, name string) (result *expapi.Scale, err error) {
result = &expapi.Scale{}
if strings.ToLower(kind) == "replicationcontroller" {
kind = "replicationControllers"
err = c.client.Get().Namespace(c.ns).Resource(kind).Name(name).SubResource("scale").Do().Into(result)
return
}
err = fmt.Errorf("Kind not supported: %s", kind)
resource, _ := meta.KindToResource(kind, false)
err = c.client.Get().Namespace(c.ns).Resource(resource).Name(name).SubResource("scale").Do().Into(result)
return
}
func (c *scales) Update(kind string, scale *expapi.Scale) (result *expapi.Scale, err error) {
result = &expapi.Scale{}
if strings.ToLower(kind) == "replicationcontroller" {
kind = "replicationControllers"
err = c.client.Put().
Namespace(scale.Namespace).
Resource(kind).
Name(scale.Name).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}
err = fmt.Errorf("Kind not supported: %s", kind)
resource, _ := meta.KindToResource(kind, false)
err = c.client.Put().
Namespace(scale.Namespace).
Resource(resource).
Name(scale.Name).
SubResource("scale").
Body(scale).
Do().
Into(result)
return
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment