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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With