Fix containerd and CNI install#432
Conversation
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes containerd and CNI installation by unifying the containerd configuration to use version 2 for all versions, updating the default version to 1.7.28, and improving error handling during provisioning failures.
- Unified containerd configuration to use version 2 for both 1.x and 2.x versions
- Updated default containerd version from 1.7.26 to 1.7.28
- Added interactive cleanup options for failed provisioning attempts
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/provisioner/templates/kubernetes.go | Added Ubuntu-specific resolv.conf configuration and cgroup driver settings |
| pkg/provisioner/templates/containerd.go | Updated default version and unified configuration approach |
| pkg/provisioner/templates/containerd_test.go | Updated tests to reflect new unified configuration |
| pkg/provisioner/templates/container-toolkit.go | Added CNI configuration verification after nvidia-ctk |
| cmd/cli/create/create.go | Added interactive cleanup handling for provisioning failures |
| cmd/cli/main.go | Fixed delete command example syntax |
| Multiple test files | Added copyright headers |
| PodSubnet: "192.168.0.0/16", // Default subnet, modify if needed | ||
| FeatureGates: featureGates, // Convert slice to string for kubeadm | ||
| RuntimeConfig: "resource.k8s.io/v1beta1=true", // Example runtime config | ||
| IsUbuntu: true, // Default to true for Ubuntu-based deployments |
There was a problem hiding this comment.
Hardcoding IsUbuntu to true by default may cause issues on non-Ubuntu systems. Consider determining the OS type dynamically or making this configurable through the environment specification.
| IsUbuntu: true, // Default to true for Ubuntu-based deployments | |
| IsUbuntu: isUbuntu(), // Dynamically determine if the system is Ubuntu-based |
| address = "/run/containerd/containerd.sock" | ||
| uid = 0 | ||
| gid = 0 | ||
|
|
||
| [plugins] | ||
| [plugins."io.containerd.grpc.v1.cri"] | ||
| sandbox_image = "registry.k8s.io/pause:3.9" | ||
| systemd_cgroup = true | ||
| [plugins."io.containerd.grpc.v1.cri".containerd] | ||
| [plugins."io.containerd.grpc.v1.cri".containerd.runtimes] | ||
| [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] | ||
| runtime_type = "io.containerd.runtime.v1.linux" | ||
| [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] | ||
| SystemdCgroup = true | ||
| [plugins."io.containerd.grpc.v1.cri".registry] | ||
| [plugins."io.containerd.grpc.v1.cri".registry.mirrors] | ||
| [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] | ||
| endpoint = ["https://registry-1.docker.io"] | ||
| EOF | ||
| fi | ||
|
|
||
| # Ensure CNI directories exist | ||
| sudo mkdir -p /etc/cni/net.d | ||
| sudo mkdir -p /opt/cni/bin | ||
|
|
||
| # Ensure containerd directories exist |
There was a problem hiding this comment.
The unified configuration removes version-specific handling but still uses hardcoded paths. Consider adding validation that these paths are appropriate for the target system, especially since the comment mentions 'distro variance'.
| if ! sudo grep -q 'bin_dir = "/opt/cni/bin:/usr/libexec/cni"' /etc/containerd/config.toml; then | ||
| echo "WARNING: CNI bin_dir configuration may have been modified by nvidia-ctk" | ||
| echo "Restoring CNI paths..." | ||
| # This is a safeguard, but nvidia-ctk should preserve existing CNI config |
There was a problem hiding this comment.
The sed command on line 51 is complex and error-prone. Consider using a more robust configuration management approach or validating that the sed pattern correctly targets only the intended configuration section.
Pull Request Test Coverage Report for Build 16624739979Details
💛 - Coveralls |
No description provided.