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 !22190
parents c1ad8bcb c5522c7d
Pipeline #32403997 failed with stages
in 46 minutes and 56 seconds
......@@ -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
......
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