Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

namespace switching #32

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.1.0 (UNRELEASED)
* Added namespace command.

## v0.0.9 (December 23, 2023)
* Added autocomplete script to install.

Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

<img src="assets/kxd.png" width="200">

kxd is a command-line utility that allows you to easily switch between Kubernetes configuration files (kubeconfig) and contexts. This tool is designed to simplify the management of multiple Kubernetes clusters and contexts.
kxd is a command-line utility that allows you to easily switch between Kubernetes configuration files (kubeconfig) contexts. This tool is designed to simplify the management of multiple Kubernetes clusters and contexts.

<img src="assets/demo.gif" width="500">

## Features

- Switch between different kubeconfig files.
- Switch between Kubernetes contexts within a kubeconfig file.
- Switch between Kubernetes namespaces in a context.

## Installation

Expand Down Expand Up @@ -80,10 +81,20 @@ kxd ctx s

This command will display a list of available contexts in your current kubeconfig file. Select the one you want to switch to.

### Switching Kubernetes Context Namespaces

### Getting Current Kubeconfig or Kubernetes Context
To switch between Kubernetes context namespaces within a kubeconfig context, use the following command:

To get the currently set Kubeconfig or Kubernetes Context, use the following commands:
```bash
kxd ns s
```

This command will display a list of kubernetes namespaces in your currently set cluster. Select the one you want to switch to.


### Getting Current Kubeconfig, Kubernetes Context or Context Namespace

To get the currently set Kubeconfig, Kubernetes Context or Context Namespace, use the following commands:

```bash
kxd f c
Expand All @@ -97,6 +108,12 @@ kxd ctx c

This command will display the currently set Kubernetes Context.

```bash
kxd ns c
```

This command will display the currently set Kubernetes Context Namespace.

### Version

To check the version of Kubeconfig Switcher, use the following command:
Expand Down
8 changes: 6 additions & 2 deletions docs/kxd.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ kxd - switch between Kubeconfigs and contexts.

Allows for switching kubeconfig files and contexts, as well as getting the current set ones.

```
kxd [flags]
```

### Options

```
Expand All @@ -14,9 +18,9 @@ Allows for switching kubeconfig files and contexts, as well as getting the curre

### SEE ALSO

* [kxd completion](kxd_completion.md) - Generate the autocompletion script for the specified shell
* [kxd context](kxd_context.md) - Kubeconfig context command
* [kxd file](kxd_file.md) - Kubeconfig file command
* [kxd namespace](kxd_namespace.md) - Kubeconfig namespace command
* [kxd version](kxd_version.md) - kxd version command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ This is the default context command.
* [kxd context list](kxd_context_list.md) - List kubeconfig contexts
* [kxd context switch](kxd_context_switch.md) - Switch kubeconfig contexts

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_context_current.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd context current [flags]

* [kxd context](kxd_context.md) - Kubeconfig context command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_context_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd context list [flags]

* [kxd context](kxd_context.md) - Kubeconfig context command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_context_switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd context switch [flags]

* [kxd context](kxd_context.md) - Kubeconfig context command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ This is the default file command.
* [kxd file list](kxd_file_list.md) - List kubeconfigs
* [kxd file switch](kxd_file_switch.md) - Switch kubeconfig

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_file_current.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd file current [flags]

* [kxd file](kxd_file.md) - Kubeconfig file command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_file_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd file list [flags]

* [kxd file](kxd_file.md) - Kubeconfig file command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_file_switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd file switch [flags]

* [kxd file](kxd_file.md) - Kubeconfig file command

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
22 changes: 22 additions & 0 deletions docs/kxd_namespace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## kxd namespace

Kubeconfig namespace command

### Synopsis

This is the default namespace command.

### Options

```
-h, --help help for namespace
```

### SEE ALSO

* [kxd](kxd.md) - kxd - switch between Kubeconfigs and contexts.
* [kxd namespace current](kxd_namespace_current.md) - Shows currently set k8s namespace
* [kxd namespace list](kxd_namespace_list.md) - List kubeconfig namespaces
* [kxd namespace switch](kxd_namespace_switch.md) - Switch k8s namespaces

###### Auto generated by spf13/cobra on 26-Jan-2024
23 changes: 23 additions & 0 deletions docs/kxd_namespace_current.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## kxd namespace current

Shows currently set k8s namespace

### Synopsis

This shows the current set k8s namespace.

```
kxd namespace current [flags]
```

### Options

```
-h, --help help for current
```

### SEE ALSO

* [kxd namespace](kxd_namespace.md) - Kubeconfig namespace command

###### Auto generated by spf13/cobra on 26-Jan-2024
23 changes: 23 additions & 0 deletions docs/kxd_namespace_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## kxd namespace list

List kubeconfig namespaces

### Synopsis

This displays a simple list of your k8s namespaces.

```
kxd namespace list [flags]
```

### Options

```
-h, --help help for list
```

### SEE ALSO

* [kxd namespace](kxd_namespace.md) - Kubeconfig namespace command

###### Auto generated by spf13/cobra on 26-Jan-2024
23 changes: 23 additions & 0 deletions docs/kxd_namespace_switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## kxd namespace switch

Switch k8s namespaces

### Synopsis

This allows for switching of your k8s namespace.

```
kxd namespace switch [flags]
```

### Options

```
-h, --help help for switch
```

### SEE ALSO

* [kxd namespace](kxd_namespace.md) - Kubeconfig namespace command

###### Auto generated by spf13/cobra on 26-Jan-2024
2 changes: 1 addition & 1 deletion docs/kxd_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ kxd version [flags]

* [kxd](kxd.md) - kxd - switch between Kubeconfigs and contexts.

###### Auto generated by spf13/cobra on 5-Oct-2023
###### Auto generated by spf13/cobra on 26-Jan-2024
14 changes: 13 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@ toolchain go1.21.5
require (
github.com/manifoldco/promptui v0.9.0
github.com/spf13/cobra v1.8.0
k8s.io/apimachinery v0.29.1
k8s.io/client-go v0.29.1
)

require (
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
Expand All @@ -33,8 +43,10 @@ require (
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/apimachinery v0.29.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.29.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading
Loading