Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set project number for ASM install #692

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/asm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* limitations under the License.
*/

data "google_project" "asm_project" {
project_id = var.project_id
}


module "asm_install" {
source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper"
version = "~> 2.0.2"
Expand All @@ -29,6 +34,6 @@ module "asm_install" {
service_account_key_file = var.service_account_key_file


kubectl_create_command = "${path.module}/scripts/install_asm.sh ${var.project_id} ${var.cluster_name} ${var.location} ${var.asm_dir} ${var.asm_version}"
kubectl_create_command = "${path.module}/scripts/install_asm.sh ${var.project_id} ${var.cluster_name} ${var.location} ${var.asm_dir} ${var.asm_version} ${data.google_project.asm_project.number}"
kubectl_destroy_command = "kubectl delete ns istio-system"
}
4 changes: 3 additions & 1 deletion modules/asm/scripts/install_asm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

set -e

if [ "$#" -lt 5 ]; then
if [ "$#" -lt 6 ]; then
>&2 echo "Not all expected arguments set."
exit 1
fi
Expand All @@ -25,6 +25,7 @@ CLUSTER_NAME=$2
CLUSTER_LOCATION=$3
ASM_RESOURCES=$4
ASM_VERSION=$5
PROJECT_NUM=$6
BASE_DIR="asm-base-dir"
# check for needed binaries
# kustomize is a requirement for installing ASM and is not available via gcloud. Safely exit if not available.
Expand Down Expand Up @@ -53,6 +54,7 @@ kpt cfg set asm-patch/ base-dir ../${BASE_DIR}
kpt cfg set asm-patch/ gcloud.core.project "${PROJECT_ID}"
kpt cfg set asm-patch/ gcloud.container.cluster "${CLUSTER_NAME}"
kpt cfg set asm-patch/ gcloud.compute.location "${CLUSTER_LOCATION}"
kpt cfg set asm-patch/ gcloud.project.environProjectNumber "${PROJECT_NUM}"
kpt cfg list-setters asm-patch/
pushd ${BASE_DIR}
kustomize create --autodetect --namespace "${PROJECT_ID}"
Expand Down