diff options
-rw-r--r-- | doc/administration/geo/replication/troubleshooting.md | 2 | ||||
-rw-r--r-- | doc/user/project/clusters/serverless/index.md | 43 |
2 files changed, 41 insertions, 4 deletions
diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 351489cb9f6..0a2602261d1 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -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 diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index 529c3d9d141..55bce10a49d 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -341,8 +341,10 @@ project): provider: name: triggermesh - environment: + envs: FOO: value + secrets: + - my-secrets functions: echo-js: @@ -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: @@ -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` @@ -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 @@ -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. |