Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GA of Kustomize and K8s manifests support #1172

Merged
merged 6 commits into from
May 27, 2020
Merged

feat: GA of Kustomize and K8s manifests support #1172

merged 6 commits into from
May 27, 2020

Conversation

mumoshu
Copy link
Collaborator

@mumoshu mumoshu commented Apr 4, 2020

This is the GA version of the helm-x integration #673 developed last year.

Benefits? You get all the followings without an extra helm plugin:

  • Ability to add ad-hoc chart dependencies/aliases, without forking the chart (Fixes Support for multiple charts in single release (similar to alias in helm) #876 )
  • Ability to patch resulting K8s resources before installing the helm chart
  • Ability to install a kustomization as a chart (Requires kustomize binary to be available in $PATH
  • Ability to install a directory of K8s manifests as a chart
  • etc.

@lukasmrtvy
Copy link

any progress ?

@mumoshu mumoshu merged commit 16288df into master May 27, 2020
@mumoshu mumoshu deleted the chartify-ga branch May 27, 2020 02:42
mumoshu added a commit that referenced this pull request May 27, 2020
@dudicoco
Copy link
Contributor

@mumoshu I can not get this feature to work.

helm version version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}

First attempt:

releases:
- chart: my-repo/amazing-app
  version: 1.0.4
  installed: true
  name: amazing-app
  namespace: devops
  labels:
    chart: amazing-app
    name: amazing-app
    namespace: devops
  jsonPatches:
  - target:
      version: v1
      kind: Pod
      name: static-web
    patch:
    - op: replace
      path: /spec/containers/0/command
      value:
      - sleep
      - "123"

output:

$ helmfile diff
I0527 15:36:00.959212   23656 chartify.go:236] using requirements.yaml:
dependencies:
  - name: base
    version: "^1.0.0"
    repository: "@my-repo"
    alias: amazing-app
in ./helmfile.yaml: [exit status 1

COMMAND:
  helm dependency build /var/folders/fj/scl5dj6d13b7mb34kxzwwfp80000gn/T/4001514311826455215/amazing-app

OUTPUT:
  manager.go:107: warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...
  Error: the lock file (requirements.lock) is out of sync with the dependencies file (requirements.yaml). Please update the dependencies]

Removing the jsonPatches block solves this issue.

Second attempt:

releases:
- name: foo
  chart: incubator/raw
  dependencies:
  - alias: bar
    chart: incubator/raw
  values:
  - 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: static-web
    patch:
    - op: replace
      path: /spec/containers/0/command
      value:
      - sleep
      - "123"

Output:

$ helmfile diff
I0527 15:39:03.873601   23756 chartify.go:236] using requirements.yaml:
dependencies:
- name: raw
  repository: https://kubernetes-charts-incubator.storage.googleapis.com/
  condition: bar.enabled
  alias: bar
  version: "*"
I0527 15:39:13.813020   23756 replace.go:45] options: {false [] []  }
in ./helmfile.yaml: [invalid state: no files rendered]

Removing the jsonPatches and 'dependencies' blocks solves this issue.

mumoshu added a commit that referenced this pull request May 27, 2020
mumoshu added a commit that referenced this pull request Jul 22, 2020
…as chart

This, in combination with #1172, allows you to use `go-getter`-supported URL for K8s manifests on `chart`, so that Helmfile automatically fetches it and then turning it into a temporary local chart, which is then installed by Helmfile as similar as standard Helm charts.

An example usecase of this is to install cert-manager CRDs which is distributed separately from the chart:

```
releases:
- name: cert-manager-crds
  chart: git::http://github.com/jetstack/cert-manager.git@deploy/crds?ref=v0.15.2
```

I'm adding this based on discussion with @lukasmrtvy. He was trying to install cert-manager and prometheus-opreator with Helmfile, and this combined with #1373 should do the job. Thanks for the input!
mumoshu added a commit that referenced this pull request Jul 22, 2020
…as chart (#1374)

This, in combination with #1172, allows you to use `go-getter`-supported URL for K8s manifests on `chart`, so that Helmfile automatically fetches it and then turning it into a temporary local chart, which is then installed by Helmfile as similar as standard Helm charts.

An example usecase of this is to install cert-manager CRDs which is distributed separately from the chart:

```
releases:
- name: cert-manager-crds
  chart: git::http://github.com/jetstack/cert-manager.git@deploy/crds?ref=v0.15.2
```

I'm adding this based on discussion with @lukasmrtvy. He was trying to install cert-manager and prometheus-opreator with Helmfile, and this combined with #1373 should do the job. Thanks for the input!
mumoshu added a commit that referenced this pull request Aug 5, 2020
In #1172, we accidentally changed the meaning of prepare hook that is intended to be called BEFORE the pathExists check. It broke the scenario where one used a prepare hook for generating the local chart dynamically. This fixes Helmfile not to fetch local chart generated by prepare hook.

In addition to that, this patch results in the following fixes:

- Fix an issue that `helmfile template` without `--skip-deps` fails while trying to run `helm dep build` on `helm fetch`ed chart, when the remote chart has outdated dependencies in the Chart.lock file. It should be up to the chart maintainer to update Chart.lock and the user should not be blocked due to that. So, after this patch `helm dep build` is run only on the local chart, not on fetched remote chart.
- Skip fetching chart on `helmfile template` when using Helm v3. `helm template` in helm v3 does support rendering remote charts so we do not need to fetch beforehand.

Fixes #1328
May relate to #1341
mumoshu added a commit that referenced this pull request Aug 6, 2020
In #1172, we accidentally changed the meaning of prepare hook that is intended to be called BEFORE the pathExists check. It broke the scenario where one used a prepare hook for generating the local chart dynamically. This fixes Helmfile not to fetch local chart generated by prepare hook.

In addition to that, this patch results in the following fixes:

- Fix an issue that `helmfile template` without `--skip-deps` fails while trying to run `helm dep build` on `helm fetch`ed chart, when the remote chart has outdated dependencies in the Chart.lock file. It should be up to the chart maintainer to update Chart.lock and the user should not be blocked due to that. So, after this patch `helm dep build` is run only on the local chart, not on fetched remote chart.
- Skip fetching chart on `helmfile template` when using Helm v3. `helm template` in helm v3 does support rendering remote charts so we do not need to fetch beforehand.

Fixes #1328
May relate to #1341
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for multiple charts in single release (similar to alias in helm)
3 participants