-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Allow to process GCS File in Profile Section #9864
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
Open
ashokhein
wants to merge
12
commits into
GoogleContainerTools:main
Choose a base branch
from
ashokhein:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
da9aa04
feat: allow ValuesFile from GCS
ashokhein a9af349
Merge branch 'GoogleContainerTools:main' into main
ashokhein 1bab52c
Merge branch 'GoogleContainerTools:main' into main
ashokhein ce8b80c
added extracted gcs function
ashokhein aa78d3b
Merge branch 'GoogleContainerTools:main' into main
ashokhein 0d1f8bc
added test cases for copy gcs func
ashokhein 1608c21
only create an tmp directory for gcs file
ashokhein 9180d22
fixed formatting
ashokhein ea6dcdf
Merge branch 'GoogleContainerTools:main' into main
ashokhein fd1b81c
Processing Flags to Check GCS References
ashokhein 41bfe02
updating documentation
ashokhein 94f3280
updated filepath to use abs
ashokhein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| apiVersion: skaffold/v4beta13 | ||
| kind: Config | ||
| build: | ||
| artifacts: | ||
| - image: gcr.io/k8s-skaffold/skaffold-example | ||
| deploy: | ||
| helm: | ||
| releases: | ||
| - name: skaffold-helm | ||
| chartPath: skaffold-helm | ||
| # Direct GCS reference in valuesFiles | ||
| valuesFiles: | ||
| - gs://config-bucket/default-values.yaml | ||
| flags: | ||
| install: | ||
| - --atomic=true | ||
| upgrade: | ||
| - --atomic=true | ||
| profiles: | ||
| - name: production | ||
| activation: | ||
| - env: ENVIRONMENT_TYPE=prod | ||
| patches: | ||
| # Add GCS reference to valuesFiles array | ||
| - op: add | ||
| path: /deploy/helm/releases/0/valuesFiles | ||
| value: | ||
| - gs://config-bucket/prod-values.yaml | ||
|
|
||
| - name: staging | ||
| activation: | ||
| - env: ENVIRONMENT_TYPE=staging | ||
| patches: | ||
| # Add GCS reference as --values flag | ||
| - op: add | ||
| path: /deploy/helm/flags/install/- | ||
| value: "--values=gs://config-bucket/staging-values.yaml" | ||
| - op: add | ||
| path: /deploy/helm/flags/upgrade/- | ||
| value: "--values=gs://config-bucket/staging-values.yaml" | ||
|
|
||
| - name: development | ||
| activation: | ||
| - env: ENVIRONMENT_TYPE=dev | ||
| patches: | ||
| # Support both HTTPS and gs:// formats | ||
| - op: add | ||
| path: /deploy/helm/releases/0/valuesFiles | ||
| value: | ||
| - https://storage.googleapis.com/config-bucket/dev-values.yaml | ||
| - gs://config-bucket/dev-override.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function
processGCSFlagscreates temporary directories usingos.MkdirTempfor each GCS values file, but it doesn't arrange for them to be cleaned up. This will result in a resource leak, as temporary directories will accumulate on the user's machine. These directories should be cleaned up after thehelmcommand that uses them has finished.A common pattern in Skaffold is to have the
Deployermanage the cleanup of temporary resources. I recommend modifyingprocessGCSFlagsto return the paths of all temporary directories it creates. The caller (installArgs) can then add these to a list on theDeployer, and theDeployer.Cleanupmethod can be updated to remove them.