Skip to content

Commit

Permalink
kele-list: Implement resource-specific columns for Pod and Namespace (#…
Browse files Browse the repository at this point in the history
…227)

Closes #226
  • Loading branch information
jinnovation authored Jun 14, 2024
1 parent 41ec1eb commit a2f87b7
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion kele.el
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,10 @@ Otherwise, simply `kele-get' the resource at point."
(defvar kele--list-columns
'((nil . (("Name" . (lambda (r)
(let-alist r .metadata.name)))
("Namespace" . (lambda (r) (let-alist r .metadata.namespace)))
("Namespace" . (lambda (r) (let-alist r
(if (not .metadata.namespace)
(propertize "N/A" 'face 'kele-disabled-face)
.metadata.namespace))))
("Created" . (lambda (r) (let-alist r .metadata.creationTimestamp)))
("Owner(s)" . (lambda (r)
(let-alist r
Expand All @@ -1711,6 +1714,23 @@ Otherwise, simply `kele-get' the resource at point."
"Multiple"
(let-alist (elt .metadata.ownerReferences 0)
(format "%s/%s" .kind .name)))))))))
(namespaces . (("Status" . (lambda (r) (let-alist r .status.phase)))))
(pods . (("Ready" . (lambda (r)
(let-alist r (format "%s/%s"
(->> .status.containerStatuses
(-map (lambda (status)
(alist-get 'ready status)))
(-non-nil)
(length))
(length .status.containerStatuses)))))
("Status" . (lambda (r)
(let-alist r .status.phase)))
("Restarts" . (lambda (r)
(let-alist r
(->> .status.containerStatuses
(-map (lambda (status)
(alist-get 'restartCount status)))
(-sum)))))))
(deployments . (("Ready" . (lambda (r)
(let-alist r (format "%s/%s" .status.readyReplicas .status.replicas))))
("Up-to-date" . (lambda (r)
Expand Down

0 comments on commit a2f87b7

Please sign in to comment.