diff --git a/gateway/handlers/create_handler.go b/gateway/handlers/create_handler.go index 31385da5..6e1236e5 100644 --- a/gateway/handlers/create_handler.go +++ b/gateway/handlers/create_handler.go @@ -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