Skip to content

Commit 40c1ba3

Browse files
authored
Fix AMCS endpoint (#1501)
1 parent c9bb8be commit 40c1ba3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

source/plugins/go/src/ingestion_token_utils.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func getAccessTokenFromIMDS() (string, int64, error) {
154154
if useIMDSTokenProxyEndPoint != "" && strings.Compare(strings.ToLower(useIMDSTokenProxyEndPoint), "true") == 0 {
155155
Log("Info Reading IMDS Access Token from IMDS Token proxy endpoint")
156156
mcsEndpoint := os.Getenv("MCS_ENDPOINT")
157-
msi_endpoint_string := fmt.Sprintf("http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://%s/", mcsEndpoint)
157+
msi_endpoint_string := fmt.Sprintf("http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=%s", mcsEndpoint)
158158
var msi_endpoint *url.URL
159159
msi_endpoint, err := url.Parse(msi_endpoint_string)
160160
if err != nil {
@@ -332,12 +332,8 @@ func getAgentConfiguration(imdsAccessToken string) (configurationId string, chan
332332
osType := os.Getenv("OS_TYPE")
333333
resourceId := os.Getenv("AKS_RESOURCE_ID")
334334
resourceRegion := os.Getenv("AKS_REGION")
335-
mcsEndpoint := os.Getenv("MCS_ENDPOINT")
335+
AmcsEndpoint = os.Getenv("MCS_GLOBAL_ENDPOINT")
336336

337-
AmcsEndpoint = fmt.Sprintf("https://global.handler.control.%s", mcsEndpoint)
338-
if strings.Compare(strings.ToLower(resourceRegion), "eastus2euap") == 0 || strings.Compare(strings.ToLower(resourceRegion), "centraluseuap") == 0 {
339-
AmcsEndpoint = fmt.Sprintf("https://global.handler.canary.control.%s", mcsEndpoint)
340-
}
341337
if AMCSRedirectedEndpoint != "" {
342338
AmcsEndpoint = AMCSRedirectedEndpoint
343339
}
@@ -489,9 +485,8 @@ func getIngestionAuthToken(imdsAccessToken string, configurationId string, chann
489485
osType := os.Getenv("OS_TYPE")
490486
resourceId := os.Getenv("AKS_RESOURCE_ID")
491487
resourceRegion := os.Getenv("AKS_REGION")
492-
mcsEndpoint := os.Getenv("MCS_ENDPOINT")
488+
AmcsEndpoint = os.Getenv("MCS_GLOBAL_ENDPOINT")
493489

494-
AmcsEndpoint = fmt.Sprintf("https://global.handler.control.%s", mcsEndpoint)
495490
if AMCSRedirectedEndpoint != "" {
496491
AmcsEndpoint = AMCSRedirectedEndpoint
497492
}

0 commit comments

Comments
 (0)