Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Lin committed Sep 28, 2018
1 parent 43a2d17 commit 715b8a1
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
53 changes: 52 additions & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
- [Monitor Controllers](#monitor-controllers)
- [Monitor Certain Controller](#monitor-certain-controller)


## User

### Signup
Expand Down Expand Up @@ -1078,6 +1077,58 @@ Response Data:
}
```

### Update Autoscaler

`ResourceName` in json can only be "cpu" or "memory".
`ScaleTargetRefName` is the target kubernetes deployment name

Enable autoscaler

**PUT /v1/deployments/autoscale?enable=true**

Example:

```
curl -X PUT http://localhost:7890/v1/deployments/autoscale?enable=true
```

Request Data:

```json
{
"Namespace": "default",
"ScaleTargetRefName": "testDeploymentName",
"ResourceName": "cpu",
"MinReplicas": 1,
"MaxReplicas": 5,
"TargetAverageUtilization": 30
}
```

Disable autoscaler

**PUT /v1/deployments/autoscale?enable=false**

Example:

```
curl -X PUT http://localhost:7890/v1/deployments/autoscale?enable=false
```

Request Data:

```json
{
"Namespace": "default",
"ScaleTargetRefName": "testDeploymentName",
"ResourceName": "cpu",
"MinReplicas": 0,
"MaxReplicas": 0,
"TargetAverageUtilization": 0
}
```


## Service

### Create Service
Expand Down
3 changes: 2 additions & 1 deletion src/server/handler_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ func updateAutoscalerHandler(ctx *web.Context) {
response.BadRequest(req.Request, resp.ResponseWriter, err)
return
}

// force set autoscaler to deployment name
autoscalerInfo.Name = autoscalerInfo.ScaleTargetRefName
if err := sp.Validator.Struct(autoscalerInfo); err != nil {
response.BadRequest(req.Request, resp.ResponseWriter, err)
return
Expand Down

0 comments on commit 715b8a1

Please sign in to comment.