Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve only names from oc get dc (openshift cli get deployment configurations)?

Tags:

openshift

Using the openshift cli ("oc") we can retrieve a list of deployment configurations within the current project with:

$/> oc get dc

I'd like to itereate over that list and query certain properties on the "oc describe [dcname]" for each deployment config.

What's a convenient way of doing that?

like image 596
Albino Cordeiro Avatar asked Nov 16 '25 21:11

Albino Cordeiro


1 Answers

You can get just the names by using:

oc get dc -o name

You may though also want to look at using -o template and provide a template spec to extract the various settings you want.

oc get dc -o template --template '{{range .items}}{{.metadata.name}},{{index .metadata.labels "app"}}{{"\n"}}{{end }}' 
like image 103
Graham Dumpleton Avatar answered Nov 18 '25 19:11

Graham Dumpleton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!