summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-10-09 12:15:22 +0000
committerRémy Coutable <remy@rymai.me>2018-10-09 12:15:22 +0000
commit7a21f17de2b280fded64e7ce36f7ada208521234 (patch)
tree6e4d0bb936b4e1ef730d705f7a88511619fb0a29 /qa
parentc1ad8bcb4c2be010d5f42c506535ce4b2846aea6 (diff)
parentc5522c7d440d6624dbabcf3c3e13d871afc7b012 (diff)
downloadgitlab-ce-7a21f17de2b280fded64e7ce36f7ada208521234.tar.gz
Merge branch 'qa_spec_admin_cluster_create_cluster_role_binding' into 'master'
QA: Use basic auth to create cluster role binding See merge request gitlab-org/gitlab-ce!22190
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/service/kubernetes_cluster.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb
index d868515555c..c5f12255d72 100644
--- a/qa/qa/service/kubernetes_cluster.rb
+++ b/qa/qa/service/kubernetes_cluster.rb
@@ -25,6 +25,7 @@ module QA
gcloud container clusters
create #{cluster_name}
#{auth_options}
+ --enable-basic-auth
--zone #{Runtime::Env.gcloud_zone}
&& gcloud container clusters
get-credentials
@@ -33,6 +34,15 @@ module QA
CMD
@api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'`
+
+ @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)'`)
+ shell <<~CMD.tr("\n", ' ')
+ kubectl config set-credentials #{@admin_user}
+ --username #{master_auth['masterAuth']['username']}
+ --password #{master_auth['masterAuth']['password']}
+ CMD
+
if rbac
create_service_account
@@ -64,7 +74,7 @@ module QA
def create_service_account
shell('kubectl create -f -', stdin_data: service_account)
- shell('kubectl create -f -', stdin_data: service_account_role_binding)
+ shell("kubectl --user #{@admin_user} create -f -", stdin_data: service_account_role_binding)
end
def service_account