{
  "repo": "tidbcloud/tidb-operator-cse",
  "binary": "discovery",
  "binary_path": "cmd/discovery/main.go",
  "dependencies": {
    "DiscoveryLifecycle.StartSecretInformer": {
      "infrastructure": {
        "kubernetes_api": [
          {
            "operation": "LIST/WATCH Secret",
            "target": "core/v1 Secrets in MY_POD_NAMESPACE",
            "conditions": [
              "Always"
            ],
            "implementation": "cmd/discovery/main.go:90"
          }
        ]
      },
      "services": []
    },
    "DiscoveryLifecycle.ServeDiscoveryAPI": {
      "infrastructure": {},
      "services": []
    },
    "DiscoveryLifecycle.ServePDProxy": {
      "infrastructure": {},
      "services": []
    },
    "DiscoveryService.DiscoverPDPeer": {
      "infrastructure": {
        "kubernetes_api": [
          {
            "operation": "GET TidbCluster",
            "target": "pingcap.com/v1alpha1 TidbCluster",
            "conditions": [
              "Always"
            ],
            "implementation": "pkg/discovery/discovery.go:92"
          }
        ]
      },
      "services": [
        {
          "name": "pd",
          "target_interface": "PDClient.GetMembers",
          "operation_type": "http_client",
          "target_repo": "tikv/pd",
          "conditions": [
            "When the joining PD member is not the final bootstrap member"
          ],
          "operations": [
            {
              "operation": "GetMembers",
              "trigger": "Build --join list from current PD membership",
              "conditions": [
                "Cluster already has reachable PD members"
              ],
              "implementation": "pkg/discovery/discovery.go:149"
            }
          ]
        }
      ]
    },
    "DiscoveryService.DiscoverByRegisterType": {
      "infrastructure": {
        "kubernetes_api": [
          {
            "operation": "GET TidbCluster or DMCluster",
            "target": "PingCAP CRDs in MY_POD_NAMESPACE",
            "conditions": [
              "Always"
            ],
            "implementation": "pkg/discovery/discovery.go:92"
          }
        ]
      },
      "services": [
        {
          "name": "pd",
          "target_interface": "PDClient.GetMembers",
          "operation_type": "http_client",
          "target_repo": "tikv/pd",
          "conditions": [
            "Only when register-type=pd"
          ],
          "operations": [
            {
              "operation": "GetMembers",
              "trigger": "Build PD join arguments",
              "conditions": [
                "register-type=pd"
              ],
              "implementation": "pkg/discovery/discovery.go:149"
            }
          ]
        },
        {
          "name": "dm-master",
          "target_interface": "MasterClient.GetMasters",
          "operation_type": "http_client",
          "target_repo": "pingcap/tiflow",
          "conditions": [
            "Only when register-type=dm"
          ],
          "operations": [
            {
              "operation": "GetMasters",
              "trigger": "Build DM master join arguments",
              "conditions": [
                "register-type=dm"
              ],
              "implementation": "pkg/discovery/discovery.go:234"
            }
          ]
        }
      ]
    },
    "DiscoveryService.VerifyPDEndpoint": {
      "infrastructure": {
        "kubernetes_api": [
          {
            "operation": "GET TidbCluster",
            "target": "pingcap.com/v1alpha1 TidbCluster",
            "conditions": [
              "Always"
            ],
            "implementation": "pkg/discovery/discovery.go:257"
          }
        ]
      },
      "services": []
    },
    "PDProxyService.ProxyToPD": {
      "infrastructure": {
        "filesystem": [
          {
            "operation": "READ tls.crt/tls.key/ca.crt",
            "target": "member.PdTlsCertPath",
            "conditions": [
              "Only when TC_TLS_ENABLED=true"
            ],
            "implementation": "pkg/discovery/server/proxy.go:41"
          }
        ]
      },
      "services": [
        {
          "name": "pd",
          "target_interface": "HTTP /*",
          "operation_type": "http_proxy",
          "target_repo": "tikv/pd",
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "ReverseProxy.ServeHTTP",
              "trigger": "Forward requests to {tcName}-pd:2379",
              "conditions": [
                "Always"
              ],
              "implementation": "pkg/discovery/server/proxy.go:97"
            }
          ]
        }
      ]
    },
    "DebugService.PprofIndex": {
      "infrastructure": {},
      "services": []
    },
    "DebugService.PprofCmdline": {
      "infrastructure": {},
      "services": []
    },
    "DebugService.PprofProfile": {
      "infrastructure": {},
      "services": []
    },
    "DebugService.PprofSymbol": {
      "infrastructure": {},
      "services": []
    },
    "DebugService.PprofTrace": {
      "infrastructure": {},
      "services": []
    }
  },
  "notes": [
    "The discovery server is source-backed: /new and /verify map directly to pkg/discovery/server/server.go handlers.",
    "ProxyToPD is served on a separate listener and forwards arbitrary traffic to the PD Service, optionally loading local TLS certs from the mounted PD client cert path.",
    "The pprof listener on :6060 is independent from the bootstrap API and proxy listener."
  ]
}
