Add Swarm limits

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2017-11-12 19:26:54 +00:00
parent 9614b0b173
commit b17838ce51
9 changed files with 110 additions and 109 deletions

View File

@ -5,6 +5,7 @@ package requests
// CreateFunctionRequest create a function in the swarm.
type CreateFunctionRequest struct {
// Service corresponds to a Docker Service
Service string `json:"service"`
@ -34,30 +35,18 @@ type CreateFunctionRequest struct {
// Labels are metadata for functions which may be used by the
// back-end for making scheduling or routing decisions
Labels *map[string]string `json:"labels"`
// Limits for function
Limits *FunctionResources `json:"limits"`
// Requests of resources requested by function
Requests *FunctionResources `json:"requests"`
}
// DeleteFunctionRequest delete a deployed function
type DeleteFunctionRequest struct {
FunctionName string `json:"functionName"`
}
// PrometheusInnerAlertLabel PrometheusInnerAlertLabel
type PrometheusInnerAlertLabel struct {
AlertName string `json:"alertname"`
FunctionName string `json:"function_name"`
}
// PrometheusInnerAlert PrometheusInnerAlert
type PrometheusInnerAlert struct {
Status string `json:"status"`
Labels PrometheusInnerAlertLabel `json:"labels"`
}
// PrometheusAlert as produced by AlertManager
type PrometheusAlert struct {
Status string `json:"status"`
Receiver string `json:"receiver"`
Alerts []PrometheusInnerAlert `json:"alerts"`
// FunctionResources Memory and CPU
type FunctionResources struct {
Memory string `json:"memory"`
CPU string `json:"cpu"`
}
// Function exported for system/functions endpoint
@ -79,3 +68,8 @@ type AsyncReport struct {
StatusCode int `json:"statusCode"`
TimeTaken float64 `json:"timeTaken"`
}
// DeleteFunctionRequest delete a deployed function
type DeleteFunctionRequest struct {
FunctionName string `json:"functionName"`
}