Skip to content

ci: nothing execs into k3s before it has written its kubeconfig - #406

Merged
HardMax71 merged 1 commit into
mainfrom
ci/k3s-no-exec-during-cgroup-setup
Oct 19, 2026
Merged

HardMax71 merged 1 commit into
mainfrom
ci/k3s-no-exec-during-cgroup-setup

Conversation

@HardMax71

@HardMax71 HardMax71 commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Since #390, 3 of 49 E2E jobs timed out in "Finalize k3s" with the node never Ready, the latest on main in run 39179973449. Its k3s log, kept since #400, shows the cause. At 00:18:58 k3s logged "failed to move process 96 to cgroup /init" and "failed to enable controller ... device or resource busy". At 00:19:06 the kubelet exited on "cgroup [kubepods] has some missing controllers: cpu, cpuset, hugetlb, memory", and k3s died with it.

Changes

At startup k3s moves every process out of the container's root cgroup and then enables the controllers there. Our two pre-pull loops ran docker exec k3s crictl info the moment the container started (00:18:58.46 in that run), so an exec'd process could land in the root cgroup in between. Both loops now wait for /etc/rancher/k3s/k3s.yaml, which k3s writes seconds after that setup. cicd.md says why.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (./deploy.sh openapi, then ./deploy.sh types), never edited by hand
  • Manual testing performed

Validation: with the same k3s image locally, execs already in flight at startup gave "device or resource busy" in 5 of 6 trials. No exec gave none. Here the node still came up, since this Docker host apparently has the controllers enabled already; the runner evidently didn't.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

Summary by cubic

Fixes E2E jobs timing out in "Finalize k3s" because docker exec into the k3s container raced k3s's startup cgroup setup.

The pre-pull loops ran docker exec k3s crictl info the moment the container started. At startup k3s moves every process out of the container's root cgroup before enabling controllers there, so an exec landing in between made that fail with "device or resource busy", the kubelet exited, and the node never became Ready.

  • Both pre-pull loops now wait for /etc/rancher/k3s/k3s.yaml before exec'ing and document why.

Written for commit 10c575c. Summary will update on new commits.

View guided diff Turn on auto-fix

At startup k3s moves every process out of the container's root cgroup and then enables the cgroup controllers there. Both pre-pull loops started docker exec k3s crictl info the moment the container ran, so an exec'd process could land in the root cgroup in between: k3s logged "failed to enable controller ... device or resource busy", the kubelet exited on "cgroup [kubepods] has some missing controllers", and Finalize k3s timed out (3 of 49 E2E jobs). The loops now wait for /etc/rancher/k3s/k3s.yaml first.
@HardMax71
HardMax71 enabled auto-merge (squash) October 19, 2026 00:31
@github-actions github-actions Bot added documentation Improvements or additions to documentation area: ci GitHub workflows, test infrastructure, repo tooling labels Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 544d0300-46e1-4779-8fad-acda53a99eaa
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@HardMax71
HardMax71 merged commit 22f32e2 into main Oct 19, 2026
21 checks passed
@HardMax71
HardMax71 deleted the ci/k3s-no-exec-during-cgroup-setup branch October 19, 2026 00:37
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Flag Coverage Δ
backend-e2e 82.96% <ø> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

Components Coverage Δ
Backend 92.27% <ø> (+0.09%) ⬆️
Frontend 92.60% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci GitHub workflows, test infrastructure, repo tooling documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants