Skip to content

Add support for using a host registry dir in cri#4978

Merged
dmcgowan merged 2 commits intocontainerd:masterfrom
cpuguy83:certs_dir
Mar 15, 2021
Merged

Add support for using a host registry dir in cri#4978
dmcgowan merged 2 commits intocontainerd:masterfrom
cpuguy83:certs_dir

Conversation

@cpuguy83
Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 commented Jan 29, 2021

Exposes the hosts dir config to CRI.
This will be used instead of the cri registry config in the main config toml.

Also fixes some bugs with the docker style cert file handling.

Closes #3071
Closes #4904

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jan 29, 2021

Build succeeded.

Comment thread pkg/cri/config/config.go Outdated
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.

I think this should be defined as []string to allow specifying multiple directories.
The actual implementation for multi-dir can be another PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

agreed! hosts_dir = ["/etc/docker/certs.d", "/etc/containerd/cri/hosts"] would be great for people migrating from docker to containerd.

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.

sounds good to have more than one.. but may be confusing with multiple disparate config locations.. which has precedence.. do we error on overwrite. Just have to consider that complexity.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would argue against this for the sake of saving complexity and rather err on the admin to configure the system rather than trying to make containerd handle all possibilities.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe its not that bad if we add a helper function like func(registryHosts ...RegistryHosts) RegistryHosts.
Precedence is first match based on order of the []string

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

see comments

Comment thread remotes/docker/config/hosts.go Outdated
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.

on the prior continue when not a dir ... :-O... thx for the fix.

On the continue when it is a dir .. does docker support the use of subdirectories should we walk here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

does docker support the use of subdirectories should we walk here?

No (or at least if it does its not intentional 😅).

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.

Thanks for finding this and adding tests :)

Comment thread pkg/cri/config/config.go Outdated
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.

sounds good to have more than one.. but may be confusing with multiple disparate config locations.. which has precedence.. do we error on overwrite. Just have to consider that complexity.

Comment thread pkg/cri/config/config.go Outdated
Comment thread docs/cri/config.md Outdated
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.

if we are going to override all of this registry section.. we should consider doing it at the containerd config level and deprecate the cri registry config

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What's the "right" way to do this deprecation?

TBH I tried to make both work but its pretty tricky and I thought likely not worth the effort.

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.

gulp... typically yes.

@AkihiroSuda AkihiroSuda added this to the 1.5 milestone Feb 1, 2021
@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Feb 5, 2021

Looks like I let this one slip through the cracks as well, there were a few items in my version of this which I think would be needed here as well to have a smoother transition (containerd/cri#1533)

@cpuguy83
Copy link
Copy Markdown
Member Author

Pulled in @dmcgowan's changes from containerd/cri#1533

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Feb 16, 2021

Build succeeded.

Comment thread remotes/docker/config/hosts.go Outdated
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.

Thanks for finding this and adding tests :)

Comment thread pkg/cri/config/config.go Outdated
Comment thread pkg/cri/config/config.go Outdated
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Feb 27, 2021

Build succeeded.

Comment thread docs/cri/config.md Outdated
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.

Can we change the path to /etc/containerd/certs.d ?

Non-CRI apps such as nerdctl will want to use the same path

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.

Also, that should be in the default config

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the reason we aren't making it default is because it causes us to ignore other configs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated the comment to use /etc/containerd/certs.d

@AkihiroSuda
Copy link
Copy Markdown
Member

Can we have a first commit as a separate PR, so that we can merge it now and cherry-pick into 1.4?

@AkihiroSuda
Copy link
Copy Markdown
Member

ping @cpuguy83 I'd like to see this included in v1.5 🙏

@cpuguy83
Copy link
Copy Markdown
Member Author

Opened #5186 with just the fixes, as requested.

@cpuguy83
Copy link
Copy Markdown
Member Author

This should have all requested changes in, except for @AkihiroSuda's request to turn it on by default for cri since this ends up overwriting other configs.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Mar 12, 2021

Build succeeded.

The certs dir parsing was skipping over files instead of reading them,
as such the certs would never load.

It was also stating the file name rather than the full path for cert
pairs.

Signed-off-by: Brian Goff <[email protected]>
This will be used instead of the cri registry config in the main config
toml.

---

Also pulls in changes from containerd/cri@d0b4eec

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

theopenlab-ci Bot commented Mar 12, 2021

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

@dmcgowan dmcgowan merged commit 2755ead into containerd:master Mar 15, 2021
@cpuguy83 cpuguy83 deleted the certs_dir branch March 15, 2021 20:47
@mraghu4
Copy link
Copy Markdown

mraghu4 commented Jul 28, 2021

Is this supported in v1.4.4?

@AkihiroSuda
Copy link
Copy Markdown
Member

No, this is in v1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants