diff options
Diffstat (limited to 'qa/qa/service/kubernetes_cluster.rb')
-rw-r--r-- | qa/qa/service/kubernetes_cluster.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb index 604bc522983..7627c8c7ad9 100644 --- a/qa/qa/service/kubernetes_cluster.rb +++ b/qa/qa/service/kubernetes_cluster.rb @@ -20,9 +20,11 @@ module QA gcloud container clusters create #{cluster_name} --enable-legacy-authorization - --zone us-central1-a + --zone #{Runtime::Env.gcloud_zone} && gcloud container clusters - get-credentials #{cluster_name} + get-credentials + --zone #{Runtime::Env.gcloud_zone} + #{cluster_name} CMD @api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'` @@ -32,7 +34,12 @@ module QA end def remove! - shell("gcloud container clusters delete #{cluster_name} --quiet --async") + shell <<~CMD.tr("\n", ' ') + gcloud container clusters delete + --zone #{Runtime::Env.gcloud_zone} + #{cluster_name} + --quiet --async + CMD end private @@ -54,9 +61,9 @@ module QA def attempt_login_with_env_vars puts "No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY." gcloud_account_key = Tempfile.new('gcloud-account-key') - gcloud_account_key.write(ENV.fetch("GCLOUD_ACCOUNT_KEY")) + gcloud_account_key.write(Runtime::Env.gcloud_account_key) gcloud_account_key.close - gcloud_account_email = ENV.fetch("GCLOUD_ACCOUNT_EMAIL") + gcloud_account_email = Runtime::Env.gcloud_account_email shell("gcloud auth activate-service-account #{gcloud_account_email} --key-file #{gcloud_account_key.path}") ensure gcloud_account_key && gcloud_account_key.unlink |