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

Support kustomize "extended" patches. #2909 #3663

Merged
merged 1 commit into from
Feb 19, 2020

Conversation

grumps
Copy link
Contributor

@grumps grumps commented Feb 7, 2020

Relates to in case of new feature, this should point to issue/(s) which describes the feature

Fixes #2909

Should merge before :n/a

Should merge after : n/a

Description

implement #2909: support extended kustomize patches

User facing changes

n/a

Before

n/a
After
n/a
Next PRs.
n/a
-->

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • [x ] Includes unit tests
  • [n/a ] Mentions any output changes.
  • [n/a ] Adds documentation as needed: user docs, YAML reference, CLI reference.
  • [ n/a] Adds integration tests if needed.

Reviewer Notes

  • The code flow looks good.
  • Unit test added.
  • User facing changes look good.

Release Notes

Examples of user facing changes:
- Skaffold config changes like
  e.g. "Add buildArgs to `Kustomize` deployer skaffold config."
- Bug fixes
  e.g. "Improve skaffold init behavior when tags are used in manifests"
- Any changes in skaffold behavior
  e.g. "Artifact caching is turned on by default."

@googlebot
Copy link

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

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #3663 into master will increase coverage by 0.01%.
The diff coverage is 86.66%.

Impacted Files Coverage Δ
pkg/skaffold/deploy/kustomize.go 72.5% <86.66%> (+0.87%) ⬆️

@grumps
Copy link
Contributor Author

grumps commented Feb 7, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes and removed cla: no labels Feb 7, 2020
@grumps grumps changed the title implement #2909 Support kustomize "extended" patches. #2909 Feb 7, 2020
@tejal29 tejal29 self-assigned this Feb 11, 2020
Copy link
Contributor

@tejal29 tejal29 left a comment

Choose a reason for hiding this comment

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

LGTM.

@tejal29
Copy link
Contributor

tejal29 commented Feb 11, 2020

Restarted the failed window unit test.

@tejal29 tejal29 added the kokoro:run runs the kokoro jobs on a PR label Feb 11, 2020
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Feb 11, 2020
@grumps
Copy link
Contributor Author

grumps commented Feb 12, 2020

@tejal29 looks like the windows test passed this time!

Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

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

shouldn't we try and stay backwards compatible with older kustomization.yamls? this will break existing users using the older format.

// UnmarshalYAML implements JSON unmarshalling by reading an inline yaml fragment.
func (p *patchWrapper) UnmarshalYAML(unmarshal func(interface{}) error) (err error) {
pp := &patchPath{}
_ = unmarshal(&pp)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be checking an error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nkubala, I'm relatively new to Golang so .... I didn't do the err check here because it will error if its a string and is part of the old API. Now that I'm thinking about it now maybe I could do something like (psuedo code)

err = unmarshall
if pp.path and pp.patch is nil and if err:
   err2 := unmarshal_to_string()
if err and err2:
   log error

Thoughts?

Copy link
Contributor

@tejal29 tejal29 Feb 13, 2020

Choose a reason for hiding this comment

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

i think this change is backward compatible.

	if pp.Path == "" && pp.Patch == "" {

should imply

if err != nil {

to make it explicitly you could

pp := &patchPath{}
if err := unmarshal(&pp); err != nil{
                var oldPathString string
		if err := unmarshal(&oldPathString); err != nil {
			return err
		}

		warnings.Printf("list of file paths deprecated: see https://github.com/kubernetes-sigs/kustomize/blob/master/docs/plugins/builtins.md#patchtransformer")
		pp.Path = oldPathString
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented "explicit".

@tejal29 tejal29 added the kokoro:run runs the kokoro jobs on a PR label Feb 18, 2020
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Feb 18, 2020
@tejal29 tejal29 added the kokoro:run runs the kokoro jobs on a PR label Feb 19, 2020
@tejal29 tejal29 merged commit 50def7d into GoogleContainerTools:master Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kokoro:run runs the kokoro jobs on a PR size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

skaffold dev breaks on kustomize new patches: field format
5 participants