derailed / k9s

🐶 Kubernetes CLI To Manage Your Clusters In Style!
https://k9scli.io
Apache License 2.0
27.16k stars 1.7k forks source link

Stable sorting of Events created during the same second #2618

Open guettli opened 7 months ago

guettli commented 7 months ago


AFAIK Kubernetes Events have no sub-seconds. The precision is only "second".

Example yaml:

Name:             hetzner-apalla-1-27-custom.17bce7ee4bfffb72                                                                                                             
Namespace:        org-testing                                                                                                                                             
Labels:           <none>                                                                                                                                                  
Annotations:      <none>                                                                                                                                                  
API Version:      v1                                                                                                                                                      
Count:            1                                                                                                                                                       
Event Time:       <nil>                                                                                                                                                   
First Timestamp:  2024-03-15T10:02:49Z                                                                                                                                    
Involved Object:                                                                                                                                                          
  API Version:       clusterstack.x-k8s.io/v1alpha1                                                                                                                       
  Kind:              ClusterStack                                                                                                                                         
  Name:              hetzner-apalla-1-27-custom                                                                                                                           
  Namespace:         org-testing                                                                                                                                          
  Resource Version:  6542                                                                                                                                                 
  UID:               34900066-ca70-4fce-8a74-ce3c4db55432                                                                                                                 
Kind:                Event                                                                                                                                                
Last Timestamp:      2024-03-15T10:02:49Z                                                                                                                                 
Message:             Created ProviderClusterStackRelease hetzner-apalla-1-27-v0-sha-lmriayo                                                                               
Metadata:                                                                                                                                                                 
  Creation Timestamp:  2024-03-15T10:02:49Z                                                                                                                               
  Resource Version:    6565                                                                                                                                               
  UID:                 af538c73-e3a6-45dd-a0a3-1278521e0958                                                                                                               
Reason:                CreateProviderStackRelease                                                                                                                         
Reporting Component:   clusterstack-controller                                                                                                                            
Reporting Instance:                                                                                                                                                       
Source:                                                                                                                                                                   
  Component:  clusterstack-controller                                                                                                                                     
Type:         Normal                                                                                                                                                      
Events:       <none>

If I look at the events sorted by shift-L (last seen), I sometimes the events jumping up/down.

I guess this is happens because the sorting of events which got created during the same second are not stable.

Describe the solution you'd like

It would be great if k9s could sort these events in a way that the result is stable.

For example the second sort attribute could be uuid.

Describe alternatives you've considered

...

advnpzn commented 7 months ago

I've noticed the same mostly in multi container pods when I think about it now. But so far, I have not really felt like the order of events had significant negative impact. I have had like 5~6 containers in a single pod.

guettli commented 7 months ago

It confuses me, if I have k9s running on a second screen and the events seem to change, but they don't really change. It is just that the order of events changes. No big issue, but maybe someone has an idea how this can get fixed without much effort.