mirror of
https://github.com/openfaas/faas.git
synced 2025-06-20 13:06:40 +00:00
Add label support to Swarm
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -82,6 +82,12 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
||||
} else {
|
||||
constraints = linuxOnlyConstraints
|
||||
}
|
||||
labels := map[string]string{"function": "true"}
|
||||
if request.Labels != nil {
|
||||
for k, v := range request.Labels {
|
||||
labels[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
labels := map[string]string{
|
||||
"com.openfaas.function": request.Service,
|
||||
@ -129,6 +135,10 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
||||
Replicas: getMinReplicas(request),
|
||||
},
|
||||
},
|
||||
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