0

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?

Jon Gan
  • 867
  • 1
  • 11
  • 22

2 Answers2

1

I think the template is only used to create the related resource first time. Even though you modify the template, it's not associated with created resources. So you should recreate or modify each resource that is modified.

But you can modify simply all resources created by template using the following cmd.

# oc apply -f template_modified.yaml | oc replace -f -

I hope it help you

Daein Park
  • 4,393
  • 2
  • 12
  • 21
1

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.

Jon Gan
  • 867
  • 1
  • 11
  • 22