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

If my config_path location is not /etc/containerd/, the final generated certd configuration will still be /etc/containerd/ #3082

Open
zzzyuan0 opened this issue Feb 20, 2024 · 1 comment

Comments

@zzzyuan0
Copy link

zzzyuan0 commented Feb 20, 2024

If my config_path location is not /etc/containerd/, the final generated certd configuration will still be /etc/containerd/. Is this a normal configuration method?

Partial log

2024-02-20T17:23:35.233773632+08:00 stdout F [ttrpc]
2024-02-20T17:23:35.233777529+08:00 stdout F   address = ""
2024-02-20T17:23:35.233782114+08:00 stdout F   gid = 0
2024-02-20T17:23:35.233786632+08:00 stdout F   uid = 0
2024-02-20T17:23:35.234426317+08:00 stdout F version = 2
2024-02-20T17:23:35.23444299+08:00 stdout F v2
2024-02-20T17:23:35.234482155+08:00 stderr F + tr '"' ' '
2024-02-20T17:23:35.23453378+08:00 stderr F + grep config_path
2024-02-20T17:23:35.234538202+08:00 stderr F + awk '{print $3}'
2024-02-20T17:23:35.236454572+08:00 stderr F + cat /host/etc/containerd/config.toml
2024-02-20T17:23:35.239697632+08:00 stderr F + config_path=/cfg/containerd/certs.d
2024-02-20T17:23:35.23971011+08:00 stderr F + '[[' -z /cfg/containerd/certs.d ]]
2024-02-20T17:23:35.239715123+08:00 stderr F + echo config_path is enabled, add mirror 'in' /cfg/containerd/certs.d
2024-02-20T17:23:35.239716836+08:00 stdout F config_path is enabled, add mirror in /cfg/containerd/certs.d
2024-02-20T17:23:35.239979612+08:00 stderr F + cat /host/etc/containerd/config.toml
2024-02-20T17:23:35.240295076+08:00 stderr F + grep config_path
2024-02-20T17:23:35.240454019+08:00 stderr F + awk '{print $3}'
2024-02-20T17:23:35.240802398+08:00 stderr F + tr '"' ' '
2024-02-20T17:23:35.243613445+08:00 stderr F + tmp=/cfg/containerd/certs.d
2024-02-20T17:23:35.243629263+08:00 stderr F + '[[' -z /cfg/containerd/certs.d ]]
2024-02-20T17:23:35.243632739+08:00 stderr F + mkdir -p /host/etc/containerd/certs.d
2024-02-20T17:23:35.244920037+08:00 stderr F + echo https://test.local.cloud.test:30011
2024-02-20T17:23:35.24541116+08:00 stderr F + sed 's,:.*,,'
2024-02-20T17:23:35.24550834+08:00 stderr F + sed -e 's,http.*://,,'
2024-02-20T17:23:35.246454037+08:00 stderr F + domain=test.local.cloud.test
2024-02-20T17:23:35.246466296+08:00 stderr F + mkdir -p /host/etc/containerd/certs.d/test.local.cloud.test
2024-02-20T17:23:35.247096585+08:00 stderr F + '[[' -e /host/etc/containerd/certs.d/test.local.cloud.test/hosts.toml ]]
2024-02-20T17:23:35.247182308+08:00 stderr F + echo 'registry https://test.local.cloud.test:30011 found in config.toml, skip'
2024-02-20T17:23:35.247189615+08:00 stderr F + continue
2024-02-20T17:23:35.247208981+08:00 stdout F registry https://test.local.cloud.test:30011 found in config.toml, skip
2024-02-20T17:23:35.247237032+08:00 stderr F + '[[' 0 -gt 0 ]]
@zzzyuan0
Copy link
Author

There is another question
The judgment condition is -e "$etcContainerd/certs.d/$domain/hosts.toml"
But the log output is echo "registry $registry found in {{ default "config.toml" .Values.containerRuntime.containerd.configFileName }}, skip"
These two are the same thing. According to my understanding, hosts.toml and config.toml are not the same thing.

              mkdir -p $etcContainerd/certs.d
              for registry in $registries; do
                # parse registry domain
                domain=$(echo $registry | sed -e "s,http.*://,," | sed "s,:.*,,")
                # inject registry
                mkdir -p $etcContainerd/certs.d/$domain
                if [[ -e "$etcContainerd/certs.d/$domain/hosts.toml" ]]; then
                  echo "registry $registry found in {{ default "config.toml" .Values.containerRuntime.containerd.configFileName }}, skip"
                  continue
                else
                  cat << EOF >> $etcContainerd/certs.d/$domain/hosts.toml

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

No branches or pull requests

1 participant