From fa211095aa7346f4084043273867eac71daa8ac5 Mon Sep 17 00:00:00 2001 From: Nico Kemnitz Date: Tue, 22 Oct 2024 15:33:04 +0200 Subject: [PATCH] fix: Create zutils Artifact Registry repo --- scripts/gcp/create_corgie_igneous_cluster.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/gcp/create_corgie_igneous_cluster.py b/scripts/gcp/create_corgie_igneous_cluster.py index 420d0d21..87791d00 100644 --- a/scripts/gcp/create_corgie_igneous_cluster.py +++ b/scripts/gcp/create_corgie_igneous_cluster.py @@ -20,6 +20,8 @@ && gcloud iam service-accounts add-iam-policy-binding {CLUSTER_NAME}-worker@{PROJECT_NAME}.iam.gserviceaccount.com --role roles/iam.workloadIdentityUser --member "serviceAccount:{PROJECT_NAME}.svc.id.goog[default/default]" --project {PROJECT_NAME} && kubectl annotate serviceaccount default --namespace default iam.gke.io/gcp-service-account={CLUSTER_NAME}-worker@{PROJECT_NAME}.iam.gserviceaccount.com""" +CREATE_ARTIFACT_REGISTRY_REPO_TMPL = "gcloud artifacts repositories create zutils --repository-format=docker --location={REGION} --project={PROJECT_NAME}" + CONFIGURE_DRIVERS_COMMAND_TMPL = "gcloud container clusters get-credentials {CLUSTER_NAME} --region {REGION} --project {PROJECT_NAME}; kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/container-engine-accelerators/master/nvidia-driver-installer/cos/daemonset-preloaded-latest.yaml" @@ -71,6 +73,9 @@ def main(): # pylint: disable=too-many-statements ) parser.add_argument("--add_cpu", action="store_true", help="Add CPU node pool.") parser.add_argument("--add_gpu", action="store_true", help="Add GPU node pool.") + parser.add_argument( + "--add-repo", action="store_true", help="Add Artifact Registry Repository." + ) args = parser.parse_args() # cluster_version = args.cluster_version @@ -138,6 +143,13 @@ def main(): # pylint: disable=too-many-statements print(f"Running: \n{add_wi_command}") subprocess.call(add_wi_command, shell=True) + if args.add_repo: + create_repo_command = CREATE_ARTIFACT_REGISTRY_REPO_TMPL + create_repo_command = create_repo_command.replace("{REGION}", args.region) + create_repo_command = create_repo_command.replace("{PROJECT_NAME}", args.project_name) + print(f"Running: \n{create_repo_command}") + subprocess.call(create_repo_command, shell=True) + if __name__ == "__main__": main()