mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 20:16:37 +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"}
|
labels := map[string]string{"function": "true"}
|
||||||
if request.Labels != nil {
|
if request.Labels != nil {
|
||||||
for k, v := range request.Labels {
|
for k, v := range *request.Labels {
|
||||||
labels[k] = v
|
labels[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,13 @@ func updateSpec(request *requests.CreateFunctionRequest, spec *swarm.ServiceSpec
|
|||||||
"function": "true",
|
"function": "true",
|
||||||
"uid": fmt.Sprintf("%d", time.Now().Nanosecond()),
|
"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.Networks = nets
|
||||||
spec.TaskTemplate.Placement = &swarm.Placement{
|
spec.TaskTemplate.Placement = &swarm.Placement{
|
||||||
Constraints: constraints,
|
Constraints: constraints,
|
||||||
|
Reference in New Issue
Block a user