helmfile/pkg/state
KUOKA Yusuke 1da3488599
feat: experimental integration with helm-x (#673)
This enhances helmfile so that it can:

- Treat K8s manifests directories and Kustomize projects as charts
- Add adhoc chart dependencies on sync/diff/template without forking or modifying chart(s) (#649)
- Add adhoc patches(JSON Patch or Strategic Merge Patch supported) to be applied to the K8s resources before sync/diff/template, without forking or modifyin chart(s) (#650)

The usage is as outlined in https://github.com/mumoshu/helm-x/tree/master/examples/helmfile.

Add any or all of `dependencies:`, `jsonPatches:` and `strategicMergePatches:` so that it adds additional flags to `helm` calls that is only supported by `helm x`.

```yaml
releases:
- name: kustomize
  chart: ../kustomize
- name: manifests
  chart: ../manifests
- name: foo
  chart: incubator/raw
  dependencies:
  - alias: bar
    chart: incubator/raw
  values:
  - values.yaml
  - bar:
      enabled: true
      resources:
      - apiVersion: v1
        kind: Pod
        metadata:
          name: bar
        spec:
          containers:
          - command:
            - sleep
            - 1000
            image: alpine:3.9.4
            imagePullPolicy: IfNotPresent
            name: bar
  jsonPatches:
  - target:
      version: v1
      kind: Pod
      name: foo
    patch:
    - op: replace
      path: /spec/containers/0/command
      value:
      - sleep
      - "123"
  strategicMergePatches:
  - apiVersion: v1
    kind: Pod
    metadata:
      name: bar
    spec:
      containers:
      - name: bar
        command:
        - sleep
        - "234"
```

You can alternatively provide `source: path/to/patch.yaml` for `jsonPatches` and `strategicMergePatches` items to externalize it. Add `.gotmpl` suffix like you would do for values files for templating.

When running `helmfile` you must point `--helm-binary` to the `helm-x` binary like below:

```
$ helmfile --helm-binary ~/.helm/plugins/helm-x/bin/helm-x --log-level debug apply
```

after installing the [helm-x](https://github.com/mumoshu/helm-x) plugin.

The integration should ideally be automatic. That is, it shouldn't force you to set `--helm-binary`. But I had no other way to not bloat helmfile's codebase to just add this experimental feature.

Resolves #649
Resolves #650
2019-06-12 16:11:34 +09:00
..
chart_dependency.go Sort requirements alphabetically by name. (#659) 2019-06-06 12:30:22 +09:00
create.go fix: --state-values-set panic: value of type interface {} is not assignable to type string (#680) 2019-06-12 13:35:04 +09:00
create_test.go feat: remote state files (#648) 2019-06-04 22:59:54 +09:00
environment.go chore: tidy up pkgs (#636) 2019-06-01 13:36:05 +09:00
envvals_loader.go fix: --state-values-set panic: value of type interface {} is not assignable to type string (#680) 2019-06-12 13:35:04 +09:00
helmx.go feat: experimental integration with helm-x (#673) 2019-06-12 16:11:34 +09:00
release.go feat: make release version templatized (#671) 2019-06-11 21:52:54 +09:00
release_error.go chore: tidy up pkgs (#636) 2019-06-01 13:36:05 +09:00
release_filters.go chore: tidy up pkgs (#636) 2019-06-01 13:36:05 +09:00
state.go feat: experimental integration with helm-x (#673) 2019-06-12 16:11:34 +09:00
state_exec_tmpl.go feat: state values (#647) 2019-06-04 16:34:02 +09:00
state_exec_tmpl_test.go feat: make release version templatized (#671) 2019-06-11 21:52:54 +09:00
state_run.go chore: tidy up pkgs (#636) 2019-06-01 13:36:05 +09:00
state_test.go fix: fixes a regexp issue for release summary (#666) 2019-06-10 09:18:41 +09:00
storage.go chore: tidy up pkgs (#636) 2019-06-01 13:36:05 +09:00
types.go feat: state values (#647) 2019-06-04 16:34:02 +09:00