From 33a2086f415bcc86e7d4ecd6e44e82958aedcb23 Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Wed, 24 Apr 2024 06:56:29 +0300 Subject: [PATCH] Fix readme --- README.md | 6 ++++-- kls | 12 +----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d83b212..1d7fd1e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # KLS + ## Description `kls` is a cli tool for managing kubernetes cluster resources. Inspired by `lf` and `ranger` file managers. It is lightweight and easy to customize + ## Key bindings for kubectl - `1` - get yaml of resource - `2` - describe resource @@ -12,13 +14,13 @@ It is lightweight and easy to customize You can customize these bindings or add extra bindings in `KEY_BINDINGS` variable of `kls` (in a row #4). -Also you can add additional columns for different api resources in `EXTRA_COLUMNS` variable (in a row #13). - ![kls in action](./images/kls.gif) + ## Dependencies - `python3` - `kubectl` - `batcat` + ## Installation Download latest `kls`: ``` diff --git a/kls b/kls index 1d695d9..f363c4f 100755 --- a/kls +++ b/kls @@ -10,15 +10,6 @@ KEY_BINDINGS = { # can be extended "KEY_DC": 'kubectl -n {namespace} delete {api_resource} {resource}' # delete key } -EXTRA_COLUMNS = { # By default, only the NAME column is displayed. Any api resource can be added here - "pods": ',STATUS:.status.phase,NODE:.spec.nodeName,AGE:.metadata.creationTimestamp', - "nodes": ',STATUS:.status.conditions[-1].type,CAPACITY_CPU:.status.capacity.cpu,CAPACITY_MEM:.status.capacity.memory', - "services": ',TYPE:.spec.type,CLUSTER_IP:.spec.clusterIP', - "ingresses": ',HOSTS:.spec.rules[*].host', - "deployments": ',DESIRED_REPLICAS:.spec.replicas,READY_REPLICAS:.status.readyReplicas', - "persistentvolumeclaims": ',SIZE:.spec.resources.requests.storage,STORAGE_CLASS:.spec.storageClassName' -} - TOP_API_RESOURCES = ["pods", "services", "ingresses", "secrets", "nodes", "deployments", "statefulsets", "daemonsets", "configmaps", "persistentvolumeclaims", "storageclasses"] # which api resources are on the top of menu? @@ -63,8 +54,7 @@ def draw_menu(menu: Menu): def update_menu3(): MENUS[2].rows = [] if namespace() and api_resource(): - columns = EXTRA_COLUMNS.get(api_resource(), "") - command = f"-n {namespace()} get {api_resource()} --no-headers -o custom-columns=NAME:.metadata.name{columns}" + command = f"-n {namespace()} get {api_resource()} --no-headers" MENUS[2].rows = kubectl(command) MENUS[2].filtered_row_index = 0 # reset the selected row index before redrawing draw_menu(MENUS[2])