pingcap / tidb-operator

TiDB operator creates and manages TiDB clusters running in Kubernetes.
https://docs.pingcap.com/tidb-in-kubernetes/
Apache License 2.0
1.23k stars 498 forks source link

support running tidb-controller-manager locally #2598

Open zjj2wry opened 4 years ago

zjj2wry commented 4 years ago

Feature Request

Is your feature request related to a problem? Please describe:

The current controller manager cannot be run and debugged locally. Since the controller manager will access /health and/store API of pd.

Describe the feature you'd like:

I hope there is a way to run the controller manager locally. Because now it has no system-level dependencies. running locally can help development and testing

Describe alternatives you've considered:

  1. add --kubeconfig flag to support creating out-of-cluster clientset
  2. run kubectl proxy
  3. pass an environment variable such as DEBUG = 1, and then overwrite the address of PdClientURL.

I tested this, but I'm not sure if the controller manager has other dependencies hardcode version:

 // pdClientUrl builds the url of pd client
 func PdClientURL(namespace Namespace, clusterName string, scheme string) string {
+       return "http://127.0.0.1:8001/api/v1/namespaces/default/services/basic-pd:2379/proxy"
        return fmt.Sprintf("%s://%s-pd.%s:2379", scheme, clusterName, string(namespace))
 }

Teachability, Documentation, Adoption, Migration Strategy:

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days