fix UNCHANGE_REFERENCE to UNCHANGED_REFERENCE,and use you to replace we

Signed-off-by: Weiping Cai <weiping.cai@daocloud.io>
This commit is contained in:
Weiping Cai
2020-06-17 14:02:10 +08:00
parent 5513c60b54
commit 1253c3b39e
@@ -10,16 +10,12 @@ This page shows how to define dependent environment variables for a container
in a Kubernetes Pod. in a Kubernetes Pod.
## {{% heading "prerequisites" %}} ## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< include "task-tutorial-prereqs.md" >}}
<!-- steps --> <!-- steps -->
## Define an environment dependent variable for a container ## Define an environment dependent variable for a container
@@ -51,7 +47,7 @@ Pod:
dependent-envars-demo 1/1 Running 0 9s dependent-envars-demo 1/1 Running 0 9s
``` ```
3. Get log to the container running in your Pod: 3. Check the logs for the container running in your Pod:
```shell ```shell
kubectl logs pod/dependent-envars-demo kubectl logs pod/dependent-envars-demo
@@ -59,17 +55,17 @@ Pod:
``` ```
SERVICE_ADDRESS SERVICE_ADDRESS
https://172.17.0.1:80 https://172.17.0.1:80
UNCHANGE_REFERENCE UNCHANGED_REFERENCE
$(PROTOCOL)://172.17.0.1:80 $(PROTOCOL)://172.17.0.1:80
ESCAPED_REFERENCE ESCAPED_REFERENCE
$(PROTOCOL)://172.17.0.1:80 $(PROTOCOL)://172.17.0.1:80
``` ```
As shown above, we have defined the correct dependency reference of `SERVICE_ADDRESS`, bad dependency reference of `UNCHANGE_REFERENCE` and skip dependent references of `ESCAPED_REFERENCE`. As shown above, you have defined the correct dependency reference of `SERVICE_ADDRESS`, bad dependency reference of `UNCHANGED_REFERENCE` and skip dependent references of `ESCAPED_REFERENCE`.
When the environment variable is defined, you can use it directly. You can use it after the definition is completed, such as `SERVICE_ADDRESS`. When the environment variable is defined, you can use it directly. You can use it after the definition is completed, such as `SERVICE_ADDRESS`.
When the environment variable is undefined or only includes some variables, the undefined environment variable is treated as a normal string, such as `UNCHANGE_REFERENCE`. A bad reference does not interfere with the operation of the container. When the environment variable is undefined or only includes some variables, the undefined environment variable is treated as a normal string, such as `UNCHANGED_REFERENCE`. A bad reference does not interfere with the operation of the container.
The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME).Escaped references will never be expanded, regardless of whether the variable exists or not. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME).Escaped references will never be expanded, regardless of whether the variable exists or not.