提交 b9b60224 编写于 作者: D Dan Davison

Merge branch 'qa-autodevops-rotate-gcp-zones' into 'master'

Allow specificity for GKE Cluster Location

See merge request gitlab-org/gitlab-ce!30490
...@@ -177,8 +177,8 @@ module QA ...@@ -177,8 +177,8 @@ module QA
ENV.fetch("GCLOUD_ACCOUNT_EMAIL") ENV.fetch("GCLOUD_ACCOUNT_EMAIL")
end end
def gcloud_zone def gcloud_region
ENV.fetch('GCLOUD_ZONE') ENV.fetch('GCLOUD_REGION')
end end
def has_gcloud_credentials? def has_gcloud_credentials?
......
...@@ -28,17 +28,17 @@ module QA ...@@ -28,17 +28,17 @@ module QA
create #{cluster_name} create #{cluster_name}
#{auth_options} #{auth_options}
--enable-basic-auth --enable-basic-auth
--zone #{Runtime::Env.gcloud_zone} --region #{Runtime::Env.gcloud_region}
&& gcloud container clusters && gcloud container clusters
get-credentials get-credentials
--zone #{Runtime::Env.gcloud_zone} --region #{Runtime::Env.gcloud_region}
#{cluster_name} #{cluster_name}
CMD CMD
@api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'` @api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'`
@admin_user = "#{cluster_name}-admin" @admin_user = "#{cluster_name}-admin"
master_auth = JSON.parse(`gcloud container clusters describe #{cluster_name} --zone #{Runtime::Env.gcloud_zone} --format 'json(masterAuth.username, masterAuth.password)'`) master_auth = JSON.parse(`gcloud container clusters describe #{cluster_name} --region #{Runtime::Env.gcloud_region} --format 'json(masterAuth.username, masterAuth.password)'`)
shell <<~CMD.tr("\n", ' ') shell <<~CMD.tr("\n", ' ')
kubectl config set-credentials #{@admin_user} kubectl config set-credentials #{@admin_user}
--username #{master_auth['masterAuth']['username']} --username #{master_auth['masterAuth']['username']}
...@@ -66,10 +66,10 @@ module QA ...@@ -66,10 +66,10 @@ module QA
def remove! def remove!
shell <<~CMD.tr("\n", ' ') shell <<~CMD.tr("\n", ' ')
gcloud container clusters delete gcloud container clusters delete
--zone #{Runtime::Env.gcloud_zone} --region #{Runtime::Env.gcloud_region}
#{cluster_name} #{cluster_name}
--quiet --async --quiet --async
CMD CMD
end end
private private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册