Skip to content

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

Description

@whitmell

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:

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions