cozystack icon indicating copy to clipboard operation
cozystack copied to clipboard

(k8s) configure containerd for client k8s cluster

Open klinch0 opened this issue 6 months ago • 1 comments

klinch0 avatar May 23 '25 06:05 klinch0

"""

Walkthrough

This update splits the monolithic Cluster API providers Helm chart into four separate charts for bootstrap, core, control plane, and infrastructure providers. It introduces new Helm chart files, manifests, and metadata for each subcomponent. Additionally, it adds support for using a custom secret to patch containerd in the Kubernetes chart and updates related documentation and configuration.

Changes

Files/Groups Change Summary
packages/core/platform/bundles/paas-full.yaml Decomposed capi-providers release into four granular releases: bootstrap, core, cpprovider, and infraprovider, each with explicit dependencies and namespaces.
packages/system/capi-providers/templates/providers.yaml Deleted file; previously defined all Cluster API provider resources in a single manifest.
packages/system/capi-providers-bootstrap/..., capi-providers-core/..., capi-providers-cpprovider/..., capi-providers-infraprovider/... Added new directories for each provider with Helm chart files, .helmignore, Makefile, metadata, component ConfigMaps, and provider manifests.
packages/apps/kubernetes/Chart.yaml, values.yaml, values.schema.json, README.md Bumped chart version, added useCustomSecretForPatchContainerd parameter, updated documentation and schema.
packages/apps/kubernetes/templates/cluster.yaml Added logic to conditionally mount containerd registry certificates and modify config using a custom or copied secret.
packages/apps/kubernetes/templates/copy-patch-containerd.yaml New template to copy an existing secret as a release-specific secret if custom secret usage is disabled.
packages/apps/versions_map Updated version mapping for the Kubernetes package, adding new version and updating commit references.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Helm
    participant Kubernetes API
    participant Secret Store

    User->>Helm: Deploy Kubernetes chart with values
    Helm->>Kubernetes API: Check for <release>-patch-containerd secret
    alt useCustomSecretForPatchContainerd is false
        Helm->>Secret Store: Lookup patch-containerd in cozy-system
        alt Secret exists
            Helm->>Kubernetes API: Create <release>-patch-containerd secret in release namespace
        end
    end
    Helm->>Kubernetes API: Deploy/Update node group with containerd patch logic
    Kubernetes API->>Node: Mount certs and run preKubeadmCommands if secret present
sequenceDiagram
    participant User
    participant Helm
    participant K8s API

    User->>Helm: Deploy paas-full bundle
    Helm->>K8s API: Install capi-providers-bootstrap
    Helm->>K8s API: Install capi-providers-core
    Helm->>K8s API: Install capi-providers-cpprovider
    Helm->>K8s API: Install capi-providers-infraprovider

Possibly related PRs

  • cozystack/cozystack#635: Removes the same providers.yaml file and modifies the kamaji ControlPlaneProvider, directly related to the refactoring and resource definition changes in this PR.

Suggested labels

enhancement, documentation, size:L

Suggested reviewers

  • kvaps
  • lllamnyp

Poem

In the warren of charts, we split and we sort,
Four little providers now each hold their fort.
Secrets for containerd, tucked safely away,
With custom or copied, they hop into play.
The bundle’s unbundled, the mappings are new—
A patchwork of YAML, for clusters to chew!
🐇✨ """


📜 Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9930ef9ccac04fc4fad7839ebc4e957a5053375 and f10f8455fcbdd40a84d4873907949432d7bd3956.

⛔ Files ignored due to path filters (4)
  • packages/system/capi-providers-bootstrap/files/components.gz is excluded by !**/*.gz
  • packages/system/capi-providers-core/files/components.gz is excluded by !**/*.gz
  • packages/system/capi-providers-cpprovider/files/components.gz is excluded by !**/*.gz
  • packages/system/capi-providers-infraprovider/files/components.gz is excluded by !**/*.gz
