Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Just-Insane committed Apr 21, 2019
2 parents ec87a04 + 4df12f3 commit d801408
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Helm-Vault supports the following features:
- [X] Upgrade
- [X] Template
- [X] Lint
- [X] Diff

Helm-Vault was created to provide a better way to manage secrets for Helm, with the ability to take existing public Helm Charts, and with minimal modification, provide a way to have production data that is not stored in a public location.

Expand Down Expand Up @@ -265,7 +266,7 @@ $ helm vault template ./nextcloud --name nextcloud --namespace nextcloud -f valu
The operation wraps the default `helm upgrade` command, automatically decrypting the `-f values.yaml` file and then cleaning up afterwards.

```
$ helm vault upgrade nextcloud stable/nextcloud -f ./tests/test.yaml
$ helm vault upgrade nextcloud stable/nextcloud -f values.yaml
```

1. Run `helm upgrade` with the following options:
Expand All @@ -278,13 +279,26 @@ $ helm vault upgrade nextcloud stable/nextcloud -f ./tests/test.yaml
The operation wraps the default `helm lint` command, automatically decrypting the `-f values.yaml` file and then cleaning up afterwards.

```
$ helm vault lint nextcloud -f ./tests/test.yaml
$ helm vault lint nextcloud -f values.yaml
```

1. Run `helm upgrade` with the following options:
1. `nextcloud` - the Helm release name
1. `-f values.yaml` - the (encrypted) values file to use

#### Diff

The operation wraps the `helm diff` command (diff is another Helm plugin), automatically decrypting the `-f values.yaml` file and then cleaning up afterwards.

```
$ helm vault diff upgrade nextcloud stable/nextcloud -f values.yaml
```

1. Run `helm diff upgrade` with the following options:
1. `nextcloud` - the Helm release name
1. `stable/nextcloud` - the Helm chart
1. `-f values.yaml` - the (encrypted) values file to use

**[Back to top](#table-of-contents)**

# Release Process
Expand Down Expand Up @@ -340,4 +354,4 @@ The idea for this project comes from [Helm-Secrets](https://github.com/futuresim

Special thanks to the [Python Discord](https://discord.gg/python) server.

**[Back to top](#table-of-contents)**
**[Back to top](#table-of-contents)**
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "vault"
version: "0.1.3"
version: "0.2.0"
usage: "Store secrets in Hashicorp Vault"
description: |-
Helm plugin for storing secrets in HashiCorp Vault
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='vault',
version='0.1.3',
version='0.2.0',
description='Helm plugin for storing secrets in HashiCorp Vault',
author='Just-Insane',
author_email='[email protected]',
Expand Down
13 changes: 10 additions & 3 deletions src/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ def parse_args(args):
lint.add_argument("-kv", "--kvversion", choices=['v1', 'v2'], default='v1', type=str, help="The KV Version (v1, v2) Default: \"v1\"")
lint.add_argument("-v", "--verbose", help="Verbose logs", const=True, nargs="?")

# Diff Help
diff = subparsers.add_parser("diff", help="Wrapper that decrypts YAML files before running helm diff")
diff.add_argument("-f", "--values", type=str, dest="yaml_file", help="The encrypted YAML file to decrypt on the fly")
diff.add_argument("-d", "--deliminator", type=str, help="The secret deliminator used when parsing. Default: \"changeme\"")
diff.add_argument("-vp", "--vaultpath", type=str, help="The Vault Path (secret mount location in Vault). Default: \"secret/helm\"")
diff.add_argument("-kv", "--kvversion", choices=['v1', 'v2'], default='v1', type=str, help="The KV Version (v1, v2) Default: \"v1\"")
diff.add_argument("-v", "--verbose", help="Verbose logs", const=True, nargs="?")

return parser

class Git:
Expand Down Expand Up @@ -305,7 +313,7 @@ def dict_walker(pattern, data, args, envs, path=None):
data[key] = input(f"Input a value for {path}/{key}: ")
vault = Vault(args, envs)
vault.vault_write(data[key], path, key)
elif (action == "dec") or (action == "view") or (action == "edit") or (action == "install") or (action == "template") or (action == "upgrade") or (action == "lint"):
elif (action == "dec") or (action == "view") or (action == "edit") or (action == "install") or (action == "template") or (action == "upgrade") or (action == "lint") or (action == "diff"):
vault = Vault(args, envs)
vault = vault.vault_read(value, path, key)
value = vault
Expand Down Expand Up @@ -348,7 +356,7 @@ def main(argv=None):
yaml.dump(data, open(f"{yaml_file}.dec", "w"))
os.system(envs[2] + ' ' + f"{yaml_file}.dec")
# These Helm commands are only different due to passed variables
elif (action == "install") or (action == "template") or (action == "upgrade") or (action == "lint"):
elif (action == "install") or (action == "template") or (action == "upgrade") or (action == "lint") or (action == "diff"):
yaml.dump(data, open(f"{yaml_file}.dec", "w"))
leftovers = ' '.join(leftovers)

Expand All @@ -359,7 +367,6 @@ def main(argv=None):

cleanup(args)


if __name__ == "__main__":
try:
main()
Expand Down

0 comments on commit d801408

Please sign in to comment.