Implementation of HorizontalPodAutoscaler

This commit is contained in:
Marcin Wielgus
2015-08-25 19:16:47 +02:00
parent 4d10def14f
commit df0a0ed37e
6 changed files with 352 additions and 30 deletions

View File

@@ -30,6 +30,7 @@ type ScaleNamespacer interface {
// ScaleInterface has methods to work with Scale (sub)resources.
type ScaleInterface interface {
Get(string, string) (*expapi.Scale, error)
Update(string, *expapi.Scale) (*expapi.Scale, error)
}
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
@@ -57,3 +58,22 @@ func (c *scales) Get(kind string, name string) (result *expapi.Scale, err error)
err = fmt.Errorf("Kind not supported: %s", kind)
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)
return
}