Skip to content

fix: image registry tls failed#3107

Merged
kubesphere-prow[bot] merged 1 commit into
kubesphere:mainfrom
redscholar:image_registry_tls_failed
May 21, 2026
Merged

fix: image registry tls failed#3107
kubesphere-prow[bot] merged 1 commit into
kubesphere:mainfrom
redscholar:image_registry_tls_failed

Conversation

@redscholar

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Adjust the certificate transmission order so that containerd can correctly recognize it.

Which issue(s) this PR fixes:

Fixes #

Special notes for reviewers:

Does this PR introduced a user-facing change?

image registry tls failed

Additional documentation, usage docs, etc.:


Signed-off-by: redscholar <blacktiledhouse@gmail.com>
@kubesphere-prow kubesphere-prow Bot added release-note kind/bug Categorizes issue or PR as related to a bug. labels May 21, 2026
@kubesphere-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: redscholar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@kubesphere-prow kubesphere-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

@redscholar redscholar added the lgtm Indicates that a PR is ready to be merged. label May 21, 2026
@kubesphere-prow kubesphere-prow Bot merged commit 8eebb83 into kubesphere:main May 21, 2026
4 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request reorders the Ansible tasks for containerd, moving the installation and configuration block to the end of the file, after the certificate synchronization tasks. This change introduces two critical issues: first, the certificate synchronization will fail on new installations because the /etc/containerd directory is no longer created beforehand; second, because the configuration generation and service restart are nested within a conditional installation block, registry certificate updates will not be applied to existing nodes. It is recommended to explicitly ensure the directory structure exists before synchronization and to move the configuration and service management tasks outside of the version-check conditional block.

command: containerd --version
register: containerd_install_version

- name: Containerd | Install and configure containerd if not present or version mismatch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Removing the installation and configuration block from the beginning of the task list means that the /etc/containerd directory is no longer created before the certificate synchronization task runs. On fresh installations, the subsequent copy tasks (which now run first) will likely fail because the destination directory structure does not yet exist. It is recommended to explicitly ensure the directory exists before attempting to copy the certificates.

Comment on lines +46 to +47
- name: Containerd | Install and configure containerd if not present or version mismatch
when: or (.containerd_install_version.error | empty | not) (.containerd_install_version.stdout | contains (printf " %s " .cri.containerd_version) | not)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The Install and configure block is conditional on the containerd version. Since the template task for config.toml and the service management commands are inside this block, they will be skipped if containerd is already installed. Consequently, if a user adds or updates registry certificates on an existing node, the config.toml will not be regenerated to include the new certificate paths, and the service will not be restarted to apply the changes. To ensure the TLS fix works for both new and existing installations, the configuration generation and service restart tasks should be moved outside of the version-check block.

@redscholar redscholar deleted the image_registry_tls_failed branch May 21, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant