learn
Cadet
Cadet
  • 169 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
  • 53 Views

Re: Configuration data persistence

Jump to solution

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

Reply
Loading...
1 Reply
Vicente
Flight Engineer Flight Engineer
Flight Engineer
  • 54 Views

Re: Configuration data persistence

Jump to solution

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

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