cancel
Showing results for 
Search instead for 
Did you mean: 
learn
Cadet
Cadet
  • 1,490 Views

Configuration data persistence

Jump to solution

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?

Labels (1)
1 Solution

Accepted Solutions
Vicente
Flight Engineer Flight Engineer
Flight Engineer
  • 1,374 Views

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.

View solution in original post

1 Reply
Vicente
Flight Engineer Flight Engineer
Flight Engineer
  • 1,375 Views

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.

Join the discussion
You must log in to join this conversation.