helmfile/test/integration
Philipp Hossner 85accf7330
Add helm-secrets-encrypted values template file (#1701)
Secret files ending with .gotmpl are now also rendered as a gotemplate.

```
releases:
- name: myapp
  secrets:
  - secrets.yaml.gotmpl
```

Note that currently, .gotmpl files must be valid YAML files as well.

The expected use-case of this feature is to compose a YAML array from values and encrypted secrets.

Without this feature, you would have tried to do something like the below, which didn't work.

**Example (doesn't work!)**

`values.yaml.gotmpl`:

```
environment:
  -   name: MY_EXTERNAL_IP
      value: |
          {{ exec "./get-external-ip.sh" (list "") }}
```

`secrets.yaml`:
```
_sops:
  #...
environment:
  - name: MY_SECRET_VALUE
    value: (encrypted by sops)
```

`helmfile.yaml`:

```
releases:
- name: foo
  values:
  - values.yaml
  secrets:
  - secrets.yaml
```

This doesn't work because `values.yaml` and the decrypted `secrets.yaml` are passed to `helm` to be merged, and helm overrides the array instead of merging or concatenating the arrays.

**Example (works!)**

Instead of `values.yaml` and `secrets.yaml`, you provide a single `secrets.yaml.gotmpl` that is a valid YAML and encrypted by sops:

```
_sops:
  #...
environment:
  -   name: MY_EXTERNAL_IP
      value: |
          {{ exec "./get-external-ip.sh" (list "") }}
  - name: MY_SECRET_VALUE
    value: (encrypted by sops)
```

`helmfile.yaml`:

```
releases:
- name: foo
  secrets:
  - secrets.yaml.gotmpl
```

Helmfile decrypts the gotmpl by handing it over to helm-secrets and then renders the result as a gotmpl file. The end result is that you have a two-element array `environments` that can be just passed to helm.

Resolves #1700

Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
2021-04-06 14:20:42 +09:00
..
.gnupg Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
charts Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
lib run an integration test script against minikube 2018-04-05 04:44:21 +02:00
scripts Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
secrets-golden Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
templates-golden Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
default.values.yaml test: add secrets integration tests 2021-03-23 17:19:40 +09:00
env-1.secrets.yaml test: add secrets integration tests 2021-03-23 17:19:40 +09:00
env-2.secrets.yaml test: add secrets integration tests 2021-03-23 17:19:40 +09:00
environment.values.yaml fix: helmfile panicing on missing lock file (#596) 2019-05-15 13:16:22 +09:00
happypath.yaml Fix `helmfile template --include-crds` not to break with `chartify` (#1583) 2020-11-12 09:26:43 +09:00
run.sh Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
secrets.yaml Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
secrets_templated.yaml.gotmpl Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
secretssops.yaml Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
values.yaml fix integration test 2019-05-15 13:21:48 +09:00