{
  "repo": "pingcap/advanced-statefulset",
  "binary": "controller-manager",
  "binary_path": "cmd/controller-manager/main.go",
  "dependencies": {
    "AdvancedStatefulSetLifecycle.InitializeControllerManagerCommand": {
      "infrastructure": {},
      "services": []
    },
    "AdvancedStatefulSetLifecycle.BuildControllerConfig": {
      "infrastructure": {},
      "services": [
        {
          "name": "kubernetes-apiserver",
          "target_interface": "core API clients and event sink",
          "operation_type": "k8s_api",
          "conditions": [
            "kubeconfig or in-cluster config is valid"
          ],
          "operations": [
            {
              "operation": "INITIALIZE CORE CLIENTS",
              "trigger": "Create the kube client, event recorder sink, and controller revision/status clients",
              "conditions": [
                "ApplyTo(...) succeeds"
              ],
              "implementation": "options.ApplyTo -> clientset.NewForConfig(...) + CoreV1().Events(\"\")"
            }
          ]
        },
        {
          "name": "advanced-statefulset-crd-api",
          "target_interface": "pingcap.com StatefulSet client",
          "operation_type": "k8s_api",
          "conditions": [
            "CRD client initialization succeeds"
          ],
          "operations": [
            {
              "operation": "INITIALIZE CRD CLIENT",
              "trigger": "Create the client used to watch and update Advanced StatefulSet CRDs",
              "conditions": [
                "pcclientset.NewForConfig(...) succeeds"
              ],
              "implementation": "options.ApplyTo -> pcclientset.NewForConfig(...)"
            }
          ]
        }
      ]
    },
    "AdvancedStatefulSetLifecycle.StartLeaderElection": {
      "infrastructure": {},
      "services": [
        {
          "name": "kubernetes-coordination-api",
          "target_interface": "Lease/lock resource",
          "operation_type": "k8s_api",
          "conditions": [
            "LeaderElection.LeaderElect is enabled"
          ],
          "operations": [
            {
              "operation": "ACQUIRE LEADER LOCK",
              "trigger": "Ensure only one controller-manager instance actively reconciles",
              "conditions": [
                "makeLeaderElectionConfig(...) succeeds"
              ],
              "implementation": "makeLeaderElectionConfig -> resourcelock.New(...) -> leaderElector.Run(ctx)"
            }
          ]
        }
      ]
    },
    "AdvancedStatefulSetLifecycle.StartInformerFactories": {
      "infrastructure": {},
      "services": [
        {
          "name": "kubernetes-apiserver",
          "target_interface": "shared informer watch/list endpoints",
          "operation_type": "k8s_watch",
          "conditions": [
            "controller runtime is active"
          ],
          "operations": [
            {
              "operation": "WATCH CORE RESOURCES",
              "trigger": "Start pod, PVC, and controller revision informer caches",
              "conditions": [
                "informerFactory.Start(ctx.Done()) is invoked"
              ],
              "implementation": "app.Run -> informers.NewSharedInformerFactory(...) -> informerFactory.Start(ctx.Done())"
            }
          ]
        },
        {
          "name": "advanced-statefulset-crd-api",
          "target_interface": "StatefulSet CRD informer watch/list endpoints",
          "operation_type": "k8s_watch",
          "conditions": [
            "controller runtime is active"
          ],
          "operations": [
            {
              "operation": "WATCH ADVANCED STATEFULSETS",
              "trigger": "Start informer caches for pingcap.com StatefulSet CRDs",
              "conditions": [
                "pcInformerFactory.Start(ctx.Done()) is invoked"
              ],
              "implementation": "app.Run -> pcinformers.NewSharedInformerFactory(...) -> pcInformerFactory.Start(ctx.Done())"
            }
          ]
        }
      ]
    },
    "AdvancedStatefulSetLifecycle.StartStatefulSetController": {
      "infrastructure": {},
      "services": [
        {
          "name": "kubernetes-apiserver",
          "target_interface": "Pods/PVCs/ControllerRevisions CRUD",
          "operation_type": "k8s_api",
          "conditions": [
            "controller workers are running"
          ],
          "operations": [
            {
              "operation": "RECONCILE STATEFULSET CHILD RESOURCES",
              "trigger": "Create, patch, delete, and observe pods/PVCs/controller revisions for Advanced StatefulSets",
              "conditions": [
                "StatefulSetController.Run(...) has started workers"
              ],
              "implementation": "app.Run -> statefulset.NewStatefulSetController(...) -> stsCtrl.Run(runtime.NumCPU(), ctx.Done())"
            }
          ]
        },
        {
          "name": "advanced-statefulset-crd-api",
          "target_interface": "StatefulSet status update API",
          "operation_type": "k8s_api",
          "conditions": [
            "controller workers are running"
          ],
          "operations": [
            {
              "operation": "UPDATE ADVANCED STATEFULSET STATUS",
              "trigger": "Persist reconcile results and revision history back to the CRD",
              "conditions": [
                "defaultStatefulSetControl.UpdateStatefulSet(...) completes status computation"
              ],
              "implementation": "StatefulSetController worker -> defaultStatefulSetControl.UpdateStatefulSet(...) -> updateStatefulSetStatus(...)"
            }
          ]
        }
      ]
    }
  }
}
