Skip to content

Commit

Permalink
add environment variables documention, refactor kubeconfig env key
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkuhn committed Dec 11, 2023
1 parent 6e13bed commit 0dfff25
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ command call.

Check the [releases](https://github.com/dbschenker/vaultpal/releases) section for the most recent binaries that are suitable for your operating system.

Please note that vaultpal has been thoroughly tested on MacOS (`*darwin` binaries) and Linux, but not on Windows.
Please note that vaultpal has been thoroughly tested on macOS (`*darwin` binaries) and Linux, but not on Windows.
The binary should execute without issues, but there may be subtle differences, e.g. in the handling of file locations.
Alternatively, consider [Windows Subsystem for Linux](https://docs.microsoft.com/de-de/windows/wsl/install-win10).

Expand Down Expand Up @@ -182,7 +182,7 @@ with data:
"server": "https://api.bibi.mytopic.com"
}
```
#### Cluster Alias
### Cluster Alias

vaultpal supports the definition of an alias to a kubernetes cluster. This is useful if you want to use a generic
endpoint like "int" or "prod" pointing to a cluster.
Expand All @@ -200,6 +200,14 @@ with data:
```
Based on the alias value "bibi", vaultpal will read the configuration for cluster "bibi" in order to render the required certs and keys (pki).

### Environment Variables

| Variable | Usage |
|--------------------------|----------------------------------------------------------------|
| VAULTPAL_NP_URL | URL of Vault production environment, used for prompt label |
| VAULTPAL_PR_URL | URL of Vault non-production environment, used for prompt label |
| VAULTPAL_KUBECONFIG_FILE | Custom location of kubeconfig file |

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss your idea.
Expand Down
4 changes: 2 additions & 2 deletions kube/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
)

const ENV_BRO_KUBECONFIG_FILE = "VBRO_KUBECONFIG_FILE"
const ENV_VAULTPAL_KUBECONFIG_FILE = "VAULTPAL_KUBECONFIG_FILE"

func contextEntryMap(c []ContextEntry) map[string]ContextEntry {
cm := map[string]ContextEntry{}
Expand Down Expand Up @@ -246,7 +246,7 @@ func verifyPalKubeConfig(cluster config.KubeCluster) error {
func ensurePalKubeConfigFile() (string, error) {
kubeconfigFile := ""

if envPalKFile := os.Getenv(ENV_BRO_KUBECONFIG_FILE); envPalKFile == "" {
if envPalKFile := os.Getenv(ENV_VAULTPAL_KUBECONFIG_FILE); envPalKFile == "" {
home, err := homedir.Dir()
if err != nil {
return "", err
Expand Down
4 changes: 2 additions & 2 deletions kube/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ func TestWriteKubeconfigFile(t *testing.T) {
defer os.RemoveAll(dir)
os.Setenv(api.EnvVaultAddress, vm.Server.URL)
os.Setenv(api.EnvVaultToken, "1234")
os.Setenv(ENV_BRO_KUBECONFIG_FILE, dir+"/bro_test_config")
broFile := os.Getenv(ENV_BRO_KUBECONFIG_FILE)
os.Setenv(ENV_VAULTPAL_KUBECONFIG_FILE, dir+"/bro_test_config")
broFile := os.Getenv(ENV_VAULTPAL_KUBECONFIG_FILE)

err = os.Remove(broFile)
if err != nil {
Expand Down

0 comments on commit 0dfff25

Please sign in to comment.