Skip to content

fix: correctly copy Helm charts in init container #1018

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

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
dkoshkin added a commit that referenced this pull request Feb 5, 2025
🤖 I have created a release *beep* *boop*
---


## 0.26.0 (2025-02-05)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: adds new field for helm values input for cilium CNI by
@manoj-nutanix in
#1011
* feat: implementation for user defined configmap for cilium addon in
cluster creation by @manoj-nutanix in
#1033
* feat: update CAPI to v1.9.3 by @dkoshkin in
#1010
* feat: adds cluster's ownerref on cilium helm values source object by
@manoj-nutanix in
#1034
### Fixes 🔧
* fix: correctly copy Helm charts in init container by @dkoshkin in
#1018
* fix: Use mindthegap v1.17.0 for the helm-repository container by
@dlipovetsky in
#1024
* fix: use republished COSI controller image by @dkoshkin in
#1022
### Other Changes
* test: wait for COSI controller to be ready by @dkoshkin in
#1014
* refactor: Remove api module dependency from common module by
@jimmidyson in
#1019


**Full Changelog**:
v0.25.0...v0.26.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dimitri Koshkin <[email protected]>
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