Skip to content

Support config imports#3574

Merged
crosbymichael merged 9 commits intocontainerd:masterfrom
mxpv:cfg
Sep 4, 2019
Merged

Support config imports#3574
crosbymichael merged 9 commits intocontainerd:masterfrom
mxpv:cfg

Conversation

@mxpv
Copy link
Copy Markdown
Member

@mxpv mxpv commented Aug 22, 2019

Carry #3310
Fixes #3289

mxpv added 2 commits August 22, 2019 15:41
Signed-off-by: Maksym Pavlenko <[email protected]>
@mxpv mxpv changed the title Support config imports #3289 Support config imports Aug 22, 2019
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 22, 2019

Build succeeded.

Do not rely on toml metadata when decoding plugin's configs as it's not possible to merge toml.MetaData structs during import.

Signed-off-by: Maksym Pavlenko <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 23, 2019

Build succeeded.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 23, 2019

Codecov Report

Merging #3574 into master will increase coverage by 0.15%.
The diff coverage is 74.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3574      +/-   ##
==========================================
+ Coverage   42.38%   42.54%   +0.15%     
==========================================
  Files         126      127       +1     
  Lines       13901    14069     +168     
==========================================
+ Hits         5892     5985      +93     
- Misses       7123     7185      +62     
- Partials      886      899      +13
Flag Coverage Δ
#linux 46.06% <77.77%> (+0.15%) ⬆️
#windows 37.31% <61.64%> (+0.1%) ⬆️
Impacted Files Coverage Δ
services/server/server.go 1.19% <0%> (ø) ⬆️
services/server/config/config.go 55.35% <76.4%> (ø)

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 48fb479...01f7265. Read the comment docs.

@estesp
Copy link
Copy Markdown
Member

estesp commented Aug 23, 2019

Looks reasonable; just remembered we have a man page for the config.toml file; it may already be missing some config options changes already (and definitely hasn't been updated for v2), but we should probably try and get that updated with info on how to use import and the rules for overwrite? Can be a separate PR

@dmcgowan dmcgowan added this to the 1.3 milestone Aug 23, 2019
@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented Aug 23, 2019

I've updated the merging logic a bit so imported files will append slices and maps instead of overwriting the whole section, and added import field description in the config doc.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 23, 2019

Build succeeded.

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Aug 23, 2019

Merging maps makes sense to me, appending slices worries me a bit. Looking through the config I see a few places that could be problematic. For example when configuring a list of endpoints, you may want to override the default but doing a slice append makes that impossible.

@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented Aug 23, 2019

@dmcgowan Slice overwrite can be more confusing IMO. For example if user wants to configure one specific plugin in a separate file, but instead overwrites the whole plugin section defined in parent config.

Signed-off-by: Maksym Pavlenko <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 23, 2019

Build succeeded.

@dmcgowan
Copy link
Copy Markdown
Member

@mxpv I understand, getting correct can be very tricky. Generally if you want a configuration to be mergeable, using a map is sufficient. For example for plugins, the plugins have a name which allows this to be done pretty easily. The only case where I see this is potentially an issue is with the stream processors, but we still have a chance to make that a map for this release. Are there other parts you think this would be a problem? I think the current append method is workable since there is no way to force the overwrite.

@crosbymichael
Copy link
Copy Markdown
Member

What about just doing a replace based on the sections? I makes it easier to reason about and the user can just copy paste the section they want to change

mxpv added 2 commits August 23, 2019 15:31
Signed-off-by: Maksym Pavlenko <[email protected]>
Signed-off-by: Maksym Pavlenko <[email protected]>
@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented Aug 23, 2019

Done. @dmcgowan @crosbymichael PTAL

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 23, 2019

Build succeeded.

@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented Aug 26, 2019

--- FAIL: TestImagesCreateUpdateDelete (0.10s) 173 --- FAIL: TestImagesCreateUpdateDelete/ReplaceLabelsFieldPath (0.01s) 174 images_test.go:531: timestamp for updatedat not after createdat: 2019-08-23 22:55:11.678932 +0000 UTC <= 2019-08-23 22:55:11.678932 +0000 UTC
seems not related

@dmcgowan
Copy link
Copy Markdown
Member

Updates look good, I need to take another pass over it before LGTM. I want this in before rc1 though this week.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

do we need a API to get current config for the running containerd? provide overview of merged config to user to check.

path, pending = pending[0], pending[1:]

// Check if a file at the given path already loaded to prevent circular imports
if _, ok := loaded[path]; ok {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: if loaded[path] more clear :P or use map[string]struct{}

@dmcgowan
Copy link
Copy Markdown
Member

@fuweid a command to dump the config would be good, maybe containerd config dump, since we already have containerd config default.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Aug 30, 2019

Build succeeded.

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Sep 4, 2019

Merge logic looks good, I found one bug in the dump logic that am I seeing if I can fix myself. Also another bug in the proxy plugins but that is a separate issue I will add a PR for.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 4, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Sep 4, 2019

Build succeeded.

Copy link
Copy Markdown
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

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

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.

config.d

6 participants