Serverless secrets

Description

When you deploy your serverless application / function to a cluster, you sometimes depend on an environment variable or a secret variable being passed to the Knative service, whether it is a function or an application.

Currently there is no good way to pass variables from GitLab to a function / application.

Proposal

Make it possible to pass environment variables and secret environment variables to a service. Use Serverless Framework Style to do it.

service: functions
description: "GitLab Serverless Demo"

provider:
  name: triggermesh
  environment:
    MY_DATA: explicit-value
    MY_ENV: ${env(MY_ENV)}
  secrets:
    variables:
      MY_SECRET_ENV: ${env(MY_SECRET)}
    files:
      path/to/file.key: ${env(MY_SECRET)}: 
      remote/file.key: ${file(local/file.key)}

  echo:
    handler: MyEcho.my_function
    source: echo-rb/
    runtime: https://gitlab.com/gitlab-org/serverless/runtimes/ruby
    description: "echo function using Ruby runtime"
    # the same format of environment / secrets here

Inspired by @williamchia's work on deploying serverless function to AWS Lambda using Serverless Framework.

Syntax inspired by https://serverless.com/framework/docs/providers/aws/guide/variables/

/cc @danielgruesso @DylanGriffith @williamchia

Edited by Grzegorz Bizon