Commit 7a21f17d authored by Rémy Coutable's avatar Rémy Coutable

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
parents c1ad8bcb c5522c7d
...@@ -25,6 +25,7 @@ module QA ...@@ -25,6 +25,7 @@ module QA
gcloud container clusters gcloud container clusters
create #{cluster_name} create #{cluster_name}
#{auth_options} #{auth_options}
--enable-basic-auth
--zone #{Runtime::Env.gcloud_zone} --zone #{Runtime::Env.gcloud_zone}
&& gcloud container clusters && gcloud container clusters
get-credentials get-credentials
...@@ -33,6 +34,15 @@ module QA ...@@ -33,6 +34,15 @@ module QA
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"
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 if rbac
create_service_account create_service_account
...@@ -64,7 +74,7 @@ module QA ...@@ -64,7 +74,7 @@ module QA
def create_service_account def create_service_account
shell('kubectl create -f -', stdin_data: 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 end
def service_account def service_account
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment