rdev/deployments/k8s/base/network-policy.yaml
jordan aaf66764fb feat: add worker pool infrastructure for composable projects
- Add POST /workers/register and POST /workers/{workerId}/heartbeat endpoints
- Start worker health checker goroutine in main.go
- Fix network policy to allow K8s API server access (includes real endpoint IPs)
- Add rdev.orchard9.ai/role: worker label to claudebox StatefulSet

This enables the embedded WorkExecutor to reach claudebox-0 for executing
builds on composable projects that don't have dedicated pods.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 19:55:37 -07:00

111 lines
3.0 KiB
YAML

# Network Policy for rdev-api
# Restricts network access to only required endpoints
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: rdev-api-policy
namespace: rdev
labels:
app.kubernetes.io/name: rdev-api
app.kubernetes.io/part-of: rdev
spec:
podSelector:
matchLabels:
app: rdev-api
policyTypes:
- Ingress
- Egress
ingress:
# Allow ingress from Traefik ingress controller (k3s default)
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
ports:
- protocol: TCP
port: 8080
# Allow ingress from within the rdev namespace (for service mesh, probes)
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: rdev
ports:
- protocol: TCP
port: 8080
egress:
# Allow egress to Kubernetes API server (required for kubectl exec into worker pods)
# Must include both the ClusterIP (10.43.0.1) and real endpoints
- to:
- ipBlock:
cidr: 10.43.0.1/32
- ipBlock:
cidr: 208.122.204.172/32
- ipBlock:
cidr: 208.122.204.173/32
ports:
- protocol: TCP
port: 443
- protocol: TCP
port: 6443
# Allow egress to PostgreSQL in databases namespace
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: databases
ports:
- protocol: TCP
port: 5432
# Allow egress to CockroachDB in databases namespace
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: databases
ports:
- protocol: TCP
port: 26257
# Allow egress to Redis in databases namespace
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: databases
ports:
- protocol: TCP
port: 6379
# Allow egress to worker pods (claudebox) within the rdev namespace
- to:
- podSelector:
matchLabels:
rdev.orchard9.ai/role: worker
# Allow egress to project pods within the rdev namespace
- to:
- podSelector:
matchLabels:
rdev.orchard9.ai/project: "true"
# Allow egress to threesix namespace (Gitea, Woodpecker CI)
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: threesix
# Allow DNS resolution
- to:
- namespaceSelector: {}
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
# Allow egress to external HTTPS services (Gitea, Cloudflare, Woodpecker CI)
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
ports:
- protocol: TCP
port: 443