-
Feature Request
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
-
Future Sustainability
-
None
-
False
-
-
None
-
None
-
None
-
-
None
-
None
-
None
-
None
-
None
1. Proposed title of this feature request
Native oc cli out export to csv format
2. What is the nature and description of the request?
The current default output options for `oc` command are:
Command Line
# oc get networkpolicies --all-namespaces
NAMESPACE NAME POD-SELECTOR AGE test pg-allow-same-namespace <none> 5d test pgallow443 app=pghttpd 4d23h
JSON:
# oc get networkpolicies --all-namespaces -o json
{ "apiVersion": "v1", "items": [ { "apiVersion": "networking.k8s.io/v1", ...
YAML:
# oc get networkpolicies --all-namespaces -o yaml
apiVersion: v1 items: - apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: ...
Customer requests a native way to have the output in csv format. The customer is proposing to leverage tr to reformat the output to automatically output a csv format because using tr or go-templates is not a clean of a way to get the output:
# oc get networkpolicies --all-namespaces | tr -s '[:blank:]' ','
NAMESPACE,NAME,POD-SELECTOR,AGE test,pg-allow-same-namespace,<none>,5d test,pgallow443,app=pghttpd,4d23h # oc get pods | tr -s '[:blank:]' ',' NAME,READY,STATUS,RESTARTS,AGE tawon-operator-controller-manager-6bb788c567-phnm9,2/2,Terminating,4,(216d,ago),230d tawon-operator-controller-manager-6bb788c567-shlts,2/2,Running,0,22d tawon-streamstore-0,1/1,Running,0,230d
Customer would prefer a command like below that automatically creates displays the output like above: just a basic, normal, csv formatted output of the content that normally would be displayed. For example:
# oc get networkpolicies -o csv
# oc get pods -o csv
There was a request from four years ago for this functionality ( https://github.com/kubernetes/kubectl/issues/995), but it never went anywhere after being accepted because of https://github.com/kubernetes/kubernetes/pull/97562#pullrequestreview-587879433 .
3. Why does the customer need this? (List the business requirements here)
The customer wants this because they would like an approach that is a bit more intuitively that would work for different commands with different numbers of output fields would be nice.
"There are already the options for -o yaml and -o json, so a -o csv would hopefully not be too difficult."
4. List any affected packages or components.
oc-cli