Skip to content

Commit 9ac88d5

Browse files
committed
Allow almost all printable ASCII characters in environment variables
1 parent bcb9863 commit 9ac88d5

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: RelaxedEnvironmentVariableValidation
3+
content_type: feature_gate
4+
_build:
5+
list: never
6+
render: false
7+
8+
stages:
9+
- stage: alpha
10+
defaultValue: false
11+
fromVersion: "1.30"
12+
---
13+
Allow almost all printable ASCII characters in environment variables.

content/en/docs/tasks/configure-pod-container/configure-pod-configmap.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,12 @@ section, and learn how to use these objects with Pods.
557557

558558
Now, the Pod's output includes environment variable `SPECIAL_LEVEL_KEY=very`.
559559

560+
{{< note >}}
561+
The range of characters allowed by env names is smaller than the range of characters allowed by configmap keys, it does not allow it to start with a number.
562+
after enable the `RelaxedEnvironmentVariableValidation` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/), the name of env allows a wider range of characters,
563+
then all configmap keys can be set to env names
564+
{{< /note >}}
565+
560566
### Define container environment variables with data from multiple ConfigMaps
561567

562568
As with the previous example, create the ConfigMaps first.

content/en/docs/tasks/inject-data-application/define-environment-variable-container.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ The `env` and `envFrom` fields have different effects.
3232
are set as environment variables for the container.
3333
You can also specify a common prefix string.
3434

35+
{{< note >}}
36+
The allowed character range of env name is within C_IDENTIFIER,
37+
after enable the `RelaxedEnvironmentVariableValidation` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/), the name of env allows a wider range of characters,
38+
all printable ASCII characters except "=" can be used in env names.
39+
{{< /note >}}
40+
3541
You can read more about [ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables)
3642
and [Secret](/docs/tasks/inject-data-application/distribute-credentials-secure/#configure-all-key-value-pairs-in-a-secret-as-container-environment-variables).
3743

@@ -41,7 +47,6 @@ In this exercise, you create a Pod that runs one container. The configuration
4147
file for the Pod defines an environment variable with name `DEMO_GREETING` and
4248
value `"Hello from the environment"`. Here is the configuration manifest for the
4349
Pod:
44-
4550
{{% code_sample file="pods/inject/envars.yaml" %}}
4651

4752
1. Create a Pod based on that manifest:

0 commit comments

Comments
 (0)