openshifts2i

Apply changes dynamically when OpenShift template is modified (and applied)


I defined a template (let's call it template.yaml) with a service, deploymentconfig, buildconfig and imagestream, applied it with oc apply -f template.yaml and ran oc new-app app-name to create new app from the template. What the app basically does is to build a Node.js application with S2I, write it to a new ImageStream and deploy it to a pod with the necessary service exposed.

Now I've decided to make some changes to the template and have applied it on OpenShift. How do I go about ensuring that all resources in the said template also get reconfigured without having to delete all resources associated with that template and recreating it again?


Solution

  • The correct command turned out to be:

    $ oc apply -f template_modified.yaml 
    $ oc process -f template_modified.yaml | oc replace -f -
    

    That worked for me on OpenShift 3.9.