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 ac93b42 commit 3f36b8c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
53 changes: 53 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [List Deployments](#list-deployments)
- [Get Deployment](#get-deployment)
- [Delete Deployment](#delete-deployment)
- [Create Autoscaler](#create-autoscaler)
- [Service](#service)
- [Create Service](#create-service)
- [Create Service by Uploading YAML](#create-service-by-uploading-yaml)
Expand Down Expand Up @@ -1072,6 +1073,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 3f36b8c

Please sign in to comment.