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

fix containerd config toml for insecure registries #9651

Conversation

1eedaegon
Copy link

@1eedaegon 1eedaegon commented Jan 10, 2023

here is the config about insecure registries for containerd.

containerd_insecure_registries:
  "192.168.x.x:8080":
    - "http://192.168.x.x:8080"

the rendered /etc/containerd/config.toml contains:

    [plugins."io.containerd.grpc.v1.cri".registry.configs."http://192.168.x.x:8080".tls]
      insecure_skip_verify = true

but it needs to be:

    [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.x.x:8080".tls]
      insecure_skip_verify = true

because insecure_registries template has registry address instead of registry name

diff --git a/roles/container-engine/containerd/templates/config.toml.j2 b/roles/container-engine/containerd/templates/config.toml.j2
index c1bda12b..096dea40 100644
--- a/roles/container-engine/containerd/templates/config.toml.j2
+++ b/roles/container-engine/containerd/templates/config.toml.j2
@@ -57,8 +57,8 @@ oom_score = {{ containerd_oom_score }}
         [plugins."io.containerd.grpc.v1.cri".registry.mirrors."{{ registry }}"]
           endpoint = ["{{ ([ addr ] | flatten ) | join('","') }}"]
 {% endfor %}
-{% for addr in containerd_insecure_registries.values() | flatten | unique %}
-        [plugins."io.containerd.grpc.v1.cri".registry.configs."{{ addr }}".tls]
+{% for registry in containerd_insecure_registries.keys() %}
+        [plugins."io.containerd.grpc.v1.cri".registry.configs."{{ registry }}".tls]
           insecure_skip_verify = true
 {% endfor %}
 {% endif %}

What type of PR is this?
/kind bug

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
Fixes /etc/containerd/config.toml generation for insecure registries.

Which issue(s) this PR fixes:

Fixes #9371 #9207 #9653

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 10, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: 1eedaegon / name: Gon (77a9423)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 10, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @1eedaegon!

It looks like this is your first PR to kubernetes-sigs/kubespray 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubespray has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @1eedaegon. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 10, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 1eedaegon
Once this PR has been reviewed and has the lgtm label, please assign chadswen for approval by writing /assign @chadswen in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@1eedaegon
Copy link
Author

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 12, 2023
@1eedaegon
Copy link
Author

/easycla

@yankay
Copy link
Member

yankay commented Jan 17, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 17, 2023
@ErikJiang
Copy link
Member

@1eedaegon 😁Could you please rebase as #9657 has fixed the CI, thank you.

@1eedaegon 1eedaegon force-pushed the fix-containerd-insecure-reg-template branch from e0d64ae to a2fe2a0 Compare January 18, 2023 00:43
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 18, 2023
@1eedaegon
Copy link
Author

1eedaegon commented Jan 18, 2023

@ErikJiang
I fixed it :)

If you don't mind could you please tell me how to sign up with EasyCLA?
authorization doesn't seem to work for me even after signing multiple times. 🤔

@1eedaegon
Copy link
Author

/check-cla

@1eedaegon
Copy link
Author

/retest

@floryut
Copy link
Member

floryut commented Jan 18, 2023

@ErikJiang I fixed it :)

If you don't mind could you please tell me how to sign up with EasyCLA? authorization doesn't seem to work for me even after signing multiple times. 🤔

Did you do it using your @mondrian.ai email ?

@1eedaegon
Copy link
Author

@ErikJiang I fixed it :)
If you don't mind could you please tell me how to sign up with EasyCLA? authorization doesn't seem to work for me even after signing multiple times. 🤔

Did you do it using your @mondrian.ai email ?

Thanks for your comment. @floryut

No. I am working at Mondrian AI, but my github email is **[email protected].
I submitted both personal and corporate CLA using personal email thinking EasyCLA wasn't working.
I just changed my LFX account primary email to my company email like [email protected].
Is this the right way?

@1eedaegon
Copy link
Author

/check-cla

@floryut
Copy link
Member

floryut commented Jan 19, 2023

@ErikJiang I fixed it :)
If you don't mind could you please tell me how to sign up with EasyCLA? authorization doesn't seem to work for me even after signing multiple times. 🤔

Did you do it using your @mondrian.ai email ?

Thanks for your comment. @floryut

No. I am working at Mondrian AI, but my github email is **[email protected]. I submitted both personal and corporate CLA using personal email thinking EasyCLA wasn't working. I just changed my LFX account primary email to my company email like [email protected]. Is this the right way?

Ok it's just that your commit is set with this email
https://patch-diff.githubusercontent.com/raw/kubernetes-sigs/kubespray/pull/9651.patch

@1eedaegon 1eedaegon force-pushed the fix-containerd-insecure-reg-template branch from a2fe2a0 to 77a9423 Compare January 19, 2023 13:23
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 19, 2023
@1eedaegon
Copy link
Author

@ErikJiang I fixed it :)
If you don't mind could you please tell me how to sign up with EasyCLA? authorization doesn't seem to work for me even after signing multiple times. 🤔

Did you do it using your @mondrian.ai email ?

Thanks for your comment. @floryut
No. I am working at Mondrian AI, but my github email is **[email protected]. I submitted both personal and corporate CLA using personal email thinking EasyCLA wasn't working. I just changed my LFX account primary email to my company email like [email protected]. Is this the right way?

Ok it's just that your commit is set with this email https://patch-diff.githubusercontent.com/raw/kubernetes-sigs/kubespray/pull/9651.patch

@floryut
You are my savior 😭
Thank you!!!

@1eedaegon
Copy link
Author

/retest

@yankay
Copy link
Member

yankay commented Feb 1, 2023

HI @1eedaegon

The issue may be fixed by the #9729 :-)

@1eedaegon
Copy link
Author

HI @1eedaegon

The issue may be fixed by the #9729 :-)

Thanks. better than this commit =]
now close this PR

@1eedaegon 1eedaegon closed this Feb 1, 2023
@1eedaegon 1eedaegon deleted the fix-containerd-insecure-reg-template branch February 1, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't use insecure registry when use kubectl apply
5 participants