{
  "repo": "pingcap/tidb-operator",
  "binary": "prestop-checker",
  "binary_path": "cmd/prestop-checker/main.go",
  "dependencies": {
    "Runtime PrestopCheckerLifecycle.ParseFlags": {
      "infrastructure": {
        "runtime_flags": [
          {
            "operation": "PARSE FLAGS",
            "target": "pd, addr, ca, cert, and key",
            "conditions": [
              "Always at process start"
            ],
            "implementation": "cmd/prestop-checker/main.go:45-51"
          }
        ]
      },
      "services": []
    },
    "Runtime PrestopCheckerLifecycle.LoadTLSConfig": {
      "infrastructure": {
        "filesystem": [
          {
            "operation": "READ FILES",
            "target": "CA, certificate, and private key PEM files",
            "conditions": [
              "Only when the PD URL scheme is https",
              "In current source, --ca/--cert/--key are mis-bound to addr, so these reads only work if the global ca/cert/key variables were populated elsewhere"
            ],
            "implementation": "cmd/prestop-checker/main.go:58-65,116-146"
          }
        ]
      },
      "services": []
    },
    "Runtime PrestopCheckerLifecycle.ResolveStoreID": {
      "infrastructure": {},
      "services": [
        {
          "name": "pd-api",
          "target_interface": "GET /pd/api/v1/stores",
          "operation_type": "http_client",
          "target_repo": "pingcap/pd",
          "conditions": [
            "Always after PD client construction",
            "Polls every second for up to 30 seconds until a store address matches --addr"
          ],
          "operations": [
            {
              "operation": "LIST STORES",
              "trigger": "Resolve the PD store ID for the terminating TiKV pod",
              "conditions": [
                "Retries on transient PD errors instead of exiting immediately"
              ],
              "implementation": "cmd/prestop-checker/main.go:67-94"
            }
          ]
        }
      ]
    },
    "Runtime PrestopCheckerLifecycle.WaitForLeaderEviction": {
      "infrastructure": {},
      "services": [
        {
          "name": "pd-api",
          "target_interface": "GET /pd/api/v1/store/{store_id}",
          "operation_type": "http_client",
          "target_repo": "pingcap/pd",
          "conditions": [
            "Always after store ID resolution succeeds",
            "Polls indefinitely every second until LeaderCount becomes zero"
          ],
          "operations": [
            {
              "operation": "GET STORE",
              "trigger": "Block pod termination until the store has no leaders",
              "conditions": [
                "Retries on transient PD errors instead of exiting immediately"
              ],
              "implementation": "cmd/prestop-checker/main.go:98-113"
            }
          ]
        }
      ]
    }
  },
  "notes": [
    "The scan records the real flag-binding bug instead of idealized TLS behavior: --ca, --cert, and --key are all assigned into addr in source."
  ]
}
