Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFE] Add PAUSED column to the omc get mcp output #141

Open
oarribas opened this issue Mar 5, 2024 · 4 comments
Open

[RFE] Add PAUSED column to the omc get mcp output #141

oarribas opened this issue Mar 5, 2024 · 4 comments
Assignees

Comments

@oarribas
Copy link

oarribas commented Mar 5, 2024

Info about if an MCP is paused is useful, and the info could be added to the omc get mcp output for easily show that.

@vlours
Copy link

vlours commented Mar 7, 2024

Hi @oarribas

If this feature is added to the oc command, then we should have it.
Otherwise, I don't think that there is a need to show it by default and change the output from what is displayed by the oc command.
If you want to assess a cluster status quickly and even need to focus on some specific component, I will suggest to check on my script mg_cluster_status, as it may help you to get a overview of a cluster health easily.

Cheers,
Vincent

@oarribas
Copy link
Author

oarribas commented Mar 8, 2024

Hi @vlours,

omc already have features not included in the oc command, and as it's a tool used for detecting issues in a cluster, I think an additional column for that command could be helpful, even if there are other tools for more advanced troubleshooting like mg_cluster_status [1], etcd-tools [2] or insights [3].

[1] https://github.com/vlours/mg_cluster_status/tree/main
[2] https://github.com/peterducai/etcd-tools/
[3] https://github.com/RedHatInsights/insights-core

@cchen666
Copy link
Contributor

cchen666 commented Apr 1, 2024

@oarribas @vlours

As far as I can check, the omc uses CRD's spec.additionalPrinterColumns to print the columns:

for _, column := range vars.CRD.Spec.Versions[i].AdditionalPrinterColumns {

So if this RFE needs to be implemented, some exceptional check needs to be done to the omc, which needs lots of work.

At the same time, how about this ugly workaround? The user could customize whatever columns they want because omc also supports custom-columns. The only issue is, custom-columns can not automatically convert creationTimestamp to the duration of time but that shouldn't be a big problem and you could play with how to convert creationTimestamp to duration on your own way.

You could put this sample script under whatever your bashrc file:

omc() {
    if [[ $1 == "get" && $2 == "mcp" && $# -le 3 ]]; then
        command omc "$@" -o custom-columns=NAME:.metadata.name,CONFIG:.status.configuration.name,PAUSED:.spec.paused,UPDATED:".status.conditions[?(@.type=='Updated')].status",UPDATING:".status.conditions[?(@.type=='Updating')].status",DEGRADED:".status.conditions[?(@.type=='Degraded')].status",MACHINECOUNT:.status.machineCount,READYMACHINECOUNT:.status.readyMachineCount,UPDATEDMACHINECOUNT:.status.updatedMachineCount,DEGRADEDMACHINECOUNT:.status.degradedMachineCount,AGE:.metadata.creationTimestamp
    else
        command omc "$@"
    fi
}
$ omc get mcp
NAME         CONFIG                                                 PAUSED   UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE
master       rendered-master-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       false    True      False      False      3              3                   3                     0                      2024-01-29TXX:XX:20Z
worker       rendered-worker-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX       false    True      False      False      0              0                   0                     0                      2024-01-29TXX:XX:20Z

@gmeghnag gmeghnag self-assigned this Apr 26, 2024
@gmeghnag
Copy link
Owner

gmeghnag commented Apr 26, 2024

As @cchen666 mentioned omc uses CRD yaml files to get the column to print for custom resources, and I don't want to go away from this code architecture.

Still, I understand that it would be nice to have also other information printed for some resources based on our needs, so I came up with the idea to allow setting alternative columns definitions for resources and a different flag to print them, i.e. -o alter. I created this RFE to track the code development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants