{
  "repo": "tidbcloud/shared-provider",
  "binary": "dispatcher",
  "binary_path": "cmd/dispatcher/main.go",
  "dependencies": {
    "HealthService.healthz": {
      "infrastructure": {},
      "services": []
    },
    "HealthService.readyz": {
      "infrastructure": {},
      "services": []
    },
    "MetricsService.metrics": {
      "infrastructure": {},
      "services": []
    },
    "NetworkDispatcher.Reconcile": {
      "infrastructure": {
        "kubernetes-infra": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get Network",
              "trigger": "Fetch Network resource from infra cluster",
              "conditions": ["Always"],
              "implementation": "r.InfraCache.Get(ctx, req.NamespacedName, obj)"
            },
            {
              "operation": "Kubernetes API Update Network",
              "trigger": "Update Network labels with scheduled cluster",
              "conditions": ["scheduleTo != empty"],
              "implementation": "r.InfraClient.Update(ctx, obj)"
            }
          ]
        },
        "kubernetes": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get ConfigMap",
              "trigger": "Read kube cluster config for scheduling decisions",
              "conditions": ["Always"],
              "implementation": "Read from cache with ConfigMap name/namespace selector"
            }
          ]
        }
      },
      "services": []
    },
    "ClusterDispatcher.Reconcile": {
      "infrastructure": {
        "kubernetes": {
          "conditions": ["RescheduleThreshold exceeded"],
          "operations": [
            {
              "operation": "Kubernetes API Get ConfigMap",
              "trigger": "Read kube cluster config for available clusters",
              "conditions": ["len(cl.Items) > RescheduleThreshold"],
              "implementation": "d.Cache.Get(ctx, cmKey, &cm) in getAvailableKubeClusters()"
            }
          ]
        },
        "kubernetes-infra": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get Cluster",
              "trigger": "Fetch Cluster resource from infra cluster",
              "conditions": ["Always"],
              "implementation": "r.InfraCache.Get(ctx, req.NamespacedName, obj)"
            },
            {
              "operation": "Kubernetes API Update Cluster",
              "trigger": "Update Cluster labels with scheduled cluster",
              "conditions": ["scheduleTo != empty"],
              "implementation": "r.InfraClient.Update(ctx, obj)"
            }
          ]
        }
      },
      "services": []
    },
    "RestoreDispatcher.Reconcile": {
      "infrastructure": {
        "kubernetes-infra": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get Restore",
              "trigger": "Fetch Restore resource from infra cluster",
              "conditions": ["Always"],
              "implementation": "r.InfraCache.Get(ctx, req.NamespacedName, obj)"
            },
            {
              "operation": "Kubernetes API Update Restore",
              "trigger": "Update Restore labels",
              "conditions": ["scheduleTo != empty"],
              "implementation": "r.InfraClient.Update(ctx, obj)"
            }
          ]
        }
      },
      "services": []
    },
    "BackupDispatcher.Reconcile": {
      "infrastructure": {
        "kubernetes-infra": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get Backup",
              "trigger": "Fetch Backup resource from infra cluster",
              "conditions": ["Always"],
              "implementation": "r.InfraCache.Get(ctx, req.NamespacedName, obj)"
            },
            {
              "operation": "Kubernetes API Update Backup",
              "trigger": "Update Backup labels",
              "conditions": ["scheduleTo != empty"],
              "implementation": "r.InfraClient.Update(ctx, obj)"
            }
          ]
        }
      },
      "services": []
    },
    "ImportDispatcher.Reconcile": {
      "infrastructure": {
        "kubernetes-infra": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Kubernetes API Get Import",
              "trigger": "Fetch Import resource from infra cluster",
              "conditions": ["Always"],
              "implementation": "r.InfraCache.Get(ctx, req.NamespacedName, obj)"
            },
            {
              "operation": "Kubernetes API Update Import",
              "trigger": "Update Import labels",
              "conditions": ["scheduleTo != empty"],
              "implementation": "r.InfraClient.Update(ctx, obj)"
            }
          ]
        }
      },
      "services": []
    }
  },
  "notes": [
    "Connects to two Kubernetes clusters: main (shared EKS) and infra (infra API server)",
    "Scheduling decisions are based on ConfigMap in main cluster",
    "MaxPerKubeCluster and RescheduleThreshold control dispatch behavior"
  ]
}
