{
  "repo": "tidbcloud/operationlet",
  "binary": "operationlet",
  "binary_path": "cmd/operationlet/main.go",
  "dependencies": {
    "Runtime OperationCommandJobReconciler.Reconcile": {
      "description": "Reconciles OperationCommandJob CR to execute cluster operations",
      "infrastructure": {
        "kubernetes_api": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "resource": "OperationCommandJob",
              "trigger": "Fetch CR instance",
              "implementation": "r.Get(ctx, req.NamespacedName, job)"
            },
            {
              "operation": "LIST",
              "resource": "OperationCommandJob",
              "trigger": "Check for running jobs in cluster",
              "conditions": ["Job in Pending phase"],
              "implementation": "r.Client.List(ctx, &lister, listOptions)"
            },
            {
              "operation": "LIST",
              "resource": "Pod",
              "trigger": "Find target pod instance",
              "conditions": ["Job type is RestartPod"],
              "implementation": "r.Client.List(ctx, &targetPod, option)"
            },
            {
              "operation": "DELETE",
              "resource": "Pod",
              "trigger": "Restart pod by deleting it",
              "conditions": ["Job type is RestartPod", "Target pod found"],
              "implementation": "r.Client.Delete(ctx, &targetPod.Items[0])"
            },
            {
              "operation": "UPDATE",
              "resource": "OperationCommandJob/status",
              "trigger": "Update job phase status",
              "implementation": "r.Status().Update(ctx, job)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime OperationProxyServiceReconciler.Reconcile": {
      "description": "Reconciles OperationProxyService CR to execute pd-ctl commands",
      "infrastructure": {
        "kubernetes_api": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "resource": "OperationProxyService",
              "trigger": "Fetch CR instance",
              "implementation": "r.Get(ctx, req.NamespacedName, job)"
            },
            {
              "operation": "LIST",
              "resource": "Pod",
              "trigger": "Find PD pod instance",
              "conditions": ["Job in Pending phase"],
              "implementation": "r.Client.List(ctx, &podList, option)"
            },
            {
              "operation": "UPDATE",
              "resource": "OperationProxyService/status",
              "trigger": "Update job phase and result",
              "implementation": "r.Status().Update(ctx, job)"
            }
          ]
        }
      },
      "services": [
        {
          "name": "pd",
          "target_interface": "pd-ctl CLI (config, region, store, member, label, operator, scheduler, tso, hotspot)",
          "operation_type": "http_proxy",
          "target_repo": "tikv/pd",
          "conditions": ["Job in Pending phase", "PD pod found"],
          "operations": [
            {
              "operation": "pd-ctl CLI commands",
              "trigger": "Execute arbitrary pd-ctl commands via REPL",
              "implementation": "github.com/tidbcloud/operationlet/controllers.GetRootCommand -> github.com/tikv/pd/tools/pd-ctl/pdctl/command.* (config, region, store, member, label, operator, scheduler, tso, hotspot, cluster, health, exit, ping)"
            }
          ]
        }
      ]
    },
    "Runtime OperationAuthorizeServiceReconciler.Reconcile": {
      "description": "Placeholder - not implemented",
      "infrastructure": {},
      "services": []
    },
    "Runtime DiagnosticCollectorJobReconciler.Reconcile": {
      "description": "Reconciles DiagnosticCollectorJob CR to collect diagnostic information",
      "infrastructure": {
        "kubernetes_api": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "resource": "DiagnosticCollectorJob",
              "trigger": "Fetch CR instance",
              "implementation": "r.Get(ctx, req.NamespacedName, job)"
            },
            {
              "operation": "LIST",
              "resource": "Pod",
              "trigger": "Find PD pod",
              "conditions": ["Job type is GetConfig"],
              "implementation": "r.Client.List(context.TODO(), pods, option)"
            },
            {
              "operation": "UPDATE",
              "resource": "DiagnosticCollectorJob/status",
              "trigger": "Update job phase and result",
              "implementation": "r.Status().Update(ctx, job)"
            }
          ]
        }
      },
      "services": [
        {
          "name": "pd",
          "target_interface": "GET /pd/api/v1/config",
          "operation_type": "http_get",
          "target_repo": "tikv/pd",
          "conditions": ["Job type is GetConfig"],
          "operations": [
            {
              "operation": "HTTP GET config",
              "trigger": "Fetch PD config",
              "implementation": "github.com/tidbcloud/operationlet/diagnostic.GetConfig(pdUrl)"
            }
          ]
        }
      ]
    },
    "Runtime DiagnosticAgentServiceReconciler.Reconcile": {
      "description": "Placeholder - not implemented",
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /healthz": {
      "description": "Health check endpoint",
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /readyz": {
      "description": "Readiness check endpoint",
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /metrics": {
      "description": "Prometheus metrics endpoint",
      "infrastructure": {},
      "services": []
    }
  }
}
