Skip to content
Snippets Groups Projects
Commit dd6afb4b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent ed73d4f2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -403,6 +403,8 @@ to start again from scratch, there are a few steps that can help you:
 
mv /var/opt/gitlab/gitlab-rails/uploads /var/opt/gitlab/gitlab-rails/uploads.old
mkdir -p /var/opt/gitlab/gitlab-rails/uploads
gitlab-ctl start geo-postgresql
```
 
Reconfigure in order to recreate the folders and make sure permissions and ownership
Loading
Loading
Loading
Loading
@@ -341,8 +341,10 @@ project):
 
provider:
name: triggermesh
environment:
envs:
FOO: value
secrets:
- my-secrets
 
functions:
echo-js:
Loading
Loading
@@ -350,8 +352,10 @@ project):
source: ./echo-js
runtime: gitlab/runtimes/nodejs
description: "node.js runtime function"
environment:
envs:
MY_FUNCTION: echo-js
secrets:
- my-secrets
```
 
Explanation of the fields used above:
Loading
Loading
@@ -368,7 +372,8 @@ Explanation of the fields used above:
| Parameter | Description |
|-----------|-------------|
| `name` | Indicates which provider is used to execute the `serverless.yml` file. In this case, the TriggerMesh middleware. |
| `environment` | Includes the environment variables to be passed as part of function execution for **all** functions in the file, where `FOO` is the variable name and `BAR` are he variable contents. You may replace this with you own variables. |
| `envs` | Includes the environment variables to be passed as part of function execution for **all** functions in the file, where `FOO` is the variable name and `BAR` are he variable contents. You may replace this with you own variables. |
| `secrets` | Includes the contents of the Kubernetes secret as environment variables accessible to be passed as part of function execution for **all** functions in the file. The secrets are expected in ini format. |
 
### `functions`
 
Loading
Loading
@@ -381,7 +386,10 @@ subsequent lines contain the function attributes.
| `source` | Directory with sources of a functions. |
| `runtime` (optional)| The runtime to be used to execute the function. This can be a runtime alias (see [Runtime aliases](#runtime-aliases)), or it can be a full URL to a custom runtime repository. When the runtime is not specified, we assume that `Dockerfile` is present in the function directory specified by `source`. |
| `description` | A short description of the function. |
| `environment` | Sets an environment variable for the specific function only. |
| `envs` | Sets an environment variable for the specific function only. |
| `secrets` | Includes the contents of the Kubernetes secret as environment variables accessible to be passed as part of function execution for the specific function only. The secrets are expected in ini format. |
### Deployment
 
#### Runtime aliases
 
Loading
Loading
@@ -435,6 +443,33 @@ The sample function can now be triggered from any HTTP client using a simple `PO
 
![function execution](img/function-execution.png)
 
### Secrets
To access your Kubernetes secrets from within your function, the secrets should be created under the namespace of your serverless deployment.
#### CLI example
```bash
kubectl create secret generic my-secrets -n "$KUBE_NAMESPACE" --from-literal MY_SECRET=imverysecure
```
#### Part of deployment job
You can extend your `.gitlab-ci.yml` to create the secrets during deployment using the [environment variables](../../../../ci/variables/README.md)
stored securely under your GitLab project.
```yaml
deploy:function:
stage: deploy
environment: production
extends: .serverless:deploy:functions
before_script:
- kubectl create secret generic my-secret
--from-literal MY_SECRET="$GITLAB_SECRET_VARIABLE"
--namespace "$KUBE_NAMESPACE"
--dry-run -o yaml | kubectl apply -f -
```
### Running functions locally
 
Running a function locally is a good way to quickly verify behavior during development.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment