Repository: iter8-tools/iter8
Pull request #1348 (2022-10-03 19:53:52)

minor fixes
Fixes https://github.com/iter8-tools/iter8/issues/1346
Fixes https://github.com/iter8-tools/iter8/issues/1347
Signed-off-by: Michael Kalantar <kalantar@us.ibm.com>


Patch:
diff --git a/base/abn_metrics.go b/base/abn_metrics.go
index 6276915a..bd33e0c8 100644
--- a/base/abn_metrics.go
+++ b/base/abn_metrics.go
@@ -51,8 +51,8 @@ func (wc *defaultABNClient) callGetApplicationJSON(appName string) (string, erro
 }
 
 const (
-	// CollectABNMetrics is the name of the task to read A/B(/n) metric values
-	CollectABNMetrics = "abnmetrics"
+	// CollectABNMetricsTaskName is the name of the task to read A/B(/n) metric values
+	CollectABNMetricsTaskName = "abnmetrics"
 	// abnMetricProvider is prefix for abn metrics
 	abnMetricProvider = "abn"
 )
diff --git a/base/experiment.go b/base/experiment.go
index 31de2bf9..21677101 100644
--- a/base/experiment.go
+++ b/base/experiment.go
@@ -243,7 +243,7 @@ func (s *ExperimentSpec) UnmarshalJSON(data []byte) error {
 					return e
 				}
 				tsk = cgt
-			case CollectABNMetrics:
+			case CollectABNMetricsTaskName:
 				cgt := &collectABNMetricsTask{}
 				if err := json.Unmarshal(tBytes, cgt); err != nil {
 					e := errors.New("json unmarshal error")
diff --git a/charts/iter8/templates/_experiment.tpl b/charts/iter8/templates/_experiment.tpl
index db0e6a62..4a6b87a3 100644
--- a/charts/iter8/templates/_experiment.tpl
+++ b/charts/iter8/templates/_experiment.tpl
@@ -21,7 +21,7 @@ spec:
   {{- else if eq "github" . }}
   {{- include "task.github" $.Values.github -}}
   {{- else }}
-  {{- fail "task name must be one of assess, custommetrics, grpc, http, ready, github, or slack" -}}
+  {{- fail "task name must be one of assess, custommetrics, abnmetrics, grpc, http, ready, github, or slack" -}}
   {{- end }}
   {{- end }}
 result:
diff --git a/charts/iter8/templates/_k-role.tpl b/charts/iter8/templates/_k-role.tpl
index d6c51b81..d73fd0ca 100644
--- a/charts/iter8/templates/_k-role.tpl
+++ b/charts/iter8/templates/_k-role.tpl
@@ -1,17 +1,6 @@
 {{- define "k.role" -}}
 apiVersion: rbac.authorization.k8s.io/v1
 kind: Role
-metadata:
-  name: {{ .Release.Name }}-metricstore
-  annotations:
-    iter8.tools/group: {{ .Release.Name }}
-rules:
-- apiGroups: [""]
-  resources: ["secrets"]
-  verbs: ["list", "get"]
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
 metadata:
   name: {{ .Release.Name }}
   annotations:
diff --git a/charts/iter8/templates/_k-rolebinding.tpl b/charts/iter8/templates/_k-rolebinding.tpl
index 1c2794b4..5487d050 100644
--- a/charts/iter8/templates/_k-rolebinding.tpl
+++ b/charts/iter8/templates/_k-rolebinding.tpl
@@ -1,21 +1,6 @@
 {{- define "k.rolebinding" -}}
 apiVersion: rbac.authorization.k8s.io/v1
 kind: RoleBinding
-metadata:
-  name: {{ .Release.Name }}-metricstore
-  annotations:
-    iter8.tools/group: {{ .Release.Name }}
-subjects:
-- kind: ServiceAccount
-  name: {{ .Release.Name }}-iter8-sa
-  namespace: {{ .Release.Namespace }}
-roleRef:
-  kind: Role
-  name: {{ .Release.Name }}-metricstore
-  apiGroup: rbac.authorization.k8s.io
----
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
 metadata:
   name: {{ .Release.Name }}
   annotations:


Test patch:
diff --git a/base/abn_metrics_test.go b/base/abn_metrics_test.go
index 3266a873..7323165d 100644
--- a/base/abn_metrics_test.go
+++ b/base/abn_metrics_test.go
@@ -24,7 +24,7 @@ func TestABNMetricsTask(t *testing.T) {
 
 	task := &collectABNMetricsTask{
 		TaskMeta: TaskMeta{
-			Task: StringPointer(CollectABNMetrics),
+			Task: StringPointer(CollectABNMetricsTaskName),
 		},
 		With: ABNMetricsInputs{
 			Application: "default/application",