Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you remove the deploymentConfig, image streams, etc using Openshift OC?

After creating a new app using oc new-app location/nameofapp, many things are created: a deploymentConfig, an imagestream, a service, etc. I know you can run oc delete <label>. I would like to know how to delete all of these given the label.

like image 621
coddiwomplefrog Avatar asked Aug 12 '16 20:08

coddiwomplefrog


People also ask

What is DeploymentConfig in OpenShift?

A DeploymentConfig or Deployment object, either of which describes the desired state of a particular component of the application as a pod template. DeploymentConfig objects involve one or more replication controllers, which contain a point-in-time record of the state of a deployment as a pod template.

What are OpenShift image streams?

An image stream and its associated tags provide an abstraction for referencing container images from within OpenShift Container Platform. The image stream and its tags allow you to see what images are available and ensure that you are using the specific image you need even if the image in the repository changes.


1 Answers

When using oc new-app, it would normally add a label on each resource created call app with value being the name given to the application. That name would be based on the name of the git repository, or could have been supplied using the --name option. Knowing that to delete everything you can then run:

oc delete all --selector app=appname

Before you delete anything you should be able to check what would matche by running:

oc get all --selector app=appname

Note that if creating from a template, rather than a repository, how things are labelled can depend on what the template itself sets up, so the instructions above may not apply.

like image 149
Graham Dumpleton Avatar answered Oct 01 '22 03:10

Graham Dumpleton