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

Migrate TOML to github.com/pelletier/go-toml #5278

Merged
merged 7 commits into from
Apr 2, 2021
Merged

Conversation

mxpv
Copy link
Member

@mxpv mxpv commented Mar 27, 2021

https://github.com/BurntSushi/toml is officially deprecated (BurntSushi/toml@ea60c4d), so this PR migrates containerd to https://github.com/pelletier/go-toml.

Docker hosts parser had to be rewritten as it was tied to TOML package implementation.
Also the original implementation respected host order defined in the file, the current one is not (because pelletier/go-toml uses map internally to keep keys). Other than that the behavior should be the same. @dmcgowan could you please TAL d56b49c?

Fixes: #4370

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv mxpv requested review from dmcgowan and mikebrow March 27, 2021 23:53
@mxpv mxpv marked this pull request as ready for review March 27, 2021 23:53
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@containerd containerd deleted a comment from theopenlab-ci bot Mar 31, 2021
@containerd containerd deleted a comment from theopenlab-ci bot Mar 31, 2021
@mxpv
Copy link
Member Author

mxpv commented Mar 31, 2021

Added a workaround to keep structures private in docker hosts parser package (current pelletier/go-toml implementation requires fields to be public in order to be deserialized).

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 31, 2021

Build succeeded.

@fuweid
Copy link
Member

fuweid commented Mar 31, 2021

Do we need to put this commit in the release/1.5?

@mxpv
Copy link
Member Author

mxpv commented Mar 31, 2021

can wait if you have concerns.

@cpuguy83
Copy link
Member

The change seems significant enough for it to be desirable to get it into 1.5 just for the sake of backporting potential bug fixes.

@cpuguy83
Copy link
Member

Either that or waiting until well after 1.5 is cut.

"github.com/BurntSushi/toml"
"github.com/pelletier/go-toml"
"github.com/pkg/errors"

Copy link
Member

Choose a reason for hiding this comment

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

Looks like imports were accidentally split here

@@ -26,6 +26,8 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"

Copy link
Member

Choose a reason for hiding this comment

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

here as well

}
hosts = append(hosts, parsed)
Copy link
Member

Choose a reason for hiding this comment

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

The ordering here is important and I don't see where it is preserved. Is that part of the test coverage?

@@ -49,7 +49,7 @@ type Runtime struct {
Root string `toml:"runtime_root" json:"runtimeRoot"`
// Options are config options for the runtime. If options is loaded
// from toml config, it will be toml.Primitive.
Options *toml.Primitive `toml:"options" json:"options"`
Options *toml.Tree `toml:"options" json:"options"`
Copy link
Contributor

@adisky adisky Apr 1, 2021

Choose a reason for hiding this comment

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

nit: comment also needs to be updated

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv
Copy link
Member Author

mxpv commented Apr 1, 2021

Addressed feedback and restored ordering

@theopenlab-ci
Copy link

theopenlab-ci bot commented Apr 1, 2021

Build succeeded.

Copy link
Member

@dmcgowan dmcgowan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@dims dims left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan dmcgowan merged commit 261c107 into containerd:master Apr 2, 2021
@mxpv mxpv deleted the toml branch April 15, 2021 18:27
ambarve added a commit to ambarve/cri that referenced this pull request Apr 8, 2022
containerd made this change in containerd/containerd#5278, we need to do the same in our
cri fork.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TOML alternative
9 participants