Hi, I'm very new to containers and openshift. I've been studying DO180. In chapter 7, the program is showing us how to "Deploying a Multi-container Application on OpenShift Using a Template".
When creating a new app with a template, it was shown that we process the template then we create the application as follow.
oc process -f templateFile | oc create -f -
However, we can just use oc new-app to create an application with the template
oc new-app -f templateFile
Then why do we use oc process and oc create?
Thank you in advance for you inputs :)
I'm sure someone will correct me if I'm wrong:
oc process -f templateFile | oc create -f -
oc process -f templateFile : This is likely is used because you previously obtained a template (by using oc get template and saving it to a YAML or JSON file) and you pass parameter(s) to it, using oc process -f templateFile -p <parameter>=<val>. This generates a list of resources to create a new application. (It is possible that you made changes to the YAML or JSON file directly.)
| oc create -f - : Pipe the output from the previous command into this one, which creates the application.
oc new-app -f templateFile : Create an application from an existing template; most likely one that you didn't need to directly modify or pass parameters to (although you can, with --param=<val>), so the first commands (oc process and oc create) wouldn't need to be done.
I'm sure someone will correct me if I'm wrong:
oc process -f templateFile | oc create -f -
oc process -f templateFile : This is likely is used because you previously obtained a template (by using oc get template and saving it to a YAML or JSON file) and you pass parameter(s) to it, using oc process -f templateFile -p <parameter>=<val>. This generates a list of resources to create a new application. (It is possible that you made changes to the YAML or JSON file directly.)
| oc create -f - : Pipe the output from the previous command into this one, which creates the application.
oc new-app -f templateFile : Create an application from an existing template; most likely one that you didn't need to directly modify or pass parameters to (although you can, with --param=<val>), so the first commands (oc process and oc create) wouldn't need to be done.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.