Skip to content

Commit

Permalink
Merge pull request #1 from beclab/fix/cloudurl
Browse files Browse the repository at this point in the history
fix: cloud url
  • Loading branch information
hysyeah authored Nov 6, 2024
2 parents dff7d48 + bf3ca67 commit 6733edf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/controller/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"strings"
"time"

"github.com/emicklei/go-restful/v3"
Expand Down Expand Up @@ -151,7 +153,12 @@ func getAccountFromSettings(admin string) (userid, token string, err error) {

func GetAwsAccountFromCloud(ctx context.Context, client dynamic.Interface, bucket string) (*AWSAccount, error) {
// cloudUrl := "https://cloud-dev-api.bttcdn.com/v1/resource/stsToken"
cloudUrl := "https://cloud-api.bttcdn.com/v1/resource/stsToken/setup"
cloudHost := "https://cloud-api.bttcdn.com"
cloudHostFromEnv := os.Getenv("OLARES_SPACE_URL")
if cloudHostFromEnv != "" {
cloudHost = cloudHostFromEnv
}
cloudURL := fmt.Sprintf("%s/v1/resource/stsToken/setup", strings.TrimSuffix(cloudHost, "/"))

clusterId, ak, sk, st, err := getClusterId(ctx, client)
if err != nil {
Expand All @@ -175,10 +182,10 @@ func GetAwsAccountFromCloud(ctx context.Context, client dynamic.Interface, bucke
"durationSeconds": fmt.Sprintf("%.0f", duration.Seconds()),
}).
SetResult(&AWSAccountResponse{}).
Post(cloudUrl)
Post(cloudURL)

if err != nil {
klog.Error("fetch data from cloud error, ", err, ", ", cloudUrl)
klog.Error("fetch data from cloud error, ", err, ", ", cloudURL)
return nil, err
}

Expand Down

0 comments on commit 6733edf

Please sign in to comment.