Repository navigation
Description
Problem
With no TARGET, devops k8s lint lints the renders of all chart sources in one kube-linter run, which has a limit of 300 s. On the environment tree of dan-petty/homelab at 795c247 the run is near that limit, and on a loaded host it ends with Kube-linter audit failed: timed out after 300 s.
Reproduction
Measured on 2026-11-30 on a host with 16 CPUs, kube-linter 0.8.3, on the folder of the 52 builds:
- load average 3 to 5: 238 s and 247 s of wall time, 328 s and 342 s of CPU time
- load average about 23: the command timed out after 300 s
The check make k8s-charts of that repository lints the same chart sources without their CustomResourceDefinitions. Its workflow records 30 s to 60 s for the kube-linter run.
Expected behavior
The lint of all chart sources ends well inside its limit. kube-linter has no check of a CustomResourceDefinition, so the plan must first measure how much of the time the CustomResourceDefinitions take.
Existing Tool Considered
kube-linter 0.8.3 is the linter. No tool is built here.
Alternatives check of 2026-11-30: none.
Tool: none found.
Reason: Searches found kube-linter and fast validators such as kubeconform. No tool shards or parallelizes a kube-linter run over many charts, so the fix stays in the devops CLI.
Lacks:
- No tool splits the run per chart source
- No kube-linter check covers CustomResourceDefinitions
- Schema validators such as kubeconform do not run kube-linter checks
Proposed design
Problem statement
devops k8s lint with no TARGET renders each source of the environment tree and gives all renders to one kube-linter run. That run has the 300 s wall limit of the devops CLI, not a limit of kube-linter. The homelab tree needs 328 s to 342 s of CPU time for the run, so a loaded host ends it with timed out after 300 s. The change removes the rendered documents of kind CustomResourceDefinition, because no enabled check reads them, unless the config of the tree declares a check of that kind. It gives the tree lint a 900 s wall limit and prints the wall time and the skipped count. It keeps one run for the whole tree, because a run for each render gives false findings for the checks that read sibling files.
Acceptance criteria
Requirement: Skip the CustomResourceDefinition documents of the tree lint
The devops k8s lint command with no TARGET SHALL remove each rendered document with kind CustomResourceDefinition from the renders folder before it starts kube-linter, when the config of the tree declares no check scoped to that kind.
Scenario: A render with one Deployment and one CustomResourceDefinition
- WHEN a unit test lints the tree through the fake tool executor, and the render of one source holds a Deployment and a CustomResourceDefinition
- THEN the kube-linter request names a folder that holds only the Deployment, and the command output holds the skipped count 1.
Requirement: Keep the CustomResourceDefinition documents that the config checks
The devops k8s lint command MUST keep each rendered document with kind CustomResourceDefinition in the renders folder when the config of the tree declares a check whose scope.objectKinds names CustomResourceDefinition.
Scenario: A config with a CRD-scoped custom check
- WHEN a unit test lints a tree whose
.kube-linter.yamldeclares a custom check withobjectKinds: [CustomResourceDefinition] - THEN the kube-linter request names a folder that holds the CustomResourceDefinition document.
Requirement: A TARGET lint keeps the document that it names
The devops k8s lint command with a TARGET SHALL give kube-linter every document of that target and the 300 s wall limit.
Scenario: A TARGET folder with a CustomResourceDefinition
- WHEN a unit test lints a folder that holds one CustomResourceDefinition as TARGET
- THEN the kube-linter request names that folder, and its
limits.wall_secondsis 300.0.
Requirement: One kube-linter run for the whole tree
The devops k8s lint command with no TARGET MUST start one kube-linter process for all renders of the tree.
Scenario: Three rendered sources
- WHEN a unit test lints a tree whose three sources render three documents
- THEN the fake tool executor records one kube-linter request, and the folder of that request holds three files.
Requirement: The tree lint has its own wall limit
The devops k8s lint command with no TARGET SHALL give its kube-linter run a wall limit of 900 s.
Scenario: The wall limit of the tree run
- WHEN a unit test lints the tree through the fake tool executor
- THEN the
limits.wall_secondsof the kube-linter request is 900.0.
Requirement: A timeout names the limit and the tree
When the kube-linter run of the tree ends with a timeout, the command MUST exit non-zero with a message that holds the wall limit and the root of the tree.
Scenario: The tree run times out
- WHEN the fake tool executor answers the kube-linter request of the tree with
timed_out=True - THEN the command exits 1, and its output holds
timed out after 900 sand the root path of the tree.
Requirement: Report the wall time and the skipped count
The devops k8s lint command with no TARGET SHALL print the wall time of the kube-linter run and the count of skipped CustomResourceDefinition documents.
Scenario: Two CRDs in three sources
- WHEN a unit test lints a tree whose three sources hold two CustomResourceDefinition documents
- THEN the command output holds the skipped count 2 and a wall-time line with the seconds of the run.
Requirement: Pending a person after the merge
The lint of the homelab tree MUST end inside its 900 s limit and record the time that the CustomResourceDefinitions take.
Scenario: Live check on the homelab tree
- WHEN after the merge, a person runs
uv run devops k8s lint --k8s-dir k8sin dan-petty/homelab at795c247at a load average of 3 to 5 - THEN the command exits 0, its output holds a skipped count above zero and the wall time of the run, and the wall time is less than 120 s, as the
make k8s-chartsrun of 30 s to 60 s without the CRDs predicts.
Existing Tool Considered
kube-linter 0.8.3 (stackrox/kube-linter) is the linter and stays the linter. The alternatives check of 2026-11-30 records the verdict none with no other tool, and its block records what kube-linter lacks. The change adds a filter of the rendered documents and one wall limit in the devops CLI: about 4k tokens to build, about 2k tokens to keep and fix, over about half a day.
Key questions
- Where does the 300 s limit of
devops k8s lintcome from?: It is the wall limit of the devops CLI itself.DEFAULT_SECURITY_SCANNER_TIMEOUT_SECONDSis 300.0, the scanner hands it to the tool run aslimits.wall_seconds, and it builds the reasontimed out after 300 sfrom it. kube-linter sets no such limit. [sources: src/devops_cli/config/defaults.py:344, src/devops_cli/security/base.py:726, src/devops_cli/security/tool_executor.py:158] - Does a check of the config that the lint reads cover a CustomResourceDefinition?: No check of the config of this repository reads one. The enabled checks are workload checks, and the one custom check scopes to
PersistentVolumeClaim. The tree reads its own config, so the filter reads that config for a check scoped toCustomResourceDefinition. [sources: .kube-linter.yaml:16, .kube-linter.yaml:26, .kube-linter.yaml:37, src/devops_cli/commands/k8s/security_audit.py:159] - Should the lint remove the CustomResourceDefinition documents before the kube-linter run?: Yes, but only when the config of the tree declares no check scoped to
CustomResourceDefinition. A custom check withscope.objectKindsthat names the kind keeps the documents in the run. (best practice) [sources: .kube-linter.yaml:16, .kube-linter.yaml:27, src/devops_cli/k8s/image_pins.py:455]- Chosen: Remove the CRD documents unless the config checks them. No enabled check of the config reads a CRD, and the
make k8s-chartsrun without the CRDs records 30 s to 60 s. The guard keeps a config that does check CRDs. - Rejected: Remove the CRD documents always. A custom check with
objectKinds: [CustomResourceDefinition]would lose its objects, with no message. - Rejected: Keep the CRD documents and only move the limit. The issue measures 238 s and 247 s with them, against 30 s to 60 s without them.
- Chosen: Remove the CRD documents unless the config checks them. No enabled check of the config reads a CRD, and the
- How does the lint keep the kube-linter run inside its limit?: It keeps one run over the whole renders folder and raises the wall limit of the tree lint to 900 s. It does not split the run, because the checks
non-isolated-podanddangling-serviceread sibling files, and a run for each file reports false findings. (best practice) [sources: src/devops_cli/security/kubelinter.py:25, .kube-linter.yaml:26, src/devops_cli/commands/k8s/security_audit.py:180, src/devops_cli/config/defaults.py:344]- Chosen: One run with a 900 s wall limit for the tree lint. The limit is the own default of the CLI, so it moves without a tool change, and one run keeps the checks that read sibling files.
- Rejected: One run for each rendered file.
dangling-servicegives false findings when kube-linter does not see the pods of a sibling file (src/devops_cli/security/kubelinter.py:25), and the config enablesnon-isolated-pod. - Rejected: One run for each chart source. One chart source render is one file, so this splits the same sibling-file checks across runs.
- Rejected: Raise the limit of kube-linter. kube-linter sets no limit here. The 300 s is the default of the devops CLI (
src/devops_cli/config/defaults.py:344). - Rejected: Run the kube-linter processes at the same time. The issue measures the timeout on a host at load 23, so more processes add load.
- Which wall limit does the tree lint take?: 900 s, three times the 300 s default. The reply records 363 s of wall time at a load average of 9 to 11, so 900 s covers a loaded host and still bounds a hung tool. (best practice) [sources: src/devops_cli/config/defaults.py:344, src/devops_cli/security/base.py:726]
- Rejected: 600 s. The measured 363 s leaves little room for a higher load.
- Chosen: 900 s. It is three times the measured wall time and keeps a bound on a hung tool.
- Rejected: No limit. A hung kube-linter run would never end.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 30, 2026
The lint times out on loaded hosts, causing intermittent CI failures.Both concern kube-linter on chart sources; #6106 adds the lint, the candidate fixes its timeout.dan-petty commentedon Nov 30, 2026
More data from the work on #7889 (pull request #7901), on 2026-11-30 and
mainof dan-petty/homelab at7569d2c:devops k8s lint --k8s-dir k8swith all chart sources, at a load average of 9 to 11 on 16 CPUs, ended after 363 s withKube-linter audit failed: timed out after 300 s.devops-cli-service commentedon Nov 30, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Dec 1, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Dec 1, 2026
Plan state: branch
fix/7900-k8s-lint-of-all-charts-nears, draft pull request #8003. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
devops-cli-service commentedon Dec 1, 2026
The stage job staged the plan of draft pull request #8003. The plan state comment of #8003 holds the branch, the task groups and the findings.
The runs of the planner and the review made 79 model request(s), and used 5125719 input tokens and 87738 output tokens. The tool calls, in order:
Run 1 (stage):
file_symbols({"path":"src/devops_cli/commands/k8s/security_audit.py"})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":1,"end_line":210})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":183,"end_line":210})file_symbols({"path":"src/devops_cli/security/kubelinter.py"})read_file({"path":"src/devops_cli/security/kubelinter.py","start_line":105,"end_line":200})read_file({"path":"src/devops_cli/security/base.py","start_line":640,"end_line":760})search_code({"text":"def for_tool","path":"src/devops_cli/security"})read_file({"path":"src/devops_cli/security/tool_executor.py","start_line":145,"end_line":200})search_code({"text":"CONST_TOOL_CPU_LIMIT_SECONDS"})search_code({"text":"def write_application_renders"})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":425,"end_line":520})search_code({"text":"k8s_lint","path":"tests"})read_file({"path":"tests/commands/k8s/test_k8s.py","start_line":1540,"end_line":1735})read_spec({"capability":"k8s-lint","requirement":"The lint of the environment tree reads the build of each path source"})references({"name":"kube_linter_tree"})read_file({"path":"src/devops_cli/lang/en/messages.py","start_line":806,"end_line":830})search_code({"text":"def _has_kubernetes_object","path":"src/devops_cli/k8s"})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":405,"end_line":426})search_code({"text":"YAML_SAFE_LOADER","path":"src/devops_cli/k8s/image_pins.py"})search_code({"text":"kube_linter_not_run"})search_code({"text":"builds in one run with the"})find_issues({"terms":"k8s lint kube-linter"})Run 2 (stage):
read_file({"path":".kube-linter.yaml","start_line":14,"end_line":38})read_file({"path":"src/devops_cli/security/base.py","start_line":720,"end_line":728})search_code({"text":"write_application_renders","path":"src/devops_cli"})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":440,"end_line":500})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":100,"end_line":215})read_file({"path":"src/devops_cli/security/kubelinter.py"})search_code({"text":"timeout: float","path":"src/devops_cli/security/base.py"})search_code({"text":"kube_linter_tree","path":"src/devops_cli/lang/en/messages.py"})Run 3 (stage):
search_code({"text":"write_text(rendered, encoding=\"utf-8\")","path":"src/devops_cli/k8s/image_pins.py"})search_code({"text":"timed out after","path":"src/devops_cli/security/base.py"})file_symbols({"path":"src/devops_cli/k8s/image_pins.py"})find_issues({"terms":"k8s lint kube-linter"})Run 4 (stage):
read_file({"path":"src/devops_cli/config/defaults.py","start_line":344,"end_line":344})read_file({"path":"src/devops_cli/security/base.py","start_line":722,"end_line":728})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":453,"end_line":457})Run 5 (stage):
read_file({"path":"src/devops_cli/config/defaults.py","start_line":344,"end_line":344})read_file({"path":"src/devops_cli/security/base.py","start_line":720,"end_line":730})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":445,"end_line":462})Run 6 (stage):
read_file({"path":"src/devops_cli/config/defaults.py","start_line":344,"end_line":344})read_file({"path":"src/devops_cli/security/base.py","start_line":722,"end_line":728})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":450,"end_line":460})find_issues({"terms":"k8s lint kube-linter"})Run 7 (stage):
read_file({"path":"src/devops_cli/config/defaults.py","start_line":343,"end_line":345})read_file({"path":"src/devops_cli/security/base.py","start_line":722,"end_line":728})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":450,"end_line":458})search_code({"text":"def k8s_lint","path":"src"})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":105,"end_line":215})read_file({"path":"src/devops_cli/security/kubelinter.py","start_line":15,"end_line":40})search_code({"text":"def run_kubelinter_scan","path":"src/devops_cli/security/kubelinter.py"})read_file({"path":"src/devops_cli/security/kubelinter.py","start_line":145,"end_line":200})search_code({"text":"timeout: float = DEFAULT_SECURITY_SCANNER_TIMEOUT_SECONDS","path":"src/devops_cli/security/base.py"})read_file({"path":"src/devops_cli/security/base.py","start_line":738,"end_line":760})find_issues({"terms":"k8s lint kube-linter"})Run 8 (stage):
search_code({"text":"timed out after {timeout:g} s","path":"src/devops_cli/security/base.py"})read_file({"path":"src/devops_cli/security/base.py","start_line":722,"end_line":746})search_code({"text":"_kube_lint(","path":"src/devops_cli/commands/k8s/security_audit.py"})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":120,"end_line":215})Run 9 (stage_verify):
read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":110,"end_line":260})read_file({"path":"src/devops_cli/security/kubelinter.py","start_line":125,"end_line":190})read_file({"path":"src/devops_cli/security/base.py","start_line":690,"end_line":800})read_comment({})read_comment({"number":2})search_code({"text":"devops ci docs"})search_code({"text":"wall_seconds","path":"src/devops_cli/security"})read_file({"path":"src/devops_cli/security/tool_executor.py","start_line":140,"end_line":180})search_code({"text":"CONST_TOOL_CPU_LIMIT_SECONDS"})find_issues({"terms":"k8s lint kube-linter"})read_spec({"capability":"k8s-lint"})Tool calls: file_symbols=3 (empty=0), find_issues=5 (empty=0), read_comment=2 (empty=0), read_file=36 (empty=0), read_spec=2 (empty=0), references=1 (empty=0), search_code=21 (empty=0)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
The plan request held these comments of the item whole: #7900 (comment), #7900 (comment), #7900 (comment), #7900 (comment).
docs(spec): plan #7900 Skip CRDs and widen the tree lint limit
devops-cli-service commentedon Dec 1, 2026
The stage job staged the plan of draft pull request #8003. The plan state comment of #8003 holds the branch, the task groups and the findings.
The runs of the planner and the review made 21 model request(s), and used 1494617 input tokens and 17050 output tokens. The tool calls, in order:
Run 1 (stage):
read_file({"path":"src/devops_cli/config/defaults.py","start_line":343,"end_line":345})read_file({"path":"src/devops_cli/security/base.py","start_line":722,"end_line":746})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":120,"end_line":215})read_file({"path":"src/devops_cli/k8s/image_pins.py","start_line":440,"end_line":462})find_issues({"terms":"k8s lint kube-linter"})references({"name":"Lint Kubernetes manifests with kube-linter. With no TARGET"})read_spec({"capability":"k8s-lint","requirement":"The lint of the environment tree reads the build of each path source"})search_code({"text":"def test_k8s_lint_of_the_tree_lints_the_build_of_each_application","path":"tests"})Run 2 (stage_verify):
read_spec({"capability":"k8s-lint"})read_file({"path":"src/devops_cli/commands/k8s/security_audit.py","start_line":120,"end_line":260})read_file({"path":"src/devops_cli/security/kubelinter.py","start_line":140,"end_line":200})read_file({"path":"src/devops_cli/security/base.py","start_line":690,"end_line":800})search_code({"text":"ci docs"})search_code({"text":"CustomResourceDefinition","path":"src"})search_code({"text":"wall_seconds","path":"src/devops_cli/security"})read_comment({})read_comment({"number":2})search_code({"text":"test_the_tool_listing_matches_the_snapshot"})search_code({"text":"write_text(rendered","path":"src/devops_cli/k8s/image_pins.py"})Tool calls: find_issues=1 (empty=0), read_comment=2 (empty=0), read_file=7 (empty=0), read_spec=2 (empty=0), references=1 (empty=0), search_code=6 (empty=0)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
The plan request held these comments of the item whole: #7900 (comment), #7900 (comment), #7900 (comment), #7900 (comment), #7900 (comment), #7900 (comment).
This run replaced the plan of draft pull request #8003 on the same branch, and opened no second pull request.
dan-petty commentedon Dec 1, 2026
Replaced by dan-petty/github-workflows#69. The measurement on #8003 shows that the cause is the scope
objectKinds: [Any]of the checknetwork-policy-egress-alonein the shared kube-linter config. With the scopeNetworkPolicy, the run takes 56.4 s in place of 283.5 s, with the same 153 errors. This repository needs no change. The acceptance criterion that excludes CustomResourceDefinitions cannot pass, because kube-linter refuses that object kind.