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

Upgrade go-yaml #3789

Closed

Conversation

Shell32-Natsu
Copy link
Contributor

@Shell32-Natsu Shell32-Natsu commented Apr 9, 2021

ALLOW_MODULE_SPAN

Upgrade the go-yaml v3 version used in kyaml to go-yaml/yaml@496545a. Almost all of the changes are indentions.

We have some YAML issues that are related to the bugs in go-yaml.

#3778
#3605
#3417
#3486

Upgrading go-yaml can also potentially fix

#3758
#3779

Meanwhile, some other tools which depend on kyaml, like kpt, will also obtain benefits from upgrading go-yaml.

Major change

The most significant (hopefully only) change is the indentation for list items. For example:

# before
list:
- a
- b
---
# after
list:
  - a
  - b

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 9, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Shell32-Natsu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 9, 2021
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2021
@Shell32-Natsu Shell32-Natsu removed the request for review from Liujingfang1 April 9, 2021 23:11
@Shell32-Natsu
Copy link
Contributor Author

/test kustomize-presubmit-master

@Shell32-Natsu
Copy link
Contributor Author

cc @droot

@Shell32-Natsu
Copy link
Contributor Author

Shell32-Natsu commented Apr 10, 2021

I think this is a pretty big change so we may need to merge this after releasing kustomize with new helm plugin. @monopole

Copy link
Contributor

@monopole monopole left a comment

Choose a reason for hiding this comment

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

This will break downstream tests.

The people who come looking for what happened will look at this PR.
The description probably needs some justification for the change
(e.g. point to bugs fixed).

@monopole
Copy link
Contributor

and yes, after helm change :)

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 14, 2021
@natasha41575
Copy link
Contributor

natasha41575 commented Apr 19, 2021

@monopole now that the helm change is merged and released, is this good to go?

@KnVerey
Copy link
Contributor

KnVerey commented Apr 22, 2021

@Shell32-Natsu did you investigate whether we have a way in kyaml (IIRC it has some style options?) that we could use to prevent the whitespace changes from surfacing in Kustomize? If you haven't looked into this, I'd be happy to.

Though potentially innocuous for many, this change might show up in some sense for a large portion of users. It could be disruptive for anyone with tests like ours, as well as anyone who is committing wet config (especially if they verify it against fresh builds in CI). Should this be part of a major version bump as a result?

Do we have tests proving that this PR fixes the issues mentioned?

Besides the whitespace, I see some dropped comments in this PR's diff. Were those manual or caused by the bump somehow?

@Shell32-Natsu
Copy link
Contributor Author

Shell32-Natsu commented Apr 22, 2021

@KnVerey I think there is no such way to configure the indentation in go-yaml.

I agree that this will break a lot of users' tests and this should be a major version release. Upgrading can fix the panic when there are non-ASCII characters like #3605 and #3617.

Besides the whitespace, I see some dropped comments in this PR's diff. Were those manual or caused by the bump somehow?

I think this is caused by bump.

@KnVerey
Copy link
Contributor

KnVerey commented Apr 22, 2021

If there's no way to get around the changes and it's going to trigger a major version bump, IMO we should have really solid evidence of the fixes it provides. I.e. I'd like to see a regression test (probably on a PR off this PR for reviewability) for each one of the issues cited in the description.

Re: the bump potentially causing dropped comments, that warrants investigation too.

@monopole
Copy link
Contributor

Agree with @KnVerey.

I know it's a pain, but having pre-committed tests that repro the bugs fixed by the go-yaml bump, and hopefully show them to be on some normal usage path, would justify the need for this.

We should have those regardless. We ask the folks who file the issues to write such issue reproduction tests, tests that pass by showing bad behavior. Maybe they can help here?

This PR would then edit those tests, showing that the upgrade fixed the underlying issue.

For clarity, the test changes that are just indent adjustments could go in a commit by themselves.

@monopole
Copy link
Contributor

briefly looked for a way to suppress the indent change, didn't find one.

Others want it, e.g.
go-yaml/yaml#202
go-yaml/yaml#720

The code to modify might be here:

https://github.com/go-yaml/yaml/blob/v3/encode.go#L483

There are some nice tests for encode which show the current (undesired) indentation.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 24, 2021
@gautierdelorme
Copy link
Contributor

@monopole according to go-yaml/yaml#661 the maintainer doesn't seem to be inclined to make it configurable.

@Shell32-Natsu
Copy link
Contributor Author

Looks like the non-ascii issue has been addressed in #3827 because it bumped up the go-yaml version. Maybe we don't have a strong motivation to update the version to latest now. For kyaml users like kpt, they can manually pin go-yaml to newer version. Thoughts?

@KnVerey
Copy link
Contributor

KnVerey commented Apr 26, 2021

Looks like the non-ascii issue has been addressed in #3827 because it bumped up the go-yaml version.

That PR didn't bump the go-yaml version. kube-openapi would have brought along a more recent go-yaml version, but we opted to pin go-yaml to what Kustomize was already using to avoid the issues in this PR.

I don't think we need to bump go-yaml to latest right now on principle, but the open issues are serious. We should bump to whatever version fixes them, with tests to prove it does. If we pick up the whitespace changes in the process, the release it's in needs to be a major version bump. If not, it can be a regular release.

@monopole
Copy link
Contributor

Since we're bound at the hip to kubectl, we cannot go higher than whatever is in

https://github.com/kubernetes/kubernetes/blob/master/go.mod#L492

(currently v3.0.0-20200615113413-eeeca48fe776).

If we go higher than that, we're obligated to do so in kubectl too. So an indentation change will have an even larger blast radius.

So yes @Shell32-Natsu, someone else can do manual replacements for now.

Eventually some critical bug will force either an indentation change across the board (kustomize, kubectl, etc) or a fork of gopkg.in/yaml.v3 to retain the current list indents.

@monopole
Copy link
Contributor

monopole commented Jun 5, 2021

Reopening per discussion in #3946. To keep things simple, we should try to land on the same version as in kubectl, so we should upgrade kubectl first.

@monopole monopole reopened this Jun 5, 2021
@monopole
Copy link
Contributor

monopole commented Jun 5, 2021

Sorry to ask, but can you rebase? :P I could try next week if you don't have the time.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 7, 2021
@Shell32-Natsu
Copy link
Contributor Author

@monopole Rebased

@Shell32-Natsu Shell32-Natsu requested review from monopole and KnVerey and removed request for natasha41575 and phanimarupaka June 7, 2021 20:58
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 8, 2021
@mikebz
Copy link
Contributor

mikebz commented Jun 17, 2021

go-yaml/yaml#750 - awaiting review

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 17, 2021
@k8s-ci-robot
Copy link
Contributor

@Shell32-Natsu: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@KnVerey KnVerey closed this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants