From 9c4c85089b2cc7bbabb8323b29df250666252bf4 Mon Sep 17 00:00:00 2001 From: LiHui Date: Wed, 12 May 2021 11:17:09 +0800 Subject: [PATCH] Fix: resolve openpitrix resources Signed-off-by: LiHui --- pkg/models/tenant/metering.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/models/tenant/metering.go b/pkg/models/tenant/metering.go index 25f2ab4dd..58c06923d 100644 --- a/pkg/models/tenant/metering.go +++ b/pkg/models/tenant/metering.go @@ -926,11 +926,12 @@ func (t *tenantOperator) collectOpenPitrixComponents(cluster, ns string) map[str } for _, object := range app.ReleaseInfo { unstructuredObj := object.(*unstructured.Unstructured) - if unstructuredObj.GetKind() == "Service" || - unstructuredObj.GetKind() == "Deployment" || - unstructuredObj.GetKind() == "Daemonset" || - unstructuredObj.GetKind() == "Statefulset" { - opComponentsMap[op+":"+unstructuredObj.GetKind()] = append(opComponentsMap[unstructuredObj.GetKind()], unstructuredObj.GetName()) + kind := unstructuredObj.GetKind() + if kind == "Service" || + kind == "Deployment" || + kind == "DaemonSet" || + kind == "StatefulSet" { + opComponentsMap[op+":"+strings.ToLower(kind)] = append(opComponentsMap[kind], unstructuredObj.GetName()) } } } @@ -949,7 +950,7 @@ func (t *tenantOperator) isOpenPitrixComponent(cluster, ns, kind, componentName return false, "" } opName := kk[0] - if kk[1] == strings.Title(kind) { + if kk[1] == kind { for _, svc := range v { if componentName == svc { return true, opName