First off, thank you for your contributions and making this framework available to the community!
I am trying to put together some sample functions and running into issues with docs and general pilot errors...
I would like to be able to version my docker images for my functions. It looks like images are being tagged as latest by default. I can not locate a good document that highlight the various tag available for the function.yaml. I thought this would be the place to indicate the docker image name and version.
Also I need to be able to specify env variables in the yaml. Is this possible?
My current understanding is that I can specify env vars using the deploy CLI but would like to set them
up in the function.yml.
I was hoping to be able to specify the following yaml config for my function
provider:
name: faas
gateway: ...
functions:
fred:
lang: go
handler: ./fred
image: fred
version: v1
labels:
app: fred
envs:
- name: MOVIE_DIC
value: v2
Use Case: I need to be able to deploy several versions of the same function in order to test and rate the best implementation.
docker version (e.g. Docker 17.0.05 ):Are you using Docker Swarm or Kubernetes (FaaS-netes)?
Kubenertes 1.9
Operating System and version (e.g. Linux, Windows, MacOS):
OSX
Link to your project or a code example to reproduce issue:
Please also follow the troubleshooting guide and paste in any other diagnostic information you have:
@derailed you can adjust the image value in the function.yml file to include the version of your image.
Also, you can specify environment variables in the yml file easily.
Here is an example that should answer both your questions:
provider:
name: faas
gateway: http://localhost:8080
functions:
fred:
lang: go
handler: ./fred
image: fred:1.0
labels:
app: fred
environment:
MOVIE_DIC: v2
@BurtonR - Thank you so much for the prompt reply! This helped a lot...
Are there any docs on the various settings available on this config file?
Also is it possible to deploy different versions of the image using the same function? ie the same service will front different pods using a different docker image revs?
Thank you!
@derailed Glad that helped out!
We're working on an official documentation site, but in the meantime, the .yml file is explained in the faas-cli repo here: https://github.com/openfaas/faas-cli#use-a-yaml-stack-file
As for different pods running different versions, you _could_, but they would need to be named differently. The gateway controls the execution of the functions and uses the function name as the dns. Generally, there is only one replica of the function, but it gets scaled up based on the metrics (which are configurable). In that case, it would be impossible to have 1 function with 2 versions deployed on the same stack.
Let me know if that helps and we can close this issue.
I'd say that's quite an accurate response from @BurtonR
If you need two versions of a function deployed at the same time I'd suggest doing them under two different names, each would get its own route and could be accessed independently with its own logs and metrics too.
Tools like Kong or Nginx can be used to hide both behind a single URL so you can switch.
You can also do rolling updates on your images so that if there is an issue deploying Kubernetes will roll back to the previous version.
@BurtonR @alexellis - Thank you both for the excellent support and clarifications!
This totally makes sense and I do see now why this 1-1 is crucial when dealing with functions in terms of replication, updates and monitoring.
I'll keep digging on my use cases and will report back. For now, you've answered my quest perfectly, so please close at your convenience.
Thank you both!!
Derek close: (Thanks @BurtonR )
Most helpful comment
Derek close: (Thanks @BurtonR )