mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 22:33:23 +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 {
|
} else {
|
||||||
constraints = linuxOnlyConstraints
|
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{
|
labels := map[string]string{
|
||||||
"com.openfaas.function": request.Service,
|
"com.openfaas.function": request.Service,
|
||||||
@ -129,6 +135,10 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
|||||||
Replicas: getMinReplicas(request),
|
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
|
// 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