I had added a feature to get a custom message from hello-openshift by
using an environment variable. But when I documented it, I used oc
set env (which worked for me since I was using a dc to test, but with
a bare pod, it can not work). So, this changes the documentation to
show how to set an env in the pod definition, and how to make use of
it.
Fixes https://github.com/openshift/origin/issues/11093
| ... | ... |
@@ -11,8 +11,32 @@ This example will serve an HTTP response of "Hello OpenShift!". |
| 11 | 11 |
$ curl 10.1.0.2:8080 |
| 12 | 12 |
Hello OpenShift! |
| 13 | 13 |
|
| 14 |
-The response message can be set by using the RESPONSE environment variable: |
|
| 15 |
- $ oc set env pod/hello-openshift RESPONSE="Hello World!" |
|
| 14 |
+The response message can be set by using the RESPONSE environment |
|
| 15 |
+variable. You will need to edit the pod definition and add an |
|
| 16 |
+environment variable to the container definition and run the new pod. |
|
| 17 |
+To do this, edit hello-pod.json and add the following to the container |
|
| 18 |
+section. Just add the env clause after the image name so you end up with: |
|
| 19 |
+``` |
|
| 20 |
+ "containers": [ |
|
| 21 |
+ {
|
|
| 22 |
+ "name": "hello-openshift", |
|
| 23 |
+ "image": "openshift/hello-openshift", |
|
| 24 |
+ "env": [ |
|
| 25 |
+ { "name": "RESPONSE",
|
|
| 26 |
+ "value": "Hello World!" |
|
| 27 |
+ } |
|
| 28 |
+ ], |
|
| 29 |
+ ... |
|
| 30 |
+ } |
|
| 31 |
+ ], |
|
| 32 |
+``` |
|
| 33 |
+ |
|
| 34 |
+After that, if you are running the pod from above, delete it: |
|
| 35 |
+ |
|
| 36 |
+ $ oc delete pod hello-openshift |
|
| 37 |
+ |
|
| 38 |
+Then you can re-create the pod as with the first example, get the new IP |
|
| 39 |
+address, and then curl will show your new message: |
|
| 16 | 40 |
|
| 17 | 41 |
$ curl 10.1.0.2:8080 |
| 18 | 42 |
Hello World! |