-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added support for an interactive editor to edit kube secrets
- Loading branch information
Showing
4 changed files
with
278 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,58 @@ | ||
# ksec | ||
|
||
KSec is a command line tool to manage secrets in Kubernetes with the following functionallities: | ||
|
||
- [x] Create a secret from an env file | ||
- [x] Append a secret to an existing secret | ||
- [x] Get a secret from Kubernetes secrets | ||
- [x] Get a secret from Kubernetes secrets | ||
- [x] Delete a secret from Kubernetes secrets | ||
- [x] List all secrets in a namespace | ||
- [x] Fill a file with a secret from Kubernetes secrets | ||
- [x] Modify a secret in Kubernetes secrets using an editor | ||
|
||
## Installation | ||
|
||
to install Ksec use the following command: | ||
` go install github.com/karim-w/ksec ` | ||
`go install github.com/karim-w/ksec` | ||
|
||
## Usage | ||
|
||
### Create a secret from an env file | ||
` ksec -e <.env file path> -n <namespace> -s <secret name> ` | ||
|
||
`ksec -e <.env file path> -n <namespace> -s <secret name>` | ||
this command will : | ||
|
||
- create a secret from the env file and will add it to the kubernetes secrets | ||
- create a yaml file with the env config map | ||
- create a yaml file with the env config map | ||
|
||
### Append a secret to an existing secret | ||
` ksec -w <.env file path> -n <namespace> -s <secret name> -a ` | ||
|
||
`ksec -w <.env file path> -n <namespace> -s <secret name> -a` | ||
this commmand will add a secret to a existing secret in kubernetes secrets | ||
|
||
### List all secrets in a Kubernetes secret | ||
` ksec -l -n <namespace> -s <secret name> ` | ||
|
||
`ksec -l -n <namespace> -s <secret name>` | ||
this command will retrieve the secrets embedde in a kubernetes secrets | ||
|
||
### Get a secret from Kubernetes secrets | ||
` ksec -g -n <namespace> -s <secret name> -k <key> ` | ||
|
||
`ksec -g -n <namespace> -s <secret name> -k <key>` | ||
this command will retrieve a the value of secret within an existing kubernetes secret | ||
|
||
### Delete a secret from Kubernetes secrets | ||
` ksec -d -n <namespace> -s <secret name> -k <key> ` | ||
|
||
`ksec -d -n <namespace> -s <secret name> -k <key>` | ||
this command will delete a secret from an existing kubernetes secret | ||
|
||
### Fill a file with secrets from Kubernetes secrets | ||
` ksec -f <file path> -n <namespace> -s <secret name> ` | ||
|
||
`ksec -f <file path> -n <namespace> -s <secret name>` | ||
|
||
### Modify a secret in Kubernetes secrets using an editor | ||
|
||
`ksec -m -n <namespace> -s <secret name>` | ||
|
||
### Specify the file format | ||
|
||
`ksec -m -n <namespace> -s <secret name> -F <file format: json/yaml>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
package models | ||
|
||
type Secrets struct { | ||
Namespace string | ||
Secret string | ||
Set bool | ||
Key string | ||
Value string | ||
Get bool | ||
Delete bool | ||
List bool | ||
All bool | ||
Operation string | ||
EnvPath string | ||
FillPath string | ||
Namespace string | ||
Secret string | ||
Set bool | ||
Key string | ||
Value string | ||
Get bool | ||
Delete bool | ||
List bool | ||
All bool | ||
Operation string | ||
EnvPath string | ||
FillPath string | ||
Modify bool | ||
FileFormat string | ||
} | ||
|
||
var SupportedFormats = map[string]struct{}{ | ||
"yaml": {}, | ||
"json": {}, | ||
} |
Oops, something went wrong.