mirror of
https://github.com/openfaas/faas.git
synced 2025-06-22 14:53:25 +00:00
Return labels in functions list endpoint
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -73,18 +73,30 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
||||
} else {
|
||||
constraints = linuxOnlyConstraints
|
||||
}
|
||||
labels := map[string]string{"function": "true"}
|
||||
|
||||
labels := map[string]string{
|
||||
"com.openfaas.function": request.Service,
|
||||
"function": "true", // backwards-compatible
|
||||
}
|
||||
|
||||
if request.Labels != nil {
|
||||
for k, v := range *request.Labels {
|
||||
labels[k] = v
|
||||
}
|
||||
}
|
||||
fmt.Println(labels)
|
||||
|
||||
nets := []swarm.NetworkAttachmentConfig{
|
||||
{Target: request.Network},
|
||||
{
|
||||
Target: request.Network,
|
||||
},
|
||||
}
|
||||
|
||||
spec := swarm.ServiceSpec{
|
||||
Annotations: swarm.Annotations{
|
||||
Name: request.Service,
|
||||
Labels: labels,
|
||||
},
|
||||
TaskTemplate: swarm.TaskSpec{
|
||||
RestartPolicy: &swarm.RestartPolicy{
|
||||
MaxAttempts: &maxRestarts,
|
||||
@ -100,10 +112,6 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
||||
Constraints: constraints,
|
||||
},
|
||||
},
|
||||
Annotations: swarm.Annotations{
|
||||
Name: request.Service,
|
||||
Labels: labels,
|
||||
},
|
||||
}
|
||||
|
||||
// TODO: request.EnvProcess should only be set if it's not nil, otherwise we override anything in the Docker image already
|
||||
|
Reference in New Issue
Block a user