{
  "repo": "tidbcloud/infra-api",
  "binary": "config-manager",
  "binary_path": "cmd/config-manager/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "services": [
    {
      "name": "ConfigManagerLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "LoadFlagsAndLogger",
          "name_key": "Runtime ConfigManagerLifecycle.LoadFlagsAndLogger",
          "input": "metrics-bind-address, health-probe-bind-address, leader-elect, gc-period, config-revision-ttl",
          "output": "parsed runtime flags and zap logger",
          "type": "local"
        },
        {
          "name": "CreateManager",
          "name_key": "Runtime ConfigManagerLifecycle.CreateManager",
          "input": "controller-runtime rest config plus metrics/probe/webhook addresses",
          "output": "controller-runtime manager with metrics, probe, and webhook servers",
          "type": "local"
        },
        {
          "name": "RegisterClusterConfigController",
          "name_key": "Runtime ConfigManagerLifecycle.RegisterClusterConfigController",
          "input": "manager",
          "output": "ClusterConfig controller registered",
          "type": "local"
        },
        {
          "name": "RegisterGarbageCollector",
          "name_key": "Runtime ConfigManagerLifecycle.RegisterGarbageCollector",
          "input": "manager plus gc-period and config-revision-ttl",
          "output": "leader-elected garbage collector worker added to the manager",
          "type": "local"
        },
        {
          "name": "RegisterClusterRevisionWebhook",
          "name_key": "Runtime ConfigManagerLifecycle.RegisterClusterRevisionWebhook",
          "input": "manager webhook server",
          "output": "cluster create mutating admission webhook registered",
          "type": "local"
        },
        {
          "name": "RegisterHealthChecks",
          "name_key": "Runtime ConfigManagerLifecycle.RegisterHealthChecks",
          "input": "manager probe server",
          "output": "/healthz and /readyz probes registered",
          "type": "local"
        },
        {
          "name": "StartManager",
          "name_key": "Runtime ConfigManagerLifecycle.StartManager",
          "input": "signal-aware context",
          "output": "controller-runtime manager running reconciler, webhook, metrics, and probe servers",
          "type": "local"
        }
      ]
    },
    {
      "name": "ClusterConfigController",
      "package": "controllers/clusterconfig",
      "methods": [
        {
          "name": "Reconcile",
          "name_key": "Runtime ClusterConfigController.Reconcile",
          "input": "Cluster reconcile request",
          "output": "Cluster.spec.configRevisionRef updated when configuration changed",
          "type": "controller_runtime"
        }
      ]
    },
    {
      "name": "ConfigRevisionGarbageCollector",
      "package": "controllers/clusterconfig",
      "methods": [
        {
          "name": "RunGarbageCollection",
          "name_key": "Runtime ConfigRevisionGarbageCollector.RunGarbageCollection",
          "input": "periodic timer tick",
          "output": "expired unreferenced ConfigRevision resources deleted",
          "type": "background_worker"
        }
      ]
    },
    {
      "name": "ConfigManagerWebhookHTTP",
      "package": "cmd/config-manager/webhooks",
      "type": "http",
      "methods": [
        {
          "name": "POST /mutate-cloud-pingcap-com-v1-cluster-revision",
          "name_key": "HTTP POST /mutate-cloud-pingcap-com-v1-cluster-revision",
          "path": "/mutate-cloud-pingcap-com-v1-cluster-revision",
          "http_method": "POST",
          "input": "AdmissionReview for Cluster create",
          "output": "Cluster object patched with spec.configRevisionRef when missing",
          "type": "webhook"
        }
      ]
    },
    {
      "name": "ConfigManagerMetricsHTTP",
      "package": "controller-runtime metrics server",
      "type": "http",
      "methods": [
        {
          "name": "ANY /metrics",
          "name_key": "HTTP GET /metrics",
          "path": "/metrics",
          "http_method": "ANY",
          "input": "Prometheus scrape request",
          "output": "controller-runtime metrics payload",
          "type": "http"
        }
      ]
    },
    {
      "name": "ConfigManagerProbeHTTP",
      "package": "controller-runtime probe server",
      "type": "http",
      "methods": [
        {
          "name": "GET /healthz",
          "name_key": "HTTP GET /healthz",
          "path": "/healthz",
          "http_method": "GET",
          "input": "none",
          "output": "healthz ping response",
          "type": "http"
        },
        {
          "name": "GET /readyz",
          "name_key": "HTTP GET /readyz",
          "path": "/readyz",
          "http_method": "GET",
          "input": "none",
          "output": "readyz ping response",
          "type": "http"
        }
      ]
    }
  ],
  "extensions": {
    "notes": [
      "The mutating webhook path name mentions cluster-revision, but the webhook actually handles Cluster create admissions and writes spec.configRevisionRef onto the Cluster object.",
      "The garbage collector is a manager runnable with NeedLeaderElection() == true, so the periodic cleanup loop only runs on the elected leader.",
      "The binary exposes three distinct listener surfaces through controller-runtime: metrics on the metrics-bind address, probes on the health-probe address, and the webhook server on port 9443."
    ]
  }
}
