diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-10-08 23:40:39 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-10-08 23:40:39 +1300 |
commit | 64c305e446e28e6ae42f8e61dd50607a43d95e79 (patch) | |
tree | 267e43c8f9051ae82209c2a2dbe106a47fc0a842 /qa/qa/service/kubernetes_cluster.rb | |
parent | b86631a5213ca0c950d51aa5362c8d752296e8d7 (diff) | |
download | gitlab-ce-64c305e446e28e6ae42f8e61dd50607a43d95e79.tar.gz |
Use basic auth to create cluster role binding
The alternative is the user has `container.admin` permissions.
This approach is preferred as this means the QA spec can be run by any
GitLabber and indeed any contributor who can create a GKE cluster.
Diffstat (limited to 'qa/qa/service/kubernetes_cluster.rb')
-rw-r--r-- | qa/qa/service/kubernetes_cluster.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb index d868515555c..35c03e3f48a 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,8 @@ module QA CMD @api_url = `kubectl config view --minify -o jsonpath='{.clusters[].cluster.server}'` + @master_auth = JSON.parse(`gcloud container clusters describe #{cluster_name} --zone #{Runtime::Env.gcloud_zone} --format 'json(masterAuth.username, masterAuth.password)'`) + if rbac create_service_account @@ -64,7 +67,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 --username #{@master_auth['masterAuth']['username']} --password #{@master_auth['masterAuth']['password']} create -f -", stdin_data: service_account_role_binding) end def service_account |