Skip to content

Commit

Permalink
Merge pull request #96 from ferryproxy/fix/cloud
Browse files Browse the repository at this point in the history
Fix cloud
  • Loading branch information
wzshiming authored Aug 2, 2022
2 parents 1dc5a98 + e71293c commit f1dd1e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pkg/ferry-controller/controller/mapping/mapping_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ type MappingController struct {
}

func (d *MappingController) Start(ctx context.Context) error {
d.mut.Lock()
defer d.mut.Unlock()

d.logger.Info("DataPlane controller started")
defer func() {
d.logger.Info("DataPlane controller stopped")
Expand Down
14 changes: 10 additions & 4 deletions pkg/ferryctl/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,23 @@ func (c *Kubectl) GetSecretAuthorized(ctx context.Context) (string, error) {
}

func (c *Kubectl) GetApiserverAddress(ctx context.Context) (string, error) {
out, err := commandRun(ctx, "kubectl", "--kubeconfig="+vars.KubeconfigPath, "get", "cm", "-n", "kube-public", "cluster-info", "-o", "jsonpath={$.data.kubeconfig}")
if err != nil {
return "", err
}
take := struct {
Clusters []struct {
Cluster struct {
Server string `yaml:"server"`
} `yaml:"cluster"`
} `yaml:"clusters"`
}{}

out, err := commandRun(ctx, "kubectl", "--kubeconfig="+vars.KubeconfigPath, "get", "cm", "-n", "kube-public", "cluster-info", "-o", "jsonpath={$.data.kubeconfig}")
if err != nil {
data, err := os.ReadFile(vars.KubeconfigPath)
if err != nil {
return "", err
}
out = data
}

err = yaml.Unmarshal(out, &take)
if err != nil {
return "", err
Expand Down

0 comments on commit f1dd1e0

Please sign in to comment.