• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

karellen / kubernator / 24621395421
82%

Build:
DEFAULT BRANCH: master
Ran 19 Apr 2026 06:14AM UTC
Jobs 5
Files 39
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

19 Apr 2026 04:58AM UTC coverage: 81.992% (+4.1%) from 77.939%
24621395421

push

github

web-flow
Add OpenAPI v3 validation with CEL rules; extract validator into k8s_schema (#104)

## Summary

Extracts all OpenAPI validation out of `k8s.py` / `k8s_api.py` into a
new `kubernator/plugins/k8s_schema/` package, and adds an OpenAPI v3
validator with client-side CEL rule evaluation as the default on
clusters ≥ 1.27.

- **`k8s_api.py` no longer does validation** — `K8SResourcePluginMixin`
holds a single `self.validator` and delegates every manifest check
(minimal envelope → rdef lookup → full schema → CEL rules) to it.
Dependency graph is one-way: `k8s_schema → k8s_api`.
- **Two validators behind a factory.** `SwaggerV2Validator` preserves
current behaviour (swagger.json + OAS31). `OpenAPIV3Validator` is new:
cluster-first `/openapi/v3` discovery with GitHub fallback, lazy
per-group fetch, transitive `$ref` closure across group documents.
- **K8s extensions enforced client-side** under v3:
`x-kubernetes-list-type` (`atomic` / `set` / `map` with
`list-map-keys`), `-preserve-unknown-fields`, `-embedded-resource`,
`-int-or-string`.
- **CEL rules evaluated client-side.** Lazy-compiled, cached by rule
text for the run. Ports of the K8s CEL libraries — `lists`, `regex`,
`format.named(...)`, `quantity`, `IP`, `CIDR` — plus a compatibility
shim for `optional.of` / `optional.none` / `hasValue` / `value` /
`orValue` so `optionalSelf` / `optionalOldSelf` work. Transition rules
fire in the apply path against the cluster's current state.
- **Selection.** `ktor.k8s.register()` gains `openapi_version` (`auto` /
`v2` / `v3`) and `openapi_source` (`auto` / `cluster` / `github`) kwargs
(also readable from context). `auto` gates on server minor ≥ 1.27 and
falls back to v2 on any v3 failure. `istio.py` is migrated to the same
factory.

New dep: `cel-python ~=0.5`.

## Test plan

- [x] 111 unit tests (v2 parity; v3 lazy fetch; api_versions without
sub-doc fetch; source fallback; every extension keyword; CEL walker +
evaluator; 7 extension libraries; factory selection / vers... (continued)

943 of 1328 branches covered (71.01%)

Branch coverage included in aggregate %.

1040 of 1082 new or added lines in 18 files covered. (96.12%)

6 existing lines in 2 files now uncovered.

3979 of 4675 relevant lines covered (85.11%)

4.25 hits per line

Uncovered Changes

Lines Coverage ∆ File
14
92.75
src/main/python/kubernator/plugins/k8s_schema/v3.py
5
79.77
-1.24% src/main/python/kubernator/plugins/k8s.py
5
91.84
src/main/python/kubernator/plugins/k8s_schema/__init__.py
5
94.67
src/main/python/kubernator/plugins/k8s_schema/cel/__init__.py
4
95.24
src/main/python/kubernator/plugins/k8s_schema/base.py
2
79.58
-1.08% src/main/python/kubernator/plugins/k8s_api.py
2
98.73
src/main/python/kubernator/plugins/k8s_schema/cel/extensions/format_lib.py
2
92.86
src/main/python/kubernator/plugins/k8s_schema/v2.py
1
94.12
src/main/python/kubernator/plugins/k8s_schema/cel/extensions/cidr_lib.py
1
96.72
src/main/python/kubernator/plugins/k8s_schema/cel/extensions/lists.py
1
96.84
src/main/python/kubernator/plugins/k8s_schema/cel/rules.py

Coverage Regressions

Lines Coverage ∆ File
5
79.58
-1.08% src/main/python/kubernator/plugins/k8s_api.py
1
77.46
-0.29% src/main/python/kubernator/plugins/k3d.py
Jobs
ID Job ID Ran Files Coverage
1 24621395421.1 19 Apr 2026 06:14AM UTC 39
81.84
GitHub Action Run
2 24621395421.2 19 Apr 2026 06:18AM UTC 39
81.84
GitHub Action Run
3 24621395421.3 19 Apr 2026 06:20AM UTC 39
81.84
GitHub Action Run
4 24621395421.4 19 Apr 2026 06:21AM UTC 39
81.86
GitHub Action Run
5 24621395421.5 19 Apr 2026 06:22AM UTC 39
81.84
GitHub Action Run
Source Files on build 24621395421
  • Tree
  • List 39
  • Changed 5
  • Source Changed 0
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 4beb0d8b on github
  • Prev Build on master (#24580658204)
  • Next Build on master (#24637370495)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc