From 59bc823547f4a5d33c66e79bb835be8bc42c969b Mon Sep 17 00:00:00 2001 From: zhouya0 Date: Wed, 16 Sep 2020 11:44:30 +0800 Subject: [PATCH] Delete namespace parameter in create adapter --- .../monitoring/custom_metrics_deployments.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/instrumentation/monitoring/custom_metrics_deployments.go b/test/e2e/instrumentation/monitoring/custom_metrics_deployments.go index de80b129315..5a438b31a99 100644 --- a/test/e2e/instrumentation/monitoring/custom_metrics_deployments.go +++ b/test/e2e/instrumentation/monitoring/custom_metrics_deployments.go @@ -252,11 +252,11 @@ func prometheusExporterPodSpec(metricName string, metricValue int64, port int32) // CreateAdapter creates Custom Metrics - Stackdriver adapter // adapterDeploymentFile should be a filename for adapter deployment located in StagingDeploymentLocation -func CreateAdapter(namespace, adapterDeploymentFile string) error { +func CreateAdapter(adapterDeploymentFile string) error { // A workaround to make the work on GKE. GKE doesn't normally allow to create cluster roles, // which the adapter deployment does. The solution is to create cluster role binding for // cluster-admin role and currently used service account. - err := createClusterAdminBinding(namespace) + err := createClusterAdminBinding() if err != nil { return err } @@ -265,12 +265,12 @@ func CreateAdapter(namespace, adapterDeploymentFile string) error { if err != nil { return err } - stat, err := framework.RunKubectl(namespace, "create", "-f", adapterURL) + stat, err := framework.RunKubectl("create", "-f", adapterURL) framework.Logf(stat) return err } -func createClusterAdminBinding(namespace string) error { +func createClusterAdminBinding() error { stdout, stderr, err := framework.RunCmd("gcloud", "config", "get-value", "core/account") if err != nil { framework.Logf(stderr) @@ -278,7 +278,7 @@ func createClusterAdminBinding(namespace string) error { } serviceAccount := strings.TrimSpace(stdout) framework.Logf("current service account: %q", serviceAccount) - stat, err := framework.RunKubectl(namespace, "create", "clusterrolebinding", ClusterAdminBinding, "--clusterrole=cluster-admin", "--user="+serviceAccount) + stat, err := framework.RunKubectl("create", "clusterrolebinding", ClusterAdminBinding, "--clusterrole=cluster-admin", "--user="+serviceAccount) framework.Logf(stat) return err }