mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Implementation of HorizontalPodAutoscaler
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user