|
| 1 | +# deployscope |
| 2 | + |
| 3 | +Kubernetes deployment monitor — cognitive layer for autonomous agents. Mirror, not oracle. |
| 4 | + |
| 5 | +## Install |
| 6 | + |
| 7 | +```bash |
| 8 | +# Homebrew |
| 9 | +brew install ppiankov/tap/deployscope |
| 10 | + |
| 11 | +# Binary |
| 12 | +curl -LO https://github.com/ppiankov/deployscope/releases/latest/download/deployscope_linux_amd64.tar.gz |
| 13 | +tar -xzf deployscope_linux_amd64.tar.gz |
| 14 | +sudo mv deployscope /usr/local/bin/ |
| 15 | + |
| 16 | +# Go |
| 17 | +go install github.com/ppiankov/deployscope/cmd/deployscope@latest |
| 18 | + |
| 19 | +# Docker |
| 20 | +docker pull ghcr.io/ppiankov/deployscope:latest |
| 21 | +``` |
| 22 | + |
| 23 | +## Commands |
| 24 | + |
| 25 | +### `deployscope serve` |
| 26 | + |
| 27 | +Start HTTP server with REST API, web dashboard, Prometheus metrics. |
| 28 | + |
| 29 | +```bash |
| 30 | +deployscope serve --port 8080 |
| 31 | +``` |
| 32 | + |
| 33 | +**Flags:** `--port` (default: `$PORT` or `8080`) |
| 34 | + |
| 35 | +### `deployscope status` |
| 36 | + |
| 37 | +One-shot cluster health query. Connects to K8s, fetches all workloads, prints status, exits. |
| 38 | + |
| 39 | +```bash |
| 40 | +deployscope status # human table |
| 41 | +deployscope status --format json # machine-readable |
| 42 | +deployscope status --unhealthy --format json # degraded/down only |
| 43 | +``` |
| 44 | + |
| 45 | +**Flags:** `--format` (`table`, `json`), `--unhealthy` (filter to non-green only) |
| 46 | + |
| 47 | +### `deployscope namespaces` |
| 48 | + |
| 49 | +Namespace-level summary with team ownership. |
| 50 | + |
| 51 | +```bash |
| 52 | +deployscope namespaces --format json |
| 53 | +``` |
| 54 | + |
| 55 | +**Flags:** `--format` (`table`, `json`) |
| 56 | + |
| 57 | +### `deployscope init` |
| 58 | + |
| 59 | +Generate config file and example annotation YAML. |
| 60 | + |
| 61 | +```bash |
| 62 | +deployscope init |
| 63 | +# Creates: deployscope.yaml, deployscope-annotations.example.yaml |
| 64 | +``` |
| 65 | + |
| 66 | +### `deployscope doctor` |
| 67 | + |
| 68 | +Validate K8s connectivity, RBAC, annotation coverage, agent-readiness score. |
| 69 | + |
| 70 | +```bash |
| 71 | +deployscope doctor --format json |
| 72 | +``` |
| 73 | + |
| 74 | +**Flags:** `--format` (`text`, `json`) |
| 75 | + |
| 76 | +### `deployscope version` |
| 77 | + |
| 78 | +```bash |
| 79 | +deployscope version --format json |
| 80 | +``` |
| 81 | + |
| 82 | +## Flags |
| 83 | + |
| 84 | +All commands support `--format json` for machine-readable output. Human-readable by default. |
| 85 | + |
| 86 | +## JSON Output |
| 87 | + |
| 88 | +### `deployscope status --format json` |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "summary": { |
| 93 | + "total": 47, |
| 94 | + "healthy": 44, |
| 95 | + "degraded": 2, |
| 96 | + "down": 1 |
| 97 | + }, |
| 98 | + "routing": { |
| 99 | + "action": "escalate", |
| 100 | + "reason": "1 critical-tier service(s) down", |
| 101 | + "targets": ["#platform-oncall"], |
| 102 | + "suggested_wo_priority": "P0" |
| 103 | + }, |
| 104 | + "services": [ |
| 105 | + { |
| 106 | + "id": "platform/auth-service", |
| 107 | + "name": "auth-service", |
| 108 | + "namespace": "platform", |
| 109 | + "workload_type": "deployment", |
| 110 | + "version": "1.5.0", |
| 111 | + "status": "red", |
| 112 | + "replicas": 3, |
| 113 | + "ready_replicas": 0, |
| 114 | + "owner": "team-platform", |
| 115 | + "tier": "critical", |
| 116 | + "managed_by": "argocd", |
| 117 | + "part_of": "auth-platform", |
| 118 | + "depends_on": ["postgres-platform", "redis-shared"], |
| 119 | + "integration": { |
| 120 | + "gitops_repo": "github.com/org/infra", |
| 121 | + "gitops_path": "clusters/prod/auth/", |
| 122 | + "oncall": "#platform-oncall", |
| 123 | + "runbook": "https://wiki.internal/auth-runbook", |
| 124 | + "dashboard": "https://grafana.internal/d/auth", |
| 125 | + "health_endpoint": null, |
| 126 | + "deep_health": null, |
| 127 | + "deep_health_detail": null |
| 128 | + } |
| 129 | + } |
| 130 | + ] |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +### `deployscope doctor --format json` |
| 135 | + |
| 136 | +```json |
| 137 | +{ |
| 138 | + "k8s_connectivity": "ok", |
| 139 | + "total_workloads": 47, |
| 140 | + "annotation_coverage": { |
| 141 | + "owner": 0.72, |
| 142 | + "tier": 0.65, |
| 143 | + "gitops_repo": 0.55, |
| 144 | + "oncall": 0.51, |
| 145 | + "runbook": 0.38, |
| 146 | + "depends_on": 0.25 |
| 147 | + }, |
| 148 | + "agent_readiness": 0.61, |
| 149 | + "warnings": ["less than 30% of workloads have gitops-repo — agents cannot create PRs"] |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +## Exit Codes |
| 154 | + |
| 155 | +| Code | Meaning | |
| 156 | +|------|---------| |
| 157 | +| 0 | All services healthy | |
| 158 | +| 1 | Error (K8s unreachable, RBAC denied) | |
| 159 | +| 2 | Degraded (some services unhealthy) | |
| 160 | + |
| 161 | +## What this does NOT do |
| 162 | + |
| 163 | +- Does NOT mutate Kubernetes resources (read-only RBAC) |
| 164 | +- Does NOT store history (reads current K8s state) |
| 165 | +- Does NOT run ML or probabilistic classification |
| 166 | +- Does NOT auto-remediate (reports state, agents decide action) |
| 167 | +- Does NOT replace a CMDB (mirrors annotations, never invents data) |
| 168 | +- Does NOT provide cluster discovery (single-cluster per binary) |
| 169 | +- Does NOT diagnose root causes (use kubenow for OOM, CrashLoop, events) |
| 170 | + |
| 171 | +## Parsing Examples |
| 172 | + |
| 173 | +```bash |
| 174 | +# Get all unhealthy services as JSON |
| 175 | +deployscope status --unhealthy --format json | jq '.services[]' |
| 176 | + |
| 177 | +# List service names that are down |
| 178 | +deployscope status --format json | jq -r '.services[] | select(.status == "red") | .name' |
| 179 | + |
| 180 | +# Get routing action |
| 181 | +deployscope status --format json | jq -r '.routing.action' |
| 182 | + |
| 183 | +# Check agent readiness score |
| 184 | +deployscope doctor --format json | jq '.agent_readiness' |
| 185 | + |
| 186 | +# Get GitOps repo for a specific service |
| 187 | +deployscope status --format json | jq -r '.services[] | select(.name == "auth-service") | .integration.gitops_repo' |
| 188 | + |
| 189 | +# List all owners across namespaces |
| 190 | +deployscope namespaces --format json | jq -r '.[].owners[]' | sort -u |
| 191 | +``` |
0 commit comments