Open LucasRoesler opened 6 years ago
I think this is fixed now. Please can you take a look at the code and verify?
I think it is still an issue, this is the relevant block on the current master
https://github.com/openfaas/faas-netes/blob/d2a9878e8bf31f12290389f6a7bdc913f8ca0718/handlers/deploy.go#L139-L150
Any internal labels should probably be defined as constants and should be set after we process the labels in the request, L140 in particular needs to occur after L150.
@alexellis i have added a PR with what I think the required change is
Currently we use the
faas_function
label as a selector in the Deployment of a function. But while debugging an issue with the selector, I noticed that we currently write all user supplied labels into the map that we supply to Kubernetes.Specifically, it looks like this
With this commit afdf2fc we explicitly require that the
faas_function
label equal the service name. If the user submits a different value forfaas_function
, it will break the deployment selector.Expected Behaviour
The
faas_function
label should be strictly controlled by thefaas
system.Current Behaviour
The value can be overridden by the user.
Possible Solution
We either need to skip select labels while processing the user input or we need to ensure that we set the important internal labels after we have process the user labels.
Steps to Reproduce (for bugs)
bar
and add the labelfaas_function: foo
Unexpected status: 500, message: Deployment.apps "testsecretapi" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"faas_function":"foo"}:
selector
does not match templatelabels
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:21:50Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.6", GitCommit:"9f8ebd171479bec0ada837d7ee641dec2f8c6dd1", GitTreeState:"clean", BuildDate:"2018-03-21T15:13:31Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}