Matt
Matt

Reputation: 2681

How to execute an "oc get" command and return only resources created after a certain date?

I have the following command, which will return all resources in a given Openshift namespace and sort them by creation time. I'm looking for a way to return ONLY the resources created after a certain time. I am not sure if this is possible so I've also been exploring jq but haven't found anything yet.

Does anyone know if this is possible?

oc get $(oc api-resources --namespaced=true --verbs=list -o name | awk '{printf "%s%s",sep,$0;sep=","}')  --ignore-not-found -n ${namespace} -o=custom-columns=KIND:.kind,NAME:.metadata.name,CREATED:.metadata.creationTimestamp --sort-by='.metadata.creationTimestamp' | grep -Ev 'EndpointSlice|Event|PackageManifest|Lease|PodMetrics'

Upvotes: 0

Views: 30

Answers (0)

Related Questions