{
  "repo": "tidbcloud/config-service",
  "binary": "config-service",
  "binary_path": "app/config-service/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "extensions": {
    "notes": [
      "The binary runs two independent runtimes in parallel: a standalone stdlib HTTP server on :8090 and a controller-runtime manager that only hosts metrics plus the leader-elected ClusterConfigController runnable.",
      "The tenant-scoped watcher helpers exist in source but are never started from main(); only the alive-cluster watcher is part of the actual runtime surface.",
      "All three Describe* HTTP handlers share the same ClusterConfig lookup and optional config-eval path; their differences are in output shaping for component config vs backup/restore config."
    ]
  },
  "services": [
    {
      "name": "ConfigServiceLifecycle",
      "package": "app/config-service",
      "methods": [
        {
          "name": "LoadFlagsAndLogger",
          "name_key": "ConfigServiceLifecycle.LoadFlagsAndLogger",
          "input": "metrics-addr, enable-leader-election, leader-election-namespace, account-svc-host, core-svc-host, gardener-project, config-file, log-level, activity, activity-hub, source-key, clinic, clinic-token",
          "output": "parsed runtime flags and configured logger level",
          "type": "local"
        },
        {
          "name": "ParsePreConfig",
          "name_key": "ConfigServiceLifecycle.ParsePreConfig",
          "input": "config-file",
          "output": "preconfig.yaml parsed into in-process preconfig store",
          "type": "local"
        },
        {
          "name": "WarmupAuth0Tokens",
          "name_key": "ConfigServiceLifecycle.WarmupAuth0Tokens",
          "input": "AUTH0_* and PROXY_AUTH0_* env vars",
          "output": "central-service token and PD-proxy token validated and cached",
          "type": "local"
        },
        {
          "name": "CreateManager",
          "name_key": "ConfigServiceLifecycle.CreateManager",
          "input": "controller-runtime rest config plus leader-election settings",
          "output": "controller-runtime manager with metrics listener",
          "type": "local"
        },
        {
          "name": "BuildBaseClusterClient",
          "name_key": "ConfigServiceLifecycle.BuildBaseClusterClient",
          "input": "in-cluster controller-runtime rest config",
          "output": "direct base-cluster controller-runtime client",
          "type": "local"
        },
        {
          "name": "BuildGardenerClientSet",
          "name_key": "ConfigServiceLifecycle.BuildGardenerClientSet",
          "input": "base-cluster client",
          "output": "garden cluster kubernetes clientset",
          "type": "local"
        },
        {
          "name": "BuildInfraAPIClient",
          "name_key": "ConfigServiceLifecycle.BuildInfraAPIClient",
          "input": "base-cluster client plus scheme",
          "output": "infra-api controller-runtime client built from kubeconfig secret",
          "type": "local"
        },
        {
          "name": "InitEventClient",
          "name_key": "ConfigServiceLifecycle.InitEventClient",
          "input": "activity-hub and clinic flags",
          "output": "global activity-hub client initialized when activity mode is enabled",
          "type": "local"
        },
        {
          "name": "BuildTenantLister",
          "name_key": "ConfigServiceLifecycle.BuildTenantLister",
          "input": "account-svc-host and Auth0 client credentials",
          "output": "tenant lister for management portal org APIs",
          "type": "local"
        },
        {
          "name": "BuildClusterLister",
          "name_key": "ConfigServiceLifecycle.BuildClusterLister",
          "input": "core-svc-host, Auth0 credentials, gardener clientset, gardener-project, and PD proxy auth",
          "output": "cluster lister that resolves shoot kubeconfigs and PD proxy clients",
          "type": "local"
        },
        {
          "name": "RegisterClusterConfigController",
          "name_key": "ConfigServiceLifecycle.RegisterClusterConfigController",
          "input": "manager, infra-api client, tenant lister, cluster lister, and activity flag",
          "output": "leader-elected alive-cluster watcher runnable added to manager",
          "type": "local"
        },
        {
          "name": "RegisterHTTPRoutes",
          "name_key": "ConfigServiceLifecycle.RegisterHTTPRoutes",
          "input": "ServeMux",
          "output": "/healthz and three configuration endpoints registered on :8090",
          "type": "local"
        },
        {
          "name": "StartHTTPServer",
          "name_key": "ConfigServiceLifecycle.StartHTTPServer",
          "input": "fixed address :8090",
          "output": "standalone HTTP server for configuration lookup APIs",
          "type": "local"
        },
        {
          "name": "StartManager",
          "name_key": "ConfigServiceLifecycle.StartManager",
          "input": "signal-aware context",
          "output": "controller-runtime manager running metrics and ClusterConfigController",
          "type": "local"
        }
      ]
    },
    {
      "name": "ConfigServiceHTTP",
      "package": "server",
      "type": "http",
      "methods": [
        {
          "name": "GET /healthz",
          "name_key": "ConfigServiceHTTP.Healthz",
          "path": "/healthz",
          "http_method": "GET",
          "input": "none",
          "output": "HTTP 200",
          "type": "http"
        },
        {
          "name": "POST /api/v1/cluster/configuration",
          "name_key": "ConfigServiceHTTP.ClusterConfiguration",
          "path": "/api/v1/cluster/configuration",
          "http_method": "POST",
          "input": "DescribeClusterConfigInput JSON",
          "output": "DescribeClusterConfigOutput JSON",
          "type": "http"
        },
        {
          "name": "POST /api/v1/backup/configuration",
          "name_key": "ConfigServiceHTTP.BackupConfiguration",
          "path": "/api/v1/backup/configuration",
          "http_method": "POST",
          "input": "DescribeBRConfigInput JSON",
          "output": "DescribeBRConfigOutput JSON for backup",
          "type": "http"
        },
        {
          "name": "POST /api/v1/restore/configuration",
          "name_key": "ConfigServiceHTTP.RestoreConfiguration",
          "path": "/api/v1/restore/configuration",
          "http_method": "POST",
          "input": "DescribeBRConfigInput JSON",
          "output": "DescribeBRConfigOutput JSON for restore",
          "type": "http"
        }
      ]
    },
    {
      "name": "ClusterConfigWatcher",
      "package": "controllers",
      "methods": [
        {
          "name": "Start",
          "name_key": "ClusterConfigWatcher.Start",
          "input": "manager context",
          "output": "alive-cluster watcher started until context cancellation",
          "type": "background_worker"
        },
        {
          "name": "SyncAliveClusters",
          "name_key": "ClusterConfigWatcher.SyncAliveClusters",
          "input": "periodic 2-minute ticker",
          "output": "all alive non-devtier dedicated clusters reconciled from core-svc",
          "type": "background_worker"
        },
        {
          "name": "ReconcileAliveCluster",
          "name_key": "ClusterConfigWatcher.ReconcileAliveCluster",
          "input": "cluster metadata from core-svc",
          "output": "PD config and TidbCluster resource patched, plus optional activity event",
          "type": "background_worker"
        }
      ]
    }
  ]
}
