Code Monkey home page Code Monkey logo

fubectl's Issues

One improvement to kube_ctx_namespace

Hi all!

Looking for new ideas I found your project. It gave me some ones and I'd like to share my visions with you. Hope it will help you further.

fubectl/fubectl.source

Lines 80 to 85 in 3950b1e

# [kube_ctx_namespace] get current namespace
function kube_ctx_namespace() {
local default_ns="$(kubectl config view --minify|grep namespace: |sed 's/namespace: //g'|tr -d ' ')"
default_ns="${default_ns:-default}"
echo "$default_ns"
}

I think the snippet above can be improved a little bit in the way as below. It requires kubectl itself and its jsonpath features that have already been embedded.

kubectl config view --minify \
-o jsonpath="{range .contexts[*].context}{@.user}{\"@\"}{@.cluster}{\":\"}{@.namespace}{\"\n\"}"

It displays the current context in the form similar to the unix prompt like user@cluster:namespace. It's constructed to be used directly or as an alias. You can take it as is or modify on your wants or drop as a bad idea for your project :).

Regex parse Error

Hi,

I've done a fresh setup of fubectl. Everything is working fine, but when I do almost any command I get an regex parse error.

image

I suppose its a problem with my setup, but I don't know there exactly the error is coming from.

Any Ideas?

Thanks in advance for any help :)

kdes is not working

On Mac with zsh kdes is not working and giving below error. Which script mac user have to -- to -I or something like that ?

(⎈ |minikube:default)➜ hack git:(master) kdes po
xargs: illegal option -- r
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
[-L number] [-n number [-x]] [-P maxprocs] [-s size]
[utility [argument ...]]
(⎈ |minikube:default)➜ hack git:(master)

Missing documentation for many amazing commands

By grepping the source and comparing the README.md content.. I identified that below functions are not mentioned and documented in the README currently.

ka
kwa
kwatch
kcmd
kube_ctx_name
kube_ctx_namespace
kget
kexp
kget-exp
ked
kkonfig

Also we need to remove kdebug from the readme.md since it does not exist anymore in source.

Consider separate aliases for current NS and all NS

Hello

Currently many aliases are querying resources from all namespaces. In case of big cluster with dozens NS and dozens of pods in evey NS such frequent querying could affect cluster performance and also provide slow response time to end users.

I propose to introduce one of the following

  • config parameter (env var, file) that changes namespace filtering behaviour of all declared aliases
  • duplicate aliases to have 2 commands
    • klog for current namespace
    • kloga for all namespaces
    • For backward compatibility it could be klog for current behaviour (all NS) and klg for current NS

Wdyt ?

kadd / kdel zsh

There seems to be parsing issues on zsh with kadd and kdel functions:

fubectl.source:69: defining function based on alias `ked'
fubectl.source:69: parse error near `()'

when commented out those functions all is fine

default line number for klog -f

I would like to have default line number for klog -f so that I don't have to type in how many lines should be in the returned klog 200 -f

it would mirror the behaviour from tail and head as it says in the man page The default starting location is "-n 10", or the last 10 lines of the input

First release? Tag?

Could you create a first release or tag? I am looking into packaging this for openSUSE, so having tags/releases would be nice...

MicroK8s support

MicroK8S is Kubernetes Distribution from Canonical packaged as snap

Since MicroK8s uses proxy command (microk8s.kubectl get pods instead of kubectl get pods) this would require extracting kubectl command to own variable and maybe some logic like if kubectl bin isn't in $PATH then try microk8s.kubectl

I'm willing to submit pull request if this is found useful

Watch a specific namespace

kwall is really not helpful when trying to monitor a specific namespace, because there's too much information being displayed at once.

The objective here would be to focus on a namespace.

It's an enhancement, is it viable?

[proposal] adopt kubectx/kubens

Hello,

To manage context and namespace switching functionality - kubectx/kubens toolset could be used.
They could be installed via krew as other plugins used by fubectl.
fubectl could provide useful aliases like kctx / kns, current context / namespace functions would be deprecated.

Tools homepage: https://github.com/ahmetb/kubectx

Installation on macOS Catalina with oh-my-zsh

All prerequsite installed but during the installation I see the following output:

[ -f /Users/1/apps/fubectl/fubectl.source ] && source /Users/1/apps/fubectl/fubectl.source
/Users/1/apps/fubectl/fubectl.source:90: defining function based on alias `ked'
/Users/1/apps/fubectl/fubectl.source:90: parse error near `()'

implement kinstall for dependencies

To prevent errors with dependencies like e.g.

# [ktree] prints a tree of k8s objects (kubectl tree plugin needs to be installed)

we should implement:

  • check if the dependencies are there
  • kinstall command what installs the needed dependencies

kcs uses cluster name and not context name

hi,

when using kcs the code uses the name of the cluster as the context-name:

kcs() {
  context="$(kubectl config get-contexts | _inline_fzf | awk '{print $2}')"
  eval kubectl config set current-context "${context}"
}

$ kubectl config get-contexts
CURRENT   NAME           CLUSTER    AUTHINFO      NAMESPACE
          asterix-ns1    asterix    user1         ns1
*         obelix-ns1     obelix     user2         ns1
          obelix-ns2     obelix     user3         ns2
          minikube       minikube   minikube      

this only works, when the clustername and contextname are identical. if they are different, the configuration is corrupted. i think you should use print $1 for awk:

 context="$(kubectl config get-contexts | _inline_fzf | awk '{print $1}')"

Inclusion of stern/kail for multi pod logs?

Can we make use of stern / kail to monitor multiple logs at the same time?

We might need to build a thin wrapper to ask questions to user about how they want to tail logs - deployment or service or label etc... then logs can appear.

Vim issues with ked

Discovered the ked command introduced in fubectl but I currently cannot use it. Two (related) issues I have:

I run ked deploy and select one of my deployments to edit

zsh : kex bash command promote not valid in this context

zsh version 5.0.2
kex klog func not working

local command in zsh not identify string include space
for example: local val=$(echo "hello world"|awk '{print $1, $2}')
val equal to hello not hello world
i resolve it by double quote like this: "$(echo "hello world"|awk '{print $1, $2}') "

pod name not recognised by kubectl

Hi there, thanks for the great tool.

I have used it for the past year and recently started using it again on a new computer.

Now, whenever I use klog or kfor, it fails with the following error message:

error: expected 'logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]'.
POD or TYPE/NAME is a required argument for the logs command
See 'kubectl logs -h' for help and examples

Any idea why this could be?

Separating the namespace and pod name solves the issue:
kiwiidb@282bc63

kex not working as intented

kex sh error: expected 'exec POD_NAME COMMAND [ARG1] [ARG2] ... [ARGN]'. POD_NAME and COMMAND are required arguments for the exec command See 'kubectl exec -h' for help and examples.

ksearch error: unknown flag: --export

ksearch <smth>
error: unknown flag: --export
See 'kubectl get --help' for usage.

kubectl version --client
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

Some commands from README seem to be outdated

For example, kdebug is described in the project's README, however I can't see any mentions of this function in the current fubectl.source. (I haven't made a PR for this as I am not sure whether kdebug should actually exist for fubectl.)

At the same time, quite interesting commands including ked, ksec, and konsole are defined in the source file, however they are missing in the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.