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

[Feature Request] Ability to add annotations and environment variables to custom templates #904

Open
1 of 2 tasks
whitmell opened this issue Nov 15, 2021 · 2 comments
Open
1 of 2 tasks

Comments

@whitmell
Copy link

whitmell commented Nov 15, 2021

Looking for a way to define annotations and environment variables in a function template that will be added to the generated function's YAML file.

Expected Behaviour

Possibly add annotations and environment sections to template.yml that will be added to < function >.yml on "faas-cli new"

Current Behaviour

Currently not possible.

Are you a GitHub Sponsor (Yes/No?)

Formerly, not currently.

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

Possible solution: Add sections to template.yml that will be added to < function >.yml in new_function.prepareYamlContent()

Which Solution Do You Recommend?

See above

Steps to Reproduce (for bugs)

Context

The goal of this feature would be to allow a function template to define annotations and environment variables that would be appended to the generated function yaml. Specifically I am creating a set of functions with an annotation used for injecting a sidecar container; ideally I could use a custom template that will ensure new functions created from my template would have that annotation added to their function yaml on creation.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
    CLI:
    commit: 598336a
    version: 0.12.21

Gateway
uri: https://
version: 0.20.12
sha: a6dbb4cd0285f6dbc0bc3f43f72ceacdbdf6f227
commit: See GitHub for latest changes

Provider
name: faas-netes
orchestration: kubernetes
version: 0.13.4
sha: 6f34f27a2405798b5ee2846f1654bc7754991920

  • Docker version ( Full output from: docker version ):
    Client: Docker Engine - Community
    Version: 19.03.13
    API version: 1.40
    Go version: go1.13.15
    Git commit: 4484c46d9d
    Built: Wed Sep 16 17:02:52 2020
    OS/Arch: linux/amd64
    Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.7
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: b0f5bc3
Built: Wed Jun 2 11:54:58 2021
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.4.6
GitCommit: d71fcd7d8303cbf684402823e425e9dd2e99285d
runc:
Version: 1.0.0-rc95
GitCommit: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
docker-init:
Version: 0.19.0
GitCommit: de40ad0

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

  • Operating System and version (e.g. Linux, Windows, MacOS):
    Windows 10, WSL 2 running Ubuntu 20.04

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

@alexellis
Copy link
Member

Under context can you write the specific thing you’re trying to do? I.e. what you shared on slack

@alexellis
Copy link
Member

alexellis commented Nov 16, 2021

Whit Matthews 14 hours ago
I've created a sidecar API for use by functions generated from a custom template. I have a sidecar injector on my kubernetes cluster and when it sees a certain annotation it'll add the sidecar into the function pod. It works fine if I manually put the annotation in the function yaml, but I'd like my template to have that annotation in any new functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants