Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Improved delete command - Initial phase of rename command improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Baiguini committed Feb 7, 2022
1 parent ebe035c commit c3193fd
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 165 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ simulate-release : ## Simulate a release with goreleaser
split : build ## Split a sample Kubernetes configuration file
$(KONF_PREFIX) konf-sh split --kube-config ./examples/config --single-konfigs ./examples/konfigs

list : build ## List a set of sample Kubernetes konfigurations files
list : build ## List a set of sample Kubernetes konfigurations
$(KONF_PREFIX) konf-sh list --single-konfigs ./examples/konfigs

set-local : build ## Set local Kubernetes context (current shell)
Expand All @@ -65,10 +65,10 @@ view-global : build ## View global Kubernetes context
$(KONF_PREFIX) konf-sh view global --kube-config ./examples/config

delete : build ## Remove context list from Kubernetes configuration
$(KONF_PREFIX) konf-sh delete --kube-config ./examples/config context_a,context_b
$(KONF_PREFIX) konf-sh delete --kube-config ./examples/config --single-konfigs ./examples/konfigs context_a,context_b

rename : build ## Rename specified context in Kubernetes configuration
$(KONF_PREFIX) konf-sh rename --kube-config ./examples/config context_a NEW_context_a
$(KONF_PREFIX) konf-sh rename --kube-config ./examples/config --single-konfigs ./examples/konfigs context_a context_x

reset-local : build ## Reset local Kubernetes configuration (current shell)
@echo "It's useless to run an 'eval' command from the Makefile as each line is executed in a new shell instance"
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ konf view

### Split

`konf split` separates the Kubernetes configuration (by default `~/.kube/config`) into single Kubernetes konfigurations files (by default in `~/.kube/konfigs`), one for each context.
`konf split` separates the Kubernetes configuration (by default `~/.kube/config`) into single Kubernetes konfigurations (by default in `~/.kube/konfigs`), one for each context.

### List

`konf list` lists all single Kubernetes konfigurations files separated by `konf split` (by default in `~/.kube/konfigs`).
`konf list` lists all single Kubernetes konfigurations separated by `konf split` (by default in `~/.kube/konfigs`).

### Set

Expand Down Expand Up @@ -229,19 +229,19 @@ konf set local <context> sets the local (current shell) Kubernetes context (sett

### Flags

| Flag | Command list | Available values | Default | Corresponding env-var | Description |
|:-----------------|:-------------------------------------|:-----------------|:---------------------|:------------------------------|:--------------------------------------------------------|
| --kube-config | split, view, view global, set global | - | $HOME/.kube/config | KONF_KUBE_CONFIG_PATH | Specify a custom Kubernetes configuration file path |
| --single-konfigs | split, list, set local, set global | - | $HOME/.kube/konfigs/ | KONF_SINGLE_KUBE_KONFIGS_PATH | Specify the single Kubernetes konfigurations files path |
| Flag | Command list | Available values | Default | Corresponding env-var | Description |
|:-----------------|:-------------------------------------|:-----------------|:---------------------|:------------------------------|:----------------------------------------------------|
| --kube-config | split, view, view global, set global | - | $HOME/.kube/config | KONF_KUBE_CONFIG_PATH | Specify a custom Kubernetes configuration file path |
| --single-konfigs | split, list, set local, set global | - | $HOME/.kube/konfigs/ | KONF_SINGLE_KUBE_KONFIGS_PATH | Specify the single Kubernetes konfigurations path |

### Environment variables

| Key | Command list | Available values | Default | Corresponding flag | Description |
|:------------------------------|:-------------------------------------|:--------------------------------|:---------------------|:-------------------|:--------------------------------------------------------|
| KONF_LOG_ENCODING | (global) | console, json | console | - | Set logger encoding |
| KONF_LOG_LEVEL | (global) | debug, info, warn, error, fatal | info | - | Set logger level |
| KONF_KUBE_CONFIG_PATH | split, view, view global, set global | - | $HOME/.kube/config | --kube-config | Specify a custom Kubernetes configuration file path |
| KONF_SINGLE_KUBE_KONFIGS_PATH | split, list, set local, set global | - | $HOME/.kube/konfigs/ | --single-konfigs | Specify the single Kubernetes konfigurations files path |
| Key | Command list | Available values | Default | Corresponding flag | Description |
|:------------------------------|:-------------------------------------|:--------------------------------|:---------------------|:-------------------|:----------------------------------------------------|
| KONF_LOG_ENCODING | (global) | console, json | console | - | Set logger encoding |
| KONF_LOG_LEVEL | (global) | debug, info, warn, error, fatal | info | - | Set logger level |
| KONF_KUBE_CONFIG_PATH | split, view, view global, set global | - | $HOME/.kube/config | --kube-config | Specify a custom Kubernetes configuration file path |
| KONF_SINGLE_KUBE_KONFIGS_PATH | split, list, set local, set global | - | $HOME/.kube/konfigs/ | --single-konfigs | Specify the single Kubernetes konfigurations path |

### Error codes

Expand All @@ -250,17 +250,17 @@ konf set local <context> sets the local (current shell) Kubernetes context (sett
| 1 | (all) | Error initializing zap logger |
| 2 | (all) | Error starting application |
| 3 | (all) | Error creating specific application command |
| 11 | split | Error checking existence of Kubernetes konfigurations files path |
| 11 | split | Error checking existence of Kubernetes konfigurations path |
| 12 | split, set global, delete, rename | Error validating Kubernetes configuration (single, global, cleaned) |
| 13 | split, set global, delete, rename | Error writing Kubernetes configuration (single, global, cleaned) to file |
| 21 | list | Error listing single Kubernetes konfigurations |
| 31 | set local | Error checking existence of Kubernetes konfigurations files path |
| 31 | set local | Error checking existence of Kubernetes konfigurations path |
| 32 | set local, set global | Error getting Kubernetes context: context argument not specified |
| 33 | set local | Error checking existence of Kubernetes context |
| 34 | set global, rename | Error checking existence of context in Kubernetes configuration |
| 41 | delete | Error getting Kubernetes context list: 'context list' argument not specified |
| 42 | delete | Error validating Kubernetes context list: 'context list' argument not valid. Context list must be a comma-separated list |
| 43 | delete | Error cleaning Kubernetes context list |
| 43 | delete | Error removing Kubernetes context list |
| 51 | rename | Error getting Kubernetes context to rename: 'context to rename' and 'new context name' arguments not specified |
| 52 | rename | Error getting Kubernetes context to rename: 'context to rename' argument not specified |
| 53 | rename | Error getting Kubernetes context to rename: 'new context name' argument not specified |
Expand Down

0 comments on commit c3193fd

Please sign in to comment.