potoo

module
v0.1.1-0...-0f9980b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: Apache-2.0

README

Potoo

CI Security Scan codecov Go Report Card Go Version License

Automatic constraint discovery and developer notification for Kubernetes.

Potoo is a Kubernetes operator that automatically discovers all policies, constraints, quotas, and requirements across your cluster — regardless of which policy engine created them — and notifies developers when those constraints are blocking their workloads.

The Problem

Modern Kubernetes clusters enforce constraints through many independent systems: Cilium network policies, Gatekeeper/OPA constraints, Kyverno policies, Istio authorization policies, native NetworkPolicies, ResourceQuotas, ValidatingWebhookConfigurations, and more. When a developer's deployment fails or their traffic is silently dropped, they have no unified way to discover what is blocking them or why. They spend hours debugging across scattered tools, kubectl commands, and Slack messages to platform teams.

What This Does

Potoo sits in your cluster and:

  1. Discovers all constraint-like resources automatically by scanning CRDs, webhooks, network policies, quotas, and mesh configurations
  2. Indexes them into a normalized model regardless of source engine
  3. Correlates failures (admission rejections, traffic drops, missing prerequisites) to the specific constraint causing them
  4. Notifies developers via Kubernetes Events, a ConstraintReport CRD, and optional external channels (Slack, webhooks) — with privacy-aware detail levels that don't leak cross-namespace security information

Key Differentiators

  • Cross-engine: Not tied to any single policy engine. Discovers constraints from Cilium, Gatekeeper, Kyverno, Istio, native K8s, and arbitrary CRDs.
  • Automatic discovery: No manual registration of policy types. Scans the cluster's CRDs and heuristically identifies constraint-like resources, with pluggable adapters for deep parsing of known types.
  • Runtime awareness: Integrates with Cilium Hubble for real-time traffic drop detection — developers are notified within seconds when a network policy blocks their traffic.
  • Missing resource detection: Infers when a workload is missing a required companion resource (ServiceMonitor, VirtualService, PeerAuthentication, etc.) and alerts proactively.
  • Privacy-first: Notifications are scoped by role. Developers see actionable summaries without cross-namespace policy details. Platform admins see full constraint specifics.
  • Developer experience focused: The goal is not enforcement (policy engines already do that) but explanation — helping developers understand and resolve constraint issues quickly.

Architecture

See ARCHITECTURE.md for detailed architecture documentation.

┌─────────────────────────────────────────────────┐
│                Potoo               │
│                                                  │
│  ┌─────────────┐  ┌──────────────┐              │
│  │  Discovery   │  │   Adapter    │              │
│  │   Engine     │──│   Registry   │              │
│  │             │  │              │              │
│  │ CRD Scanner │  │ Cilium       │              │
│  │ Heuristic   │  │ Gatekeeper   │              │
│  │ Detection   │  │ Kyverno      │              │
│  └──────┬──────┘  │ Istio        │              │
│         │         │ NetworkPolicy│              │
│         ▼         │ Webhooks     │              │
│  ┌─────────────┐  │ ResourceQuota│              │
│  │  Constraint  │  │ Generic      │              │
│  │   Indexer    │◄─┘              │              │
│  └──────┬──────┘                  │              │
│         │                         │              │
│         ▼                         │              │
│  ┌─────────────┐  ┌──────────────┐              │
│  │ Correlation  │  │  Requirement │              │
│  │   Engine     │  │  Evaluator   │              │
│  │             │  │              │              │
│  │ Events      │  │ Missing CRDs │              │
│  │ Hubble Flows│  │ Missing Mesh │              │
│  │ Dry-Run     │  │ Co-occurrence│              │
│  └──────┬──────┘  └──────┬───────┘              │
│         │                │                       │
│         ▼                ▼                       │
│  ┌─────────────────────────────┐                │
│  │   Notification Dispatcher   │                │
│  │                             │                │
│  │ K8s Events │ ConstraintReport │ Slack/Webhook│
│  └─────────────────────────────┘                │
└─────────────────────────────────────────────────┘

Separate Deployment:
┌─────────────────────────────────────────────────┐
│         Admission Webhook (Warning Mode)         │
│  Deploy-time warnings via K8s admission warnings │
│  failurePolicy: Ignore (always fail-open)        │
└─────────────────────────────────────────────────┘

Quick Start

helm repo add potoo https://potoo.io/charts
helm install potoo potoo/potoo \
  --namespace potoo-system \
  --create-namespace

Then in any namespace:

kubectl get constraintreports -n my-namespace

Project Status

🚀 Alpha — Core discovery, 8 policy adapters (Cilium, Gatekeeper, Kyverno, NetworkPolicy, ResourceQuota, LimitRange, Webhooks, Generic), correlation engine, notification system, MCP server, CLI, admission webhook, and requirements evaluator are implemented and tested. See PROJECT_PLAN.md for the roadmap.

Agent & Automation Interfaces

Potoo is designed for consumption by AI agents and automation tools, not just human developers. Every output has a structured, machine-parseable form.

