Coder Social home page Coder Social logo

kubesess's Introduction

Anurag's GitHub stats

๐Ÿ˜‚ Here is a random joke!

Jokes Card

kubesess's People

Contributors

b4nst avatar morozov avatar nicmr avatar ramilito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubesess's Issues

Windows support

Describe the bug

Windows uses a different default kubeconfig path while we are using only the linux/mac ones.

Expected behavior

Should work on windows

Screenshots

image

Release on brew

Is your feature request related to a problem? Please describe.

I want to use homebrew to download

Describe the solution you'd like

want to be able to run the command brew install kubesess

Describe alternatives you've considered

Adding arm binary to releases helps a bit

Additional context

image

  • Upload formula
  • Make it a bottle
  • Include alias and completion

Add tests, use globals and simplify script

Is your feature request related to a problem? Please describe.

Need tests to trust PR:s
Simplify passing arguments around with globals
The script is responsible for pre-pending environment variable, do it in-app instead so it's testable

Describe the solution you'd like

Use lazy_static for globals
Use tests that calls the binary and validates the output

Describe alternatives you've considered

Not testing and implementing bugs

Fish support for usage script

Is your feature request related to a problem? Please describe.

The kubesess.sh script doesn't support fish shell

Describe the solution you'd like

Include fish variant installation

Setting namespace doesn't work for helm or skupper

Describe the bug
skupper and helm use namespace set in .kube/config when switching namespace with kubens
To Reproduce
using these aliases
alias kubectx='export KUBECONFIG=$(kubesess context)'
alias kubens='export KUBECONFIG=$(kubesess namespace)'

kubens
skupper cluster init
helm upgrade

Expected behavior
inits skupper in namespace, upgrade a helm chart in namespace

Desktop (please complete the following information):
macos m1 macbook pro
iterm2
zsh

arm release

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

No release is available for arm target.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Having a arm release would be nice.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

cargo install --git https://github.com/Ramilito/kubesess.git

Additional context
Add any other context or screenshots about the feature request here.

Add shell completion

Is your feature request related to a problem? Please describe.

I can't tab to get suggestions when in zsh/bash shells

Describe the solution you'd like

Add completion support to zsh/bash shells

[docs] Comments in code

Is your feature request related to a problem? Please describe.

Need to add comments to the code, not a complex code but the intent is unclear sometimes

Describe the solution you'd like

Add high level comments on what stuff is intended to solve

Describe alternatives you've considered

Additional context

Multiple config from folder instead of env variable

Is your feature request related to a problem? Please describe.

If I have more than a couple of config files to merge, the env variable becomes insufficient.
Using kcd and knd doesn't work if env variable is not used since it kubectl tries to modify the .kube/config file

Describe the solution you'd like

Add the possibility to input a path to a folder where all my configs could reside.

Describe alternatives you've considered

Super long env variable

Additional context

More discussion here: #26

Cancelling selection resets env

Describe the bug

When starting a selection and then ctrl-c the env gets reset

To Reproduce

  1. start selection, either kc/kn
  2. change your mind and cancel it with ctrl-c
  3. the env $KUBECONFIG will now be reset

Expected behavior

Should not affect the env variable

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

[refactor] Optimize namespace change

Is your feature request related to a problem? Please describe.

Changing namespace makes an unnecessary call to kubectl to get the current context.
It should already be available when calling getconfig

Describe the solution you'd like

Use the value from the config

Describe alternatives you've considered

Additional context

Better error handling

Is your feature request related to a problem? Please describe.

We need to improve error handling, today all output is added to the env variable while all errors are swallowed and suppressed.

Describe the solution you'd like

As per @morozov suggestion in #42, we need to make the shell wrapper diffirentiate between stderr and stdout

Describe alternatives you've considered

Displaying the error inside the app and not using the stderr

Keep getting "The connection to the server localhost:8080 was refused - did you specify the right host or port?"

Describe the bug
I seem to be getting this error trying to switch to namespaces/context once in a while.
First time I deleted the cache and it fixed the issue, now I'm getting it on one of the environments I work on.
How can I debug the issue?

> kn xxxx
> kgpo
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I dont even have any clusters on localhost:8080 so not sure what it wants

Automate version update

Is your feature request related to a problem? Please describe.

The installation text in readme.md is a manual update.
The version update should be done on release.

Describe the solution you'd like

I want the readme and version to be automatically updated

Describe alternatives you've considered

Manually doing it every time.

Cursor disappears on ctrl-c

Describe the bug

Cursor disappears when ctrl-c while in the select menu

To Reproduce

  1. Run kubesess context
  2. See error, no cursor visible

Expected behavior

Should keep cursor visible

Handle exit codes in shell wrapper

Is your feature request related to a problem? Please describe.

We should handle exit codes in the shell wrapper (bash, @morozov already added it to fish) to allow error handling without the need to reset the env variable.

Describe the solution you'd like

Something similar to what @morozov suggested in #43

Describe alternatives you've considered

The current setup works but is a pain to manage

Corrupt file on change context/ns

Describe the bug
A clear and concise description of what the bug is.
Corrupt file when changing context and ns

To Reproduce
Steps to reproduce the behavior:
Change context/ns often and fast

Expected behavior
A clear and concise description of what you expected to happen.
Changing context/ns should not corrupt the state

Use our own environment variable

Is your feature request related to a problem? Please describe.

If we get multiple config files to work, then we could use our own environment variable to handle current session stuff.

Describe the solution you'd like

Merge our env with the main one

Describe alternatives you've considered

Changing KUBECONFIG is risky and makes it harder to identify if we are using a kubesess session.

Additional context

Namespace per session

Is your feature request related to a problem? Please describe.

At the moment only context is handled per session, is it possible to handle namespace the same way?

Describe the solution you'd like

A way to make namespace sticky for that session only

Expand troubleshooting guide

Is your feature request related to a problem? Please describe.

Cleaning the cache and resetting the env is fine, but how to debug the actual issue?

Describe the solution you'd like

Expand the troubleshooting guide

No interactive select with `kc` command

Describe the bug

To Reproduce

  1. Install with given install steps.
  2. Run kc
  3. The context list shows up as a list, the interactive panel is not interactive.

Expected behavior
Shows the fzf alternative

Screenshots

$ kc
Possible contexts are:
azure-1
azure-2
azure-3
azure-4
azure-5
azure-6
azure-7
azure-8

Desktop (please complete the following information):

  • OS: Archlinux
  • Term: Tilix, Shell: ZSH
  • Version: 1.2.6

Support multiple configs

Is your feature request related to a problem? Please describe.

Need to support multiple config files

Describe the solution you'd like

If I have multiple config files, I would expect them to be merged into one

Describe alternatives you've considered

Manually merging them

Auto deploy to brew

Is your feature request related to a problem? Please describe.

Should bump version on brew on release.

Create release binaries for mac

Is your feature request related to a problem? Please describe.

I want to install from a github release on a mac, the same as I do on linux, but the release binaries are only provided for linux.

Describe the solution you'd like

It seems it is possible to create rust binaries for mac in github actions, e.g. https://github.com/mitsuhiko/rye/blob/main/.github/workflows/release.yml

Describe alternatives you've considered

Use brew on mac or install from source, but that would mean a difference in my dotfiles between mac and linux.

Add option to retrieve current context and namespace

Describe the solution you'd like
A flag to output the current context and namespaces OR environment variables that get populated on context change.
This can then be used to build a custom prompt.

Describe alternatives you've considered
Right now I use kubectx -c and kubens -c to get context and namespace to build my prompt. I use this in favor of other solutions because it is significantly faster.

Additional context
Since kubesess is apparently more efficient than those tools to switch context/namespace, I was wondering if retrieval of current values would perhaps be as fast or even faster.

If this is added, then I wouldn't have a need for kubectx any longer

Changing namespace takes two attempts

Describe the bug
When I change the namespace via kn (Fish), it takes two attempts to succeed instead of one.

Steps to reproduce

# Check if $KUBECONFIG is set
โ†’ set -q KUBECONFIG && echo Set || echo Not set
Not set

# Try to change the namespace
โ†’ kn strimzi && echo OK || echo Fail
Fail

# Again, check if $KUBECONFIG is set
โ†’ set -q KUBECONFIG && echo Set || echo Not set
Set

# Print $KUBECONFIG value
โ†’ echo $KUBECONFIG

# Again, try to change the namespace
โ†’ kn strimzi && echo OK || echo Fail
OK

Expected behavior
It should take a single attempt to change the namespace.

Desktop (please complete the following information):

  • OS: macOS 12.6
  • Version: 1.2.8 and ea51d8c

Additional context
It looks like kubesess expects $KUBECONFIG to be always set. The first failing attempt sets it to an empty string, and the second one succeeds.

Here's what it looks like with additional details:

RUST_BACKTRACE=1 kubesess namespace -c
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/config.rs:110:60
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::Option<T>::unwrap
             at /private/tmp/rust-20220923-6877-yszh4a/rustc-1.64.0-src/library/core/src/option.rs:775:21
   4: kubesess::config::get_current_session
             at /Users/smorozov/Projects/kubesess/src/config.rs:110:34
   5: kubesess::modes::namespace
             at /Users/smorozov/Projects/kubesess/src/modes.rs:67:18
   6: kubesess::Mode::invoke
             at /Users/smorozov/Projects/kubesess/src/main.rs:43:32
   7: kubesess::main
             at /Users/smorozov/Projects/kubesess/src/main.rs:57:5
   8: core::ops::function::FnOnce::call_once
             at /private/tmp/rust-20220923-6877-yszh4a/rustc-1.64.0-src/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.