Skip to content

feat: allow ValuesFile from GCS #9182

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 8 commits into from
Mar 18, 2025
Merged

Conversation

ashokhein
Copy link
Contributor

Fixes: #9172

Description
Allow to reference the ValuesFile from Google Storage Bucket. It uses the gsutil to copy the remote file and, put it in the temporary directory and reference it in the helm flags.

Copy link

google-cla bot commented Nov 20, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ashokhein
Copy link
Contributor Author

@JeromeJu can you review this one?

@ashokhein
Copy link
Contributor Author

@JeromeJu can you review this one? Please let me know if any other action is to be taken care.


//if the file starts with gs:// then download it in tmp dir
if strings.HasPrefix(v, gcsPrefix) {
tempDir, err := os.MkdirTemp("", valueFileFromGCS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the condition's body can be extracted for better readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, yes separated to the new function.

tempValueFile = filepath.Join(tempDir, path.Base(v))

gcs := gcs.Gsutil{}
if err := gcs.Copy(context.Background(), v, tempValueFile, false); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why context.Background(), but not TODO()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to TODO() as it requires the context temporarily

tempValueFile := v

//if the file starts with gs:// then download it in tmp dir
if strings.HasPrefix(v, gcsPrefix) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like it'll be better to contribute to the helm repository

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skaffold has already been integrated with GCP, so I thought to make the change here.

@ashokhein ashokhein requested a review from a team as a code owner February 3, 2025 11:31
@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 3, 2025
@ashokhein
Copy link
Contributor Author

@idsulik can you review this?

@idsulik
Copy link
Contributor

idsulik commented Feb 11, 2025

@ashokhein I did it, you need to wait for the maintainers

@ashokhein
Copy link
Contributor Author

@Darien-Lin Can you please review this code?

@Darien-Lin
Copy link
Contributor

Darien-Lin commented Mar 14, 2025

Can you add tests for this?

Im going to talk with the team, as this seems to have implications that might be unexpected.

Findings: Cloud Deploy works with local files only and will not be able to take advantage of referencing gs buckets. However, it already cannot take advantage of gs buckets for other files like raw manifests. This should be a no-op for Cloud Deploy. Or at least, should behave consistently with the other fields that reference gs uris.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 17, 2025
Copy link
Contributor

@Darien-Lin Darien-Lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the tests. I have started the presubmits for this PR.
Can you please address the linting issues found by the linter? Thanks for the contribution!

@ashokhein
Copy link
Contributor Author

Thank you for adding the tests. I have started the presubmits for this PR. Can you please address the linting issues found by the linter? Thanks for the contribution!

I fixed that linting issue. Thank you.

@Darien-Lin Darien-Lin merged commit 18cff1e into GoogleContainerTools:main Mar 18, 2025
11 checks passed
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.

(Feature Request) Support ValueFile from Google Cloud Stroage
3 participants