{
  "repo": "tidbcloud/autoscaler",
  "binary": "balancer",
  "binary_path": "balancer/main.go",
  "surface_kind": "controller_service",
  "type": "controller_service",
  "extensions": {},
  "services": [
    {
      "name": "BalancerLifecycle",
      "type": "lifecycle",
      "methods": [
        {
          "name": "LoadFlags",
          "name_key": "BalancerLifecycle.LoadFlags",
          "description": "Parse balancer startup flags such as kubeconfig, master, reprocess period, and concurrency."
        },
        {
          "name": "BuildKubeConfig",
          "name_key": "BalancerLifecycle.BuildKubeConfig",
          "description": "Build the Kubernetes REST config from --master and --kubeconfig."
        },
        {
          "name": "InitKubernetesClients",
          "name_key": "BalancerLifecycle.InitKubernetesClients",
          "description": "Construct the core Kubernetes client and the Balancer CRD clientset."
        },
        {
          "name": "InitInformerFactories",
          "name_key": "BalancerLifecycle.InitInformerFactories",
          "description": "Create shared informer factories for Pods and Balancer CRDs."
        },
        {
          "name": "InitRESTMapper",
          "name_key": "BalancerLifecycle.InitRESTMapper",
          "description": "Initialize the cached discovery client and deferred REST mapper used by the scale client."
        },
        {
          "name": "StartRESTMapperResetLoop",
          "name_key": "BalancerLifecycle.StartRESTMapperResetLoop",
          "description": "Start the periodic mapper reset loop."
        },
        {
          "name": "BuildScaleClient",
          "name_key": "BalancerLifecycle.BuildScaleClient",
          "description": "Construct the Kubernetes scale subresource client."
        },
        {
          "name": "BuildCore",
          "name_key": "BalancerLifecycle.BuildCore",
          "description": "Create the balancing core with pod lister and scale client."
        },
        {
          "name": "BuildController",
          "name_key": "BalancerLifecycle.BuildController",
          "description": "Create the Balancer controller and register Balancer informer event handlers."
        },
        {
          "name": "StartInformerFactories",
          "name_key": "BalancerLifecycle.StartInformerFactories",
          "description": "Start the Pod and Balancer informer factories."
        },
        {
          "name": "RunController",
          "name_key": "BalancerLifecycle.RunController",
          "description": "Wait for caches to sync and run the controller worker loop."
        }
      ]
    },
    {
      "name": "BalancerController",
      "type": "controller",
      "methods": [
        {
          "name": "ReconcileBalancer",
          "name_key": "BalancerController.ReconcileBalancer",
          "description": "Reconcile one Balancer CR by reading target scales and pods, applying the balancing policy, and updating scale and status."
        }
      ]
    }
  ]
}
