mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 12:36:40 +00:00
Label support for Update handler
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
@ -75,7 +75,7 @@ func makeSpec(request *requests.CreateFunctionRequest, maxRestarts uint64, resta
|
||||
}
|
||||
labels := map[string]string{"function": "true"}
|
||||
if request.Labels != nil {
|
||||
for k, v := range request.Labels {
|
||||
for k, v := range *request.Labels {
|
||||
labels[k] = v
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,13 @@ func updateSpec(request *requests.CreateFunctionRequest, spec *swarm.ServiceSpec
|
||||
"function": "true",
|
||||
"uid": fmt.Sprintf("%d", time.Now().Nanosecond()),
|
||||
}
|
||||
|
||||
if request.Labels != nil {
|
||||
for k, v := range *request.Labels {
|
||||
spec.TaskTemplate.ContainerSpec.Labels[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
spec.TaskTemplate.Networks = nets
|
||||
spec.TaskTemplate.Placement = &swarm.Placement{
|
||||
Constraints: constraints,
|
||||
|
Reference in New Issue
Block a user