📒 Files selected for processing (33)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/apps/kubernetes/README.md (1 hunks)
  • packages/apps/kubernetes/templates/cluster.yaml (1 hunks)
  • packages/apps/kubernetes/templates/copy-patch-containerd.yaml (1 hunks)
  • packages/apps/kubernetes/values.schema.json (1 hunks)
  • packages/apps/kubernetes/values.yaml (1 hunks)
  • packages/apps/versions_map (1 hunks)
  • packages/core/platform/bundles/paas-full.yaml (1 hunks)
  • packages/system/capi-providers-bootstrap/.helmignore (1 hunks)
  • packages/system/capi-providers-bootstrap/Chart.yaml (1 hunks)
  • packages/system/capi-providers-bootstrap/files/metadata.yaml (1 hunks)
  • packages/system/capi-providers-bootstrap/templates/configmaps.yaml (1 hunks)
  • packages/system/capi-providers-bootstrap/templates/providers.yaml (1 hunks)
  • packages/system/capi-providers-core/.helmignore (1 hunks)
  • packages/system/capi-providers-core/Chart.yaml (1 hunks)
  • packages/system/capi-providers-core/Makefile (1 hunks)
  • packages/system/capi-providers-core/files/metadata.yaml (1 hunks)
  • packages/system/capi-providers-core/templates/configmaps.yaml (1 hunks)
  • packages/system/capi-providers-core/templates/providers.yaml (1 hunks)
  • packages/system/capi-providers-cpprovider/.helmignore (1 hunks)
  • packages/system/capi-providers-cpprovider/Chart.yaml (1 hunks)
  • packages/system/capi-providers-cpprovider/Makefile (1 hunks)
  • packages/system/capi-providers-cpprovider/files/metadata.yaml (1 hunks)
  • packages/system/capi-providers-cpprovider/templates/configmaps.yaml (1 hunks)
  • packages/system/capi-providers-cpprovider/templates/providers.yaml (1 hunks)
  • packages/system/capi-providers-infraprovider/.helmignore (1 hunks)
  • packages/system/capi-providers-infraprovider/Chart.yaml (1 hunks)
  • packages/system/capi-providers-infraprovider/Makefile (1 hunks)
  • packages/system/capi-providers-infraprovider/files/metadata.yaml (1 hunks)
  • packages/system/capi-providers-infraprovider/templates/configmaps.yaml (1 hunks)
  • packages/system/capi-providers-infraprovider/templates/providers.yaml (1 hunks)
  • packages/system/capi-providers/templates/providers.yaml (0 hunks)
  • scripts/migrations/13 (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/system/capi-providers/templates/providers.yaml
✅ Files skipped from review due to trivial changes (1)
  • scripts/migrations/13
🚧 Files skipped from review as they are similar to previous changes (30)
  • packages/apps/kubernetes/Chart.yaml
  • packages/system/capi-providers-bootstrap/Chart.yaml
  • packages/system/capi-providers-cpprovider/.helmignore
  • packages/system/capi-providers-infraprovider/Makefile
  • packages/system/capi-providers-infraprovider/.helmignore
  • packages/system/capi-providers-cpprovider/Chart.yaml
  • packages/system/capi-providers-core/Chart.yaml
  • packages/apps/versions_map
  • packages/system/capi-providers-core/Makefile
  • packages/system/capi-providers-infraprovider/Chart.yaml
  • packages/system/capi-providers-cpprovider/Makefile
  • packages/apps/kubernetes/values.schema.json
  • packages/apps/kubernetes/values.yaml
  • packages/system/capi-providers-core/templates/providers.yaml
  • packages/system/capi-providers-infraprovider/files/metadata.yaml
  • packages/apps/kubernetes/README.md
  • packages/system/capi-providers-bootstrap/files/metadata.yaml
  • packages/system/capi-providers-infraprovider/templates/providers.yaml
  • packages/system/capi-providers-core/files/metadata.yaml
  • packages/apps/kubernetes/templates/cluster.yaml
  • packages/system/capi-providers-cpprovider/templates/providers.yaml
  • packages/system/capi-providers-cpprovider/files/metadata.yaml
  • packages/system/capi-providers-bootstrap/.helmignore
  • packages/system/capi-providers-bootstrap/templates/configmaps.yaml
  • packages/system/capi-providers-bootstrap/templates/providers.yaml
  • packages/system/capi-providers-core/templates/configmaps.yaml
  • packages/system/capi-providers-infraprovider/templates/configmaps.yaml
  • packages/system/capi-providers-core/.helmignore
  • packages/system/capi-providers-cpprovider/templates/configmaps.yaml
  • packages/core/platform/bundles/paas-full.yaml
🧰 Additional context used
🪛 YAMLlint (1.37.1)
packages/apps/kubernetes/templates/copy-patch-containerd.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test
🔇 Additional comments (1)
packages/apps/kubernetes/templates/copy-patch-containerd.yaml (1)

1-3: Verify lookup guard for non-existent Secret
Confirm that Helm’s lookup function returns nil or an empty object when the “patch-containerd” Secret doesn’t exist. If it returns a non‐nil map regardless, the if $sourceSecret check may always pass and generate an empty Secret.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar May 23 '25 06:05 coderabbitai[bot]