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

Config upgrade: handle helm overrides #1646

Merged
merged 6 commits into from
Mar 15, 2019

Conversation

corneliusweig
Copy link
Contributor

Json serialization does not cope with helm overrides, because its type map[string]interface{} is not serialized by the json encoder. To deal with that, implement a fallback which includes the helm overrides as a yaml string.

That way, the config upgrade is forwards compatible, so that future api-versions do not need to do any manual adaptions for a working json serialization. I also tried a much more manual approach which would have required manual tasks for future api versions 👎

One drawback of my current approach is that it requires a new struct HelmOverrides which is shared among all api-version schemas. However, since the content of HelmOverrides is opaque to Skaffold anyway, this should be ok.

Fixes #1585

@codecov-io
Copy link

codecov-io commented Feb 12, 2019

Codecov Report

Merging #1646 into master will increase coverage by 0.02%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1646      +/-   ##
==========================================
+ Coverage   46.97%   46.99%   +0.02%     
==========================================
  Files         130      131       +1     
  Lines        6252     6262      +10     
==========================================
+ Hits         2937     2943       +6     
- Misses       3014     3016       +2     
- Partials      301      303       +2
Impacted Files Coverage Δ
pkg/skaffold/schema/v1beta1/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta2/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha5/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta4/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta5/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta6/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha3/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1beta3/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha2/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/v1alpha4/config.go 100% <ø> (ø) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 464728c...be38be7. Read the comment docs.

Cornelius Weig added 5 commits March 10, 2019 22:59
…1585)

Helm overrides have type `map[string]interface{}` which cannot be serialized to json.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
#####
…tainerTools#1585)

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
…rrides (GoogleContainerTools#1585)

Helm overrides have type `map[string]interface{}` which cannot be serialized to json. Implement a custom serialization which includes the overrides as a yaml-string in json. This implementation is forwards-compatible, so that it will automatically work for future apiVersions.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
@corneliusweig
Copy link
Contributor Author

@nkubala Do you think this is a viable approach? Since you commented on the bug report you seem to be the right person to ask that. Besides, this PR has been open for almost a month now, and I would like to resolve this at some point.

@balopat balopat added the kokoro:run runs the kokoro jobs on a PR label Mar 14, 2019
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Mar 14, 2019
@balopat
Copy link
Contributor

balopat commented Mar 14, 2019

Thank you @corneliusweig for contributing this! This looks good to me - as in theory this shouldn't break anybody. Let's see integration tests pass and then we can merge it.

@balopat balopat merged commit e1d50f0 into GoogleContainerTools:master Mar 15, 2019
@corneliusweig corneliusweig deleted the config-upgrade branch March 15, 2019 20:55
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.

5 participants