Files
obsidian-sympozium/03-CRD/SympoziumPolicy.md
2026-03-25 00:05:57 +01:00

96 lines
2.8 KiB
Markdown

# SympoziumPolicy
#sympozium #crd #policy #security
## Definicja
`SympoziumPolicy` definiuje **polityki governance** nad zachowaniem agentów: sandbox requirements, network isolation, tool access i resource limits.
**Plik:** `api/v1alpha1/sympoziumpolicy_types.go`
## Spec
```yaml
apiVersion: sympozium.ai/v1alpha1
kind: SympoziumPolicy
metadata:
name: restrictive
spec:
sandboxPolicy:
required: true # Sandbox obowiązkowy
defaultImage: sandbox:v1
maxCPU: "1"
maxMemory: "1Gi"
allowHostMounts: false
seccompProfile:
type: RuntimeDefault
agentSandboxPolicy: # Agent Sandbox (gVisor/Kata)
required: true
defaultRuntimeClass: gvisor
allowedRuntimeClasses: [gvisor, kata]
subagentPolicy:
maxDepth: 3 # Max zagnieżdżenie sub-agentów
maxConcurrent: 5 # Max równoległych
toolGating:
defaultAction: deny # deny/allow/ask
rules:
- tool: read_file
action: allow
- tool: execute_command
action: deny
- tool: write_file
action: ask
featureGates:
memory: true
web-endpoint: false
channels: true
networkPolicy:
denyAll: true # Deny-all egress
allowDNS: true # Wyjątek: DNS
allowEventBus: true # Wyjątek: NATS
allowedEgress: # Dodatkowe wyjątki
- host: "api.openai.com"
port: 443
```
## Enforcement
Polityki są enforced przez **admission webhook** - nie at runtime, ale **at admission time** (przed utworzeniem poda):
```
AgentRun CR → API Server → Admission Webhook → SympoziumPolicy check
├── PASS → CR created
└── DENY → CR rejected
```
## Presetowe polityki
| Polityka | Kto | Kluczowe reguły |
|----------|-----|-----------------|
| **Permissive** | Dev, demo | Wszystkie tools dozwolone, brak sandbox requirement |
| **Default** | Ogólne użycie | `execute_command` wymaga approval, reszta dozwolona |
| **Restrictive** | Produkcja | Wszystko domyślnie denied, whitelist, sandbox required |
## NetworkPolicy
Polityka `networkPolicy` generuje Kubernetes NetworkPolicy:
- **denyAll: true** - agent pods nie mają dostępu do internetu ani innych podów
- **allowDNS: true** - wyjątek dla rozwiązywania nazw
- **allowEventBus: true** - wyjątek dla NATS (tylko IPC bridge)
- **allowedEgress** - whitelist konkretnych endpointów (np. API providerów LLM)
## Status
```yaml
status:
boundInstances: 5 # Ile instancji używa tej polityki
```
---
Powiązane: [[Model bezpieczeństwa Defence-in-Depth]] | [[Admission Webhooks i polityki]] | [[NetworkPolicy i izolacja sieciowa]]