Commit c5522c7d authored by Thong Kuah's avatar Thong Kuah

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).
parent 64c305e4
...@@ -34,7 +34,14 @@ module QA ...@@ -34,7 +34,14 @@ 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}'`
@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 if rbac
create_service_account create_service_account
...@@ -67,7 +74,7 @@ module QA ...@@ -67,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 --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 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