anthos-service-mesh-packages icon indicating copy to clipboard operation
anthos-service-mesh-packages copied to clipboard

GCP_METADATA is not set correctly when environ Id is different from project Id

Open yanyuan-meiyi opened this issue 4 years ago • 0 comments

This is for configuring multi-cluster in multiprojects. Since we will use the same environ Id for all the clusters in different projects, the clusters not created in the environ project will have GCP_METADATA misconfigured.

Reproduce steps:

  1. Download package: kpt pkg get https://github.com/GoogleCloudPlatform/anthos-service-mesh-packages.git/[email protected] .
  2. Set environment variables. Here PROJECT_ID_2 is the environ project:
export PROJECT_ID_1=<project 1>
export PROJECT_ID_2=<project 2>
export CLUSTER_1=<cluster 1>
export CLUSTER_2=<cluster 2>
export LOCATION_1=<location 1>
export LOCATION_2=<location 2>
export PROJECT_NUMBER=$(gcloud projects describe ${PROJECT_ID_2} --format="value(projectNumber)") 
  1. Set kpt package:
kpt cfg set asm gcloud.container.cluster ${CLUSTER_1}
kpt cfg set asm gcloud.compute.location ${LOCATION_1}
kpt cfg set asm gcloud.core.project ${PROJECT_ID_1}
kpt cfg set asm gcloud.project.projectNumber ${PROJECT_NUMBER}
kpt cfg set asm anthos.servicemesh.trustDomainAliases ${PROJECT_ID_2}.svc.id.goog

After the steps, we will see GCP_METADATA is configured as <project 1>|<project number 2>|<cluster 1>|<location 1>

yanyuan-meiyi avatar Aug 25 '20 18:08 yanyuan-meiyi