Interface Who uses it How
MCP Server AI agents (Claude, Copilot, SRE bots) Query constraints, explain errors, pre-check deploys, get remediation
ConstraintReport CRD kubectl, agents, dashboards kubectl get constraintreport -n my-ns -o json — includes machineReadable section
Structured Events Any K8s event consumer Events carry potoo.io/structured-data JSON annotation
Workload Annotations Agents inspecting Deployments potoo.io/constraints JSON annotation on affected workloads
kubectl plugin CLI agents, scripts kubectl sentinel query -n my-ns -o json — matches MCP response schemas
Prometheus Metrics Monitoring agents, alertmanager Per-namespace, per-workload constraint counts and quota utilization
Capabilities API Agent discovery GET /api/v1/capabilities — what adapters/features are active in this cluster

See Agent Outputs for full design documentation.

Documentation

Getting Started

Usage

  • CLI Reference — potoo query, explain, check, remediate, and status commands
  • MCP Server — AI agent integration with tools and resources
  • CRD Reference — ConstraintReport, ConstraintProfile, NotificationPolicy

Reference

  • Architecture — Deployment model, component design, data flow
  • Constraint Types — Network, Admission, Resource, Mesh, and Missing constraint categories
  • Severity Levels — Critical, Warning, and Info definitions
  • Agent Outputs — MCP server, structured events, machine-readable CRDs, kubectl plugin
  • Privacy Model — Information classification and notification scoping
  • Adapters — Supported policy engines and adapter details
  • Notifications — Event, report, and annotation notification system
  • Configuration — Controller and webhook configuration options
  • Adapter Guide — How to write a constraint adapter for a new policy engine
  • Helm Chart — Helm chart documentation and values reference
  • Examples — Standalone YAML manifests for trying out Potoo
  • Changelog — Release history
  • Contributing — How to contribute to the project

License

Apache License 2.0 — See LICENSE.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the potoo.io v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the potoo.io v1alpha1 API group.
cmd
controller command
potooctl command
potooctl is a CLI tool for querying Potoo constraint data.
potooctl is a CLI tool for querying Potoo constraint data.
potooctl/potoo-sentinel command
potoo-sentinel is a CLI tool for querying Potoo constraint data.
potoo-sentinel is a CLI tool for querying Potoo constraint data.
webhook command
internal
adapters/cilium
Package cilium implements an adapter for parsing Cilium network policies.
Package cilium implements an adapter for parsing Cilium network policies.
adapters/gatekeeper
Package gatekeeper implements an adapter for OPA Gatekeeper constraints.
Package gatekeeper implements an adapter for OPA Gatekeeper constraints.
adapters/generic
Package generic provides a fallback constraint adapter for CRDs that don't have a dedicated adapter.
Package generic provides a fallback constraint adapter for CRDs that don't have a dedicated adapter.
adapters/kyverno
Package kyverno implements an adapter for Kyverno policies.
Package kyverno implements an adapter for Kyverno policies.
adapters/limitrange
Package limitrange provides a constraint adapter for core/v1 LimitRange objects.
Package limitrange provides a constraint adapter for core/v1 LimitRange objects.
adapters/resourcequota
Package resourcequota provides a constraint adapter for core/v1 ResourceQuota and core/v1 LimitRange objects.
Package resourcequota provides a constraint adapter for core/v1 ResourceQuota and core/v1 LimitRange objects.
adapters/webhookconfig
Package webhookconfig provides a constraint adapter for admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration and MutatingWebhookConfiguration resources.
Package webhookconfig provides a constraint adapter for admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration and MutatingWebhookConfiguration resources.
annotations
Package annotations defines the structured annotation keys that Potoo writes to Kubernetes Events and workload objects.
Package annotations defines the structured annotation keys that Potoo writes to Kubernetes Events and workload objects.
api
Package api provides HTTP API endpoints for Potoo.
Package api provides HTTP API endpoints for Potoo.
controller
Package controller implements Kubernetes controllers for Potoo-owned CRDs.
Package controller implements Kubernetes controllers for Potoo-owned CRDs.
correlator
Package correlator watches Kubernetes Warning events and matches them to indexed constraints, producing CorrelatedNotification objects.
Package correlator watches Kubernetes Warning events and matches them to indexed constraints, producing CorrelatedNotification objects.
hubble
Package hubble provides a client for connecting to Hubble Relay and observing network flow drops.
Package hubble provides a client for connecting to Hubble Relay and observing network flow drops.
indexer
Package indexer provides a concurrent-safe in-memory store of normalized Constraint objects.
Package indexer provides a concurrent-safe in-memory store of normalized Constraint objects.
mcp
Package mcp implements a Model Context Protocol server that exposes Potoo's data to AI agents.
Package mcp implements a Model Context Protocol server that exposes Potoo's data to AI agents.
notifier
Package notifier renders constraint notifications at the appropriate privacy level and dispatches them via configured channels (K8s Events, ConstraintReport CRD, webhooks).
Package notifier renders constraint notifications at the appropriate privacy level and dispatches them via configured channels (K8s Events, ConstraintReport CRD, webhooks).
requirements
Package requirements detects missing companion resources that a workload likely needs but doesn't have.
Package requirements detects missing companion resources that a workload likely needs but doesn't have.
servicemap
Package servicemap maintains a mapping of Kubernetes Service names to their associated ports and endpoints.
Package servicemap maintains a mapping of Kubernetes Service names to their associated ports and endpoints.
testutil
Package testutil provides shared test helpers for the potoo project.
Package testutil provides shared test helpers for the potoo project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL