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

fix: correctly copy Helm charts in init container #1018

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

dkoshkin
Copy link
Contributor

During upgrades the init container was incorrectly copying the whole directory, instead of just the tars.

# bundles directory in the container
$ ls /helm-charts/bundles/
charts                   helm-charts-v0.14.6.tar  helm-charts-v0.14.9.tar  helm-charts-v0.23.1.tar
# incorrectly nested directory with the new charts
$ ls /helm-charts/bundles/charts/
helm-charts-v0.14.6.tar  helm-charts-v0.14.9.tar  helm-charts-v0.25.0.tar

What problem does this PR solve?:

Which issue(s) this PR fixes:
Fixes #

How Has This Been Tested?:

The file gets copied correctly when the directory does not exist:

$ cp -r charts/ dst/
$ ls dst
foo.tar

When the dir already exists (ie upgrade scenario), the whole directory gets copied:

$ mkdir dst
$ cp -r charts/ dst/
$ ls dst
charts

Copying the file works correctly into an existing dst if using .:

$ mkdir dst
$ cp -r charts/. dst/
$ ls dst
foo.tar

Special notes for your reviewer:

During upgrades the init container was incorrectly copying the whole directory,
instead of just the tars.
```
# bundles directory in the container
$ ls /helm-charts/bundles/
charts                   helm-charts-v0.14.6.tar  helm-charts-v0.14.9.tar  helm-charts-v0.23.1.tar
# incorrectly nested directory with the new charts
$ ls /helm-charts/bundles/charts/
helm-charts-v0.14.6.tar  helm-charts-v0.14.9.tar  helm-charts-v0.25.0.tar
```

The file gets copied correctly when the directory does not exist:
```
$ cp -r charts/ dst/
$ ls dst
foo.tar
```

When the dir already exists (ie upgrade scenario), the whole directory gets copied:
```
$ mkdir dst
$ cp -r charts/ dst/
$ ls dst
charts
```

Copying the file works correctly into an existing dst if using .:
```
$ mkdir dst
$ cp -r charts/. dst/
$ ls dst
foo.tar
```
@jimmidyson jimmidyson merged commit 0944f23 into main Jan 23, 2025
21 checks passed
@jimmidyson jimmidyson deleted the dkoshkin/fix-helm-repo-init-container branch January 23, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants