Skip to content

Conversation

@evankanderson
Copy link
Contributor

@evankanderson evankanderson commented Jan 28, 2022

Fixes #6485

@k8s-ci-robot
Copy link

Hi @evankanderson. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

if len(cR.Mirrors) == 0 && len(cR.Configs) == 0 && len(cR.Auths) == 0 && len(cR.Headers) == 0 {
// No old-style configuration, default to docker-compatible defaults
// See https://github.com/containerd/containerd/issues/6485
c.config.Registry.ConfigPath = "/etc/containerd/certs.d:/etc/docker/certs.d"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is Linux-specific. I don't know if I need to do something cross-platform here or not.

Copy link
Member

@kzys kzys Jan 29, 2022

Choose a reason for hiding this comment

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

@jterry75 @kevpar - Do you know Docker's default in Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Windows server directions are here; the TL;DR is that the certificates need to be installed into the system cert store on Windows, I think: https://docs.docker.com/registry/insecure/#use-self-signed-certificates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In addition, it seems like the Windows cert directions require restarting Docker, so it's not as seamless as the Linux process of putting certificates under the registry name in /etc/docker/certs.d.

Copy link
Contributor

@adisky adisky Jan 31, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, needed to do a little research.

Setting the default in config_unix causes the default config to be merged with any config in the paths, which means that you can hit the error condition on line 400 of config.go by setting any of the (deprecated) mirrors or tls parameters and not explicitly setting config_path to the empty string.

Copy link
Member

Choose a reason for hiding this comment

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

It is still best to catch the conflict there. This is kind of deep in the path to start applying default values. Where is it checking whether ConfigPath is already set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

I've moved this to the end of ValidatePluginConfig and updated the appropriate tests in config_test.go.

@evankanderson
Copy link
Contributor Author

(DCO-signed)

@evankanderson
Copy link
Contributor Author

/assign @cpuguy83

@evankanderson
Copy link
Contributor Author

/assign @kzys

Copy link
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

Thanks @evankanderson. LGTM!

@kzys
Copy link
Member

kzys commented Feb 7, 2022

/ok-to-test

Copy link
Contributor

@adisky adisky left a comment

Choose a reason for hiding this comment

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

evankanderson pushed a commit to evankanderson/containerd that referenced this pull request Feb 8, 2022
Signed-off-by: Evan Anderson <evana@vmware.com>
@evankanderson
Copy link
Contributor Author

Updated docs

@adisky
Copy link
Contributor

adisky commented Feb 10, 2022

LGTM

@evankanderson
Copy link
Contributor Author

Is there anything else I need to do before this can be merged? (I don't have permissions to merge it myself.)

// Validation for deprecated auths options and mapping it to configs.
if len(c.Registry.Auths) != 0 {
if useConfigPath {
return errors.New("`auths` is deprecated, please use `config_path` instead")
Copy link
Member

Choose a reason for hiding this comment

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

Authorization via config_path is intentionally not supported today

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code looks like it supports setting an authorizer, but I've reverted this portion of the change and updated the tests.

Copy link
Contributor Author

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

Let me know if you want me to squash the commits before merging the PR.

log.G(ctx).Warning("`auths` is deprecated, please use `configs` instead")
}

if len(c.Registry.Mirrors) == 0 && !hasDeprecatedTLS && len(c.Registry.Auths) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed Registry.Auths here as well.

// Validation for deprecated auths options and mapping it to configs.
if len(c.Registry.Auths) != 0 {
if useConfigPath {
return errors.New("`auths` is deprecated, please use `config_path` instead")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code looks like it supports setting an authorizer, but I've reverted this portion of the change and updated the tests.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 18, 2022

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 21, 2022

Build succeeded.

@evankanderson
Copy link
Contributor Author

Anything else I need to do?

@estesp
Copy link
Member

estesp commented Feb 25, 2022

Can you squash your commits? We have one LGTM from a containerd maintainer so will need at least one more before merging. I've marked it as ready for review since you had already made the updates @dmcgowan asked for.

@evankanderson
Copy link
Contributor Author

Squashed. Ready for another look.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 1, 2022

Build succeeded.

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.

thinking this over...

right now default for configpath is "" .. (containerd config default > config.toml)

if a user edits the configpath in the config.toml the old mirror/tls has to have already been removed (checked by validator)

with this change we introduce a behavior change

if the configpath is "" and if mirrors/tls isn't set.. then nil configpath means use "/etc/containerd/certs.d:/etc/docker/certs.d"

an admin isn't informed or directing containerd to do that .. it just happens... default is now promoted to auto config from docker/certs.d + containerd/certs.d

if they don't want that to happen they have to add a dummy mirror..

this would be a behavior difference between 1.5 and main

it should be noted that the default config does not have mirrors/tls in it

...

my gut says it would be better, in main, to change the actual default value for config_path in new default configs from "" to the proposed, than to come up with a behavior change for what config_path = "" means retroactively against older configs...

something like:

diff --git a/pkg/cri/config/config_unix.go b/pkg/cri/config/config_unix.go
index ed75bb41c..6bf3d2c1e 100644
--- a/pkg/cri/config/config_unix.go
+++ b/pkg/cri/config/config_unix.go
@@ -69,6 +69,9 @@ func DefaultConfig() PluginConfig {
                        NetworkPluginMaxConfNum:   1, // only one CNI plugin config file will be loaded
                        NetworkPluginConfTemplate: "",
                },
+               Registry: Registry{
+                       ConfigPath: "/etc/containerd/certs.d:/etc/docker/certs.d",
+               },
                ContainerdConfig: ContainerdConfig{
                        Snapshotter:        containerd.DefaultSnapshotter,
                        DefaultRuntimeName: "runc",

and whatever is needed for config_windows.go

@dmcgowan dmcgowan added this to the 2.2 milestone Apr 25, 2025
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
@dmcgowan
Copy link
Member

Rebased to run another round of CI on latest main

@dmcgowan dmcgowan moved this from Review In Progress to Merge on Green in Pull Request Review Oct 17, 2025
@dmcgowan dmcgowan added this pull request to the merge queue Oct 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2025
@evankanderson
Copy link
Contributor Author

I'm willing to do some bounded additional amount of work here, but I'm not sure that I'll be able to debug the current issues, as I don't understand the test harnesses and environments well enough to recognize flakes vs failures.

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

@github-project-automation github-project-automation bot moved this from Merge on Green to Review In Progress in Pull Request Review Oct 17, 2025
@mikebrow mikebrow added this pull request to the merge queue Oct 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2025
@mikebrow mikebrow added this pull request to the merge queue Oct 19, 2025
github-merge-queue bot pushed a commit that referenced this pull request Oct 19, 2025
Default config_path if legacy registry options are not set.
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 19, 2025
@mxpv mxpv added this pull request to the merge queue Oct 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 23, 2025
Copy link
Member

Choose a reason for hiding this comment

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

What about Windows ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know enough about Windows (or how to test) to suggest anything here.

@AkihiroSuda AkihiroSuda added this pull request to the merge queue Oct 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 24, 2025
@dmcgowan dmcgowan added this pull request to the merge queue Oct 24, 2025
github-merge-queue bot pushed a commit that referenced this pull request Oct 24, 2025
Default config_path if legacy registry options are not set.
@dmcgowan dmcgowan moved this from Review In Progress to Merge on Green in Pull Request Review Oct 24, 2025
Merged via the queue into containerd:main with commit 9a43ee6 Oct 24, 2025
95 of 96 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Feature Tracking Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Merge on Green to Done in Pull Request Review Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) ok-to-test size/S

Projects

Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

Set [plugins."io.containerd.grpc.v1.cri".registry].config_path by default