H-10 Policy admission
Brick H of the Enterprise AI Platform. Technology: Kyverno (validate, mutate, verifyImages) admission controller. French version: ../../fr/bricks/H-10-policy-admission.md.
Role and responsibilities
- Reject non compliant workloads: unsigned images, missing SBOM attestation, privileged pods, missing limits, latest tags.
Position and interactions
- Execution path: synchronous admission.
- verifyImages checks Cosign signatures (H-13) and attestations from Harbor (H-16).
Open source and developed parts
- Open source reused: Kyverno, Kyverno policies library.
- Developed in the platform: Platform policy set and exceptions process via approvals.
Data model
Control Plane tables (schema eai): eai.audit_events.
Every tenant table has tenant_id uuid NOT NULL and a row level security policy on current_setting('app.tenant_id', true)::uuid. ClickHouse usage_events is the analytics replica of eai.usage_events (ReplacingMergeTree keyed by event_id).
Contract: contracts/v1/policy-contract.schema.json (schema_version 1.0). Usage is always reported with contracts/v1/usage-event.schema.json, audit with contracts/v1/audit-event.schema.json.
API endpoints
| Method | Path |
|---|---|
| POST | /v1/policies/evaluate |
POST /v1/policies/evaluate
Request:
{
"action": "image.deploy",
"resource": {
"type": "image",
"digest": "sha256:ab12"
},
"context": {
"signed": true,
"critical_vulns": 0
}
}
Response:
{
"allow": true,
"reasons": [],
"decision_id": "dec_44"
}
SDK examples
Python
from enterprise_ai import EnterpriseAI
client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_live_xxx", tenant="acme", locale="en")
client.policies.evaluate(request={"action": "image.deploy", "resource": {"type": "image", "digest": "sha256:ab12"}})
TypeScript
import { EnterpriseAI } from "@enterprise-ai/sdk";
const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY, tenant: "acme", locale: "en" });
await client.policies.evaluate({ action: "image.deploy", resource: { type: "image", digest: "sha256:ab12" } });
Java
EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.tenant("acme")
.locale(Locale.ENGLISH)
.build();
client.policies().evaluate(Map.of("action", "image.deploy", "resource", Map.of("type", "image", "digest", "sha256:ab12")));
Go
client, err := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")), eai.WithTenant("acme"), eai.WithLocale("en"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = client.Policies.Evaluate(ctx, map[string]any{"action": "image.deploy", "resource": map[string]any{"type": "image", "digest": "sha256:ab12"}})
Configuration
No EAI_* variable: configured through Helm values and the tool's own configuration.
Helm values keys (deploy/helm/enterprise-ai/values.yaml): global.imageRegistry.
Security
- Policies in Enforce mode in staging and prod, Audit mode in dev.
- Tenant resolved from the credential, never from the body; PostgreSQL row level security on every tenant table.
- Every mutation and policy decision writes a hash chained audit event (G-11).
- Errors use the standard envelope with message_i18n en and fr.
Observability
- PolicyReports exported to Prometheus.
- W3C traceparent propagated, X-Request-Id returned, spans carry eai.tenant_id, eai.project, eai.agent_id, eai.run_id.
FinOps units
- Requires resource requests so cost allocation per namespace is meaningful.
Failure modes and resilience
- Kyverno unavailable -> failurePolicy Fail for prod namespaces.
Standalone adoption
Policy set reusable in any cluster.
Acceptance tests
- Deploying an unsigned image to prod is denied.