Scenario - you are deploying your application, you added environment variables, secrets etc. How do you persist your changes so you do not have to type oc commands again?
By this time you probably now the answer already, but just in case...
oc commands have as a purpose to interact with the API server, imperatively.
The API server is responsible (among other tasks) for validating, storing and retrieving the configuration to/from etcd. This configuration would basically be stored in etcd as a declarative definition of how your deployed application should look like. You want to recover this final configuration.
Once you have deployed your application (that means, created all necessary resources in one or many namespaces), you can export all these as a list, so they can be redeployed whenever you need.
You would do that with the command: oc get -o yaml|json <list of resources you want to export>
whose output can be redirected to a file. I won't lie to you, it looks ugly and it might need some cleaning.
One step further would be to create a template using those resources. For that you could use: OpenShift Templates, Kustomize, Helm, Jinja2, etc ... That'd make the redeployment much easier.
By this time you probably now the answer already, but just in case...
oc commands have as a purpose to interact with the API server, imperatively.
The API server is responsible (among other tasks) for validating, storing and retrieving the configuration to/from etcd. This configuration would basically be stored in etcd as a declarative definition of how your deployed application should look like. You want to recover this final configuration.
Once you have deployed your application (that means, created all necessary resources in one or many namespaces), you can export all these as a list, so they can be redeployed whenever you need.
You would do that with the command: oc get -o yaml|json <list of resources you want to export>
whose output can be redirected to a file. I won't lie to you, it looks ugly and it might need some cleaning.
One step further would be to create a template using those resources. For that you could use: OpenShift Templates, Kustomize, Helm, Jinja2, etc ... That'd make the redeployment much easier.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.