Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faas-cli deploy needs to reset constraints array after each function deploy in stack YAML #218

Closed
ericstoekl opened this issue Nov 11, 2017 · 0 comments · Fixed by #219
Closed

Comments

@ericstoekl
Copy link
Contributor

Because the constraints array is not reset every time, you will have unintended functions in your stack YAML get constraints that were intended for only one function.

Consider this if statement:

if function.Constraints != nil {

Can be fixed by resetting the constraints array to nil if *function.Constraints is nil. Otherwise, it will set the constraints array in one iteration of the loop, then next iteration *functions.Constraints will be null, but constraints array will not be set back to nil, so the next function will also wrongly get the constraint applied.

Expected Behaviour

When only one function in the stack YAML has a constraint, only that function gets the constraint.

Current Behaviour

Other functions will inherit the constraint if they happen to get deployed after the function that has a constraint applied.

Possible Solution

Remove the if statement surrounding constraints = *function.Constraints. It should unconditionally set this variable.

Steps to Reproduce (for bugs)

  1. Set a constraint in your stack YAML like
functions:
  url-ping:
    lang: python
    handler: ./sample/url-ping
    image: alexellis/faas-url-ping
    constraints:
      - env=true

  ...

Make sure there are other functions in the stack YAML
2. fc deploy , and if there are functions that are deployed after url-ping, they will also have the constraint env=true applied.
3.
4.

Context

Testing out Node selector (openfaas/faas-netes#77), deploying with the faas-cli.

Your Environment

  • Docker version docker version (e.g. Docker 17.0.05 ):
    Docker version 1.12.6, build 78d1802

  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Kubernetes 1.8.2

  • Operating System and version (e.g. Linux, Windows, MacOS):
    ubuntu 1604 on ec2

  • Link to your project or a code example to reproduce issue:

alexellis added a commit that referenced this issue Nov 11, 2017
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
alexellis added a commit that referenced this issue Nov 11, 2017
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant