From 1d6769d1ca8cd0c30415ca94a76909295ef1c962 Mon Sep 17 00:00:00 2001 From: SamyOubouaziz Date: Fri, 25 Oct 2024 16:39:11 +0200 Subject: [PATCH] docs(srv): add notes and troubleshooting on encoding secrets and env vars MTA-5183 --- ...ainer-from-external-container-registry.mdx | 3 +++ ...ainer-from-scaleway-container-registry.mdx | 3 +++ .../troubleshooting/common-errors.mdx | 19 ++++++++++++++++++- .../functions/how-to/create-a-function.mdx | 3 +++ .../troubleshooting/common-errors.mdx | 17 +++++++++++++++++ .../create-job-from-external-registry.mdx | 3 +++ .../create-job-from-scaleway-registry.mdx | 3 +++ .../jobs/troubleshooting/common-errors.mdx | 19 ++++++++++++++++++- 8 files changed, 68 insertions(+), 2 deletions(-) diff --git a/serverless/containers/how-to/deploy-a-container-from-external-container-registry.mdx b/serverless/containers/how-to/deploy-a-container-from-external-container-registry.mdx index 49b2041071..7f23fee3e2 100644 --- a/serverless/containers/how-to/deploy-a-container-from-external-container-registry.mdx +++ b/serverless/containers/how-to/deploy-a-container-from-external-container-registry.mdx @@ -48,6 +48,9 @@ For now, Serverless Containers only supports public images. - Set your [scaling](/serverless/containers/concepts/#scaling) preferences, or leave them at default values. The Scaleway platform autoscales the number of available instances of your container to match the incoming load, depending on the settings you define here. - Click **Advanced options** to define any [environment variables](/serverless/containers/concepts/#environment-variables) you want to inject into your container. For each environment variable, click **+Add variable** and enter the key/value pair. - Add [secrets](/serverless/containers/concepts/#secrets) for your container. Secrets are environment variables which are injected into your container, but the values are not retained or displayed by Scaleway after initial validation. + + Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns. + - Set the desired [privacy policy](/serverless/containers/concepts/#privacy-policy) for your container. This defines whether container invocation may be done anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/#authentication) (**private**). - Set a custom [timeout](/serverless/containers/concepts/#timeout) for your container. - Verify the **estimated cost**. diff --git a/serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry.mdx b/serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry.mdx index d195f6f20d..0c5fb5afd6 100644 --- a/serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry.mdx +++ b/serverless/containers/how-to/deploy-a-container-from-scaleway-container-registry.mdx @@ -42,6 +42,9 @@ You can deploy a container from the [Scaleway Container Registry](/containers/co - Set your [scaling](/serverless/containers/concepts/#scaling) preferences, or leave them at default values. The Scaleway platform autoscales the number of available instances of your container to match the incoming load, depending on the settings you define here. - Click **Advanced options** to define any [environment variables](/serverless/containers/concepts/#environment-variables) you want to inject into your container. For each environment variable, click **+Add variable** and enter the key/value pair. - Add [secrets](/serverless/containers/concepts/#secrets) for your container. Secrets are environment variables which are injected into your container, but the values are not retained or displayed by Scaleway after initial validation. + + Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns. + - Set the desired [privacy policy](/serverless/containers/concepts/#privacy-policy) for your container. This defines whether container invocation may be done anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/#authentication) (**private**). - Set a custom [timeout](/serverless/containers/concepts/#timeout) for your container. - Verify the **estimated cost**. diff --git a/serverless/containers/troubleshooting/common-errors.mdx b/serverless/containers/troubleshooting/common-errors.mdx index 4dc75d96f3..d2fe6930cc 100644 --- a/serverless/containers/troubleshooting/common-errors.mdx +++ b/serverless/containers/troubleshooting/common-errors.mdx @@ -65,4 +65,21 @@ Serverless products support external public registries (such as [Docker Hub](htt ### Solution -We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry). \ No newline at end of file +We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry). + +## My environment variable or secret is not properly injected in my container + +### Cause + +Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly. + +``` +"hello +world +. +" +``` + +### Solution + +To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`. \ No newline at end of file diff --git a/serverless/functions/how-to/create-a-function.mdx b/serverless/functions/how-to/create-a-function.mdx index c4070b4153..a99e6cdccc 100644 --- a/serverless/functions/how-to/create-a-function.mdx +++ b/serverless/functions/how-to/create-a-function.mdx @@ -41,6 +41,9 @@ This page shows you how to deploy a [function](/serverless/functions/concepts/#f 5. Click **+ Advanced options** and complete the following steps: - Define any **environment variables** you want to inject into your function. For each environment variable, click **+ Add variable** and enter the key/value pair. - Optionally, set secret environment variables. **Secrets** are environment variables which are injected into your function and stored securely, but not displayed in the console after initial validation. Add a **key** and a **value**. + + Encode your environment variables and secrets to `base64` if they are too large, and contain carriage returns. + - Set the desired **privacy policy** for your function. This defines whether a function can be executed anonymously (**public**) or only via an authentication mechanism provided by the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-functions/#authentication) (**private**). - Set the desired timeout for your function. diff --git a/serverless/functions/troubleshooting/common-errors.mdx b/serverless/functions/troubleshooting/common-errors.mdx index e308928d89..f72bfef40a 100644 --- a/serverless/functions/troubleshooting/common-errors.mdx +++ b/serverless/functions/troubleshooting/common-errors.mdx @@ -108,3 +108,20 @@ The new deploy failed, and the [fallback mechanism has been triggered](/serverle ### Possible solution Identify the element that caused the deployment to fail, fix the error, and deploy the function again. + +## My environment variable or secret is not properly injected in my function + +### Cause + +Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly. + +``` +"hello +world +. +" +``` + +### Solution + +To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`. diff --git a/serverless/jobs/how-to/create-job-from-external-registry.mdx b/serverless/jobs/how-to/create-job-from-external-registry.mdx index f3dd7d73ef..4cb5c8f9eb 100644 --- a/serverless/jobs/how-to/create-job-from-external-registry.mdx +++ b/serverless/jobs/how-to/create-job-from-external-registry.mdx @@ -39,6 +39,9 @@ Private external container registries are currently not supported. - Choose the **resources** to be allocated to your job at runtime. These define the performance characteristics of your job. - Optionally, add a **cron schedule** in the `* * * * *` format, and select your time zone to run your job periodically. Refer to the [cron schedules documentation](/serverless/jobs/reference-content/cron-schedules/) for more information. - Define any **environment variables** you want to inject into your job in the advanced options. For each environment variable, click **+Add new variable** and enter the key/value pair. + + Encode your environment variables to `base64` if they are too large, and contain carriage returns. + - Add a **startup command** to your job. It will be executed every time your job is run. - Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit. - Verify the **estimated cost**. diff --git a/serverless/jobs/how-to/create-job-from-scaleway-registry.mdx b/serverless/jobs/how-to/create-job-from-scaleway-registry.mdx index 58c6d3b043..27e1ac2a98 100644 --- a/serverless/jobs/how-to/create-job-from-scaleway-registry.mdx +++ b/serverless/jobs/how-to/create-job-from-scaleway-registry.mdx @@ -34,6 +34,9 @@ Scaleway's Serverless Jobs allows you to create jobs from several container [reg - Choose the **resources** to be allocated to your job at runtime. These define the performance characteristics of your job. - Add a **cron schedule** in the `* * * * *` format, and select your time zone to run your job periodically. Refer to the [cron schedules documentation](/serverless/jobs/reference-content/cron-schedules/) for more information. - Define any **environment variables** you want to inject into your job in the advanced options. For each environment variable, click **+Add new variable** and enter the key/value pair. + + Encode your environment variables to `base64` if they are too large, and contain carriage returns. + - Add a **startup command** to your job. It will be executed every time your job is run. - Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit. - Verify the **estimated cost**. diff --git a/serverless/jobs/troubleshooting/common-errors.mdx b/serverless/jobs/troubleshooting/common-errors.mdx index db3a79a95c..a6d923a3ce 100644 --- a/serverless/jobs/troubleshooting/common-errors.mdx +++ b/serverless/jobs/troubleshooting/common-errors.mdx @@ -29,4 +29,21 @@ Serverless products support external public registries (such as [Docker Hub](htt ### Solution -We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry). \ No newline at end of file +We recommend using [Scaleway's Container Registry](/containers/container-registry/) instead, as it allows for a seamless integration with Serverless Containers and Jobs at a [competitive price](/faq/containerregistry/#how-am-i-billed-for-scaleway-container-registry). + +## My environment variable or secret is not properly injected in my job + +### Cause + +Environment variables or secrets that are too large, contain carriage returns and spread over several lines, as shown below, will not be injected properly. + +``` +"hello +world +. +" +``` + +### Solution + +To avoid issues while injecting environment variables and secrets, we recommend encoding them to `base64`. \ No newline at end of file