Skip to content

feat(sandbox): report the applied generation and a none tier in node status - #485

Merged
matthyx merged 3 commits into
kubescape:feat/sandbox-policy-crd-apifrom
AlonLiwsky:feat/node-status-applied-generation
Nov 9, 2026
Merged

matthyx merged 3 commits into
kubescape:feat/sandbox-policy-crd-apifrom
AlonLiwsky:feat/node-status-applied-generation

Conversation

@AlonLiwsky

@AlonLiwsky AlonLiwsky commented Nov 9, 2026 •

Copy link
Copy Markdown

Overview

Two small additions to SandboxPolicyNodeStatus.status, on top of #428.

appliedGeneration — the parent policy generation the node enforces now. 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; that was only in the free-text ActiveRevision message. When bindings differ it is the oldest one; it is absent when the node enforces nothing. Admission rejects appliedGeneration > 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-only would promise events that never come).

How to Test

go test ./pkg/apis/sandbox/... ./hack/sandbox-crds
hack/verify-sandbox-crds.sh -count=1

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

AlonLiwsky and others added 2 commits November 9, 2026 11:59
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>
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f3bc56c-f1a7-4c18-9733-8f7fee54cdfe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

AlonLiwsky added a commit to AlonLiwsky/node-agent that referenced this pull request Nov 9, 2026
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 matthyx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@matthyx matthyx moved this to Waiting on Author in KS PRs tracking Nov 9, 2026
@matthyx
matthyx merged commit fa55b25 into kubescape:feat/sandbox-policy-crd-api Nov 9, 2026
8 checks passed
AlonLiwsky added a commit to AlonLiwsky/node-agent that referenced this pull request Nov 9, 2026
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>
@matthyx matthyx moved this from Waiting on Author to To Archive in KS PRs tracking Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Archive

Development

Successfully merging this pull request may close these issues.

2 participants