Repository navigation
feat(sandbox): report the applied generation and a none tier in node status - #485
Conversation
observedGeneration records the latest attempt, including a rejected one, so a node that keeps last-good bindings had no typed way to say which generation it still enforces. appliedGeneration carries that value, and admission rejects one above observedGeneration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Alon Liwsky <40373481+AlonLiwsky@users.noreply.github.com>
Without BPF LSM the enforcement programs attach but never run, so no existing tier is true: audit-only would claim events that never come. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Alon Liwsky <40373481+AlonLiwsky@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Temporary replace to the fork commit of kubescape/storage#485, until it merges into the sandbox policy API branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Alon Liwsky <40373481+AlonLiwsky@users.noreply.github.com>
matthyx
left a comment
There was a problem hiding this comment.
Reviewed head 284ce4d2 against base feat/sandbox-policy-crd-api (136b4c98, #428 head).
Purpose: adds status.appliedGeneration (generation actually enforced, lags observedGeneration on a rejected revision) and a none tier for nodes without BPF LSM. Both are additive and fit the stated node-agent consumer (node-agent#1068).
Findings: no blockers. The field is optional with minimum: 0; the CEL rule !has(appliedGeneration) || appliedGeneration <= observedGeneration is null-safe. The enum addition is only in schema.go and the generated CRD, with no other tier consumers in the repo. Docs, example and the generated CRD agree.
Validation (local): go test ./pkg/apis/sandbox/... ./hack/sandbox-crds and hack/verify-sandbox-crds.sh -count=1 pass. The new tests cover applied ahead of observed (rejected), negative applied (rejected), applied behind observed (accepted) and tier: none (accepted). Only DCO and GitGuardian ran in CI (both pass, CodeRabbit skipped), so no full CI run backs this.
Related PRs: no duplicates or earlier rejected approaches found (searched appliedGeneration and node status tier). The only related PR is the base, #428, which is still open.
Note (non-blocking): with omitempty, a real applied generation of 0 can't be told apart from "enforces nothing". Policy generations start at 1, so this is fine.
Verdict: approve.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Alon Liwsky <40373481+AlonLiwsky@users.noreply.github.com>
fa55b25
into
kubescape:feat/sandbox-policy-crd-api
kubescape/storage#485 merged, so drop the temporary replace to the fork. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Alon Liwsky <40373481+AlonLiwsky@users.noreply.github.com>
Overview
Two small additions to
SandboxPolicyNodeStatus.status, on top of #428.appliedGeneration— the parent policy generation the node enforces now.observedGenerationrecords the latest attempt, including a rejected one, so a node that keeps last-good bindings had no typed way to say which generation it still enforces; that was only in the free-textActiveRevisionmessage. When bindings differ it is the oldest one; it is absent when the node enforces nothing. Admission rejectsappliedGeneration > observedGeneration.tier: none— without BPF LSM the node-agent's enforcement programs attach but never run, so the node neither blocks nor audits. None of the existing tiers is true in that case (audit-onlywould promise events that never come).How to Test
New validation cases: applied ahead of observed (rejected), negative applied (rejected), last-good applied behind observed (accepted),
tier: none(accepted).Related issues/PRs
🤖 Generated with Claude Code