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

Add header configuration in containerd hosts.toml. #11877

Open
hylowaker opened this issue Jan 10, 2025 · 1 comment
Open

Add header configuration in containerd hosts.toml. #11877

hylowaker opened this issue Jan 10, 2025 · 1 comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@hylowaker
Copy link

What would you like to be added

https://github.com/kubernetes-sigs/kubespray/blob/v2.27.0/roles/container-engine/containerd/templates/hosts.toml.j2

I need to set custom authorization header for the registry mirror. containerd_registry_auth does not work for the mirrors.

For workaround, I can add some lines in hosts.toml.j2 file.

server = "https://{{ item.prefix }}"
{% for mirror in item.mirrors %}
[host."{{ mirror.host }}"]
  capabilities = ["{{ ([ mirror.capabilities ] | flatten ) | join('","') }}"]
  skip_verify = {{ mirror.skip_verify | default('false') | string | lower }}
  override_path = {{ mirror.override_path | default('false') | string | lower }}
{% if mirror.header is defined %}
  [host."{{ mirror.host }}".header]
{% for key, value in mirror.header.items() %}
    {{ key }} = ["{{ ([ value ] | flatten ) | join('","') }}"]
{% endfor %}
{% endif %}
{% endfor %}

Then I can set my inventory like this:

containerd_registries_mirrors:
  - prefix: registry.foobar.io
    mirrors:
      - host: https://127.0.0.1:8443/v2
        capabilities: ["pull", "resolve"]
        override_path: true
        header:                       # <-- This is added
          authorization: "Basic xxx"  #

Why is this needed

Currently there is no way to add custom headers for registry mirrors.

@hylowaker hylowaker added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 10, 2025
@VannTen
Copy link
Contributor

VannTen commented Jan 10, 2025

At some point we're gonna have to do a conversion to_toml instead of special casing settings, but apart from that, yeah, we should have that.

/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants