Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-10-08 23:36:22 +0300
committerThong Kuah <tkuah@gitlab.com>2018-10-09 04:26:00 +0300
commitc5522c7d440d6624dbabcf3c3e13d871afc7b012 (patch)
tree33734f1ad19fe4955ca52c4f1cb519662f0b40f5 /qa
parent64c305e446e28e6ae42f8e61dd50607a43d95e79 (diff)
Fix commands for kubectl >= 1.12
The `--username` and `--password` top level options have been removed. Fortunately we have a backwards compatible way of setting the credentials via `kubectl config set-credentials <name>`, and using the `--user <name>` top level option which is available at least in 1.10 (and possibly farther back).
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/service/kubernetes_cluster.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb
index 35c03e3f48a..c5f12255d72 100644
--- a/qa/qa/service/kubernetes_cluster.rb
+++ b/qa/qa/service/kubernetes_cluster.rb
@@ -34,7 +34,14 @@ 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)'`)
+
+ @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
@@ -67,7 +74,7 @@ module QA
def create_service_account
shell('kubectl create -f -', stdin_data: service_account)
- shell("kubectl --username #{@master_auth['masterAuth']['username']} --password #{@master_auth['masterAuth']['password']} 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