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: Dependency locking #593

Merged
merged 1 commit into from
May 15, 2019
Merged

feat: Dependency locking #593

merged 1 commit into from
May 15, 2019

Conversation

mumoshu
Copy link
Collaborator

@mumoshu mumoshu commented May 14, 2019

In order to maintain predictable deployments, as developer I want to generate and use "lock files" for all chart versions retrieved from a helmfile.

This change solves it by (1)enhancing helmfile deps to generate a lock file containing all the direct chart dependencies of each helmfile state file and
(2)making other helmfile sub-commands reads the lock file and merge the locked version numbers to the helmfile state file being processed.

The lock file is named after the helmfile state file being locked, so that you can have multiple set of the helmfile state file and the lock file pairs in a directory.

When helmfile deps are not explicitly run before commands like sync, all the helmfile behavior should remain as before.

Let's say you have helmfile.1.yaml:

repositories:
- name: stable
  url: https://kubernetes-charts.storage.googleapis.com

releases:
- name: envoy
  chart: stable/envoy
- name: envoy2
  chart: stable/envoy

helmfile deps generates helmfile.1.lock that looks like:

dependencies:
- name: envoy
  repository: https://kubernetes-charts.storage.googleapis.com
  version: 1.5.0
digest: sha256:e43b05c8528ea8ef1560f4980a519719ad2a634658abde0a98daefdb83a104e9
generated: 2019-05-14T16:45:37.78205+09:00

Under the hood, helmfile deps creates a temporary local helm chart with a dummy Chart.yaml and requirements.yaml deduced from the helmfile.yaml content, then runs helm dependency update to produce and update the corresponding requirements.lock file.

helmfile then renames it to match the name of the targeted helmfile state file and moves it, so that it becomes adjacent to each helmfile.yaml.

Other helmfile commands like sync, diiff, apply, lint read chart version numbers from the lock file.

Resolves #483
Resolves #563

In order to maintain predictable deployments, as developer I want to generate and use "lock files" for all chart versions retrieved from a helmfile.

This change solves it by (1)enhancing `helmfile deps` to generate a lock file containing all the direct chart dependencies of each helmfile state file and
(2)making other helmfile sub-commands reads the lock file and merge the locked version numbers to the helmfile state file being processed.

The lock file is named after the helmfile state file being locked, so that you can have multiple set of the helmfile state file and the lock file pairs in a directory.

When `helmfile deps` are not explicitly run before commands like `sync`, all the helmfile behavior should remain as before.

Let's say you have `helmfile.1.yaml`:

```
repositories:
- name: stable
  url: https://kubernetes-charts.storage.googleapis.com

releases:
- name: envoy
  chart: stable/envoy
- name: envoy2
  chart: stable/envoy
```

`helmfile deps` generates `helmfile.1.lock` that looks like:

```
dependencies:
- name: envoy
  repository: https://kubernetes-charts.storage.googleapis.com
  version: 1.5.0
digest: sha256:e43b05c8528ea8ef1560f4980a519719ad2a634658abde0a98daefdb83a104e9
generated: 2019-05-14T16:45:37.78205+09:00
```

Under the hood, `helmfile deps` creates a temporary local helm chart with a dummy `Chart.yaml` and `requirements.yaml` deduced from the `helmfile.yaml` content, then runs `helm dependency update` to produce od update the corresponding `requirements.lock` file.

`helmfile` then renames it to match the name of the targeted helmfile state file and moves it,  so that it becomes adjacent to each `helmfile.yaml`.

Other `helmfile` commands like `sync`, `diiff`, `apply`, `lint` read chart version numbers from the lock file.

Resolves #483
This was referenced May 14, 2019
@mumoshu
Copy link
Collaborator Author

mumoshu commented May 15, 2019

Let's see how this works in the wild.

@mumoshu mumoshu merged commit c9a43ad into master May 15, 2019
@mumoshu mumoshu deleted the chart-dependency-locking branch May 15, 2019 00:39
mumoshu added a commit that referenced this pull request Jun 16, 2019
We unintentionally broke this since #593.

Fixes #675
Fixes #687
mumoshu added a commit that referenced this pull request Jun 16, 2019
We unintentionally broke this since #593.

Fixes #675
Fixes #687
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.

Feature Request: Workflow to simplify upgrades Lock file
1 participant