Openshift CLI - update Application with template and oc new-app
As Graham pointed out the best way to solve this is to use
oc process -f openshift/template.yaml -p PARAM1=VALUE1 -p PARAM2=VALUE2
to first fill your template with your parameters. Then pipe the command to oc apply to apply it to the application which will leave you with the following command
oc process -f openshift/template.yaml -p PARAM1=VALUE1 -p PARAM2=VALUE2 | oc apply -f -
This will create or update all your configs. It will also check which configs have been changed.
If you want to start the build directly afterwards use
oc start-build my-app
To update a template parameter in a running pod which was started from a template YAML file (i.e. with oc create -f ./$tmpl_name.yaml
):
# delete existing dc (leaving svc & route)# (here dc and template are named the same: $tmpl_name)oc delete dc $tmpl_name # update template parameter (notice template was not deleted)oc process $tmpl_name -p $PARAM_NAME=$PARAM_VALUE | oc create -f -