Merge pull request #4004 from ks-ci-bot/cherry-pick-3871-to-release-3.1

[release-3.1] Fix: parse openpitrix resources, so that these resources will be included in billing.
This commit is contained in:
KubeSphere CI Bot
2021-06-25 22:11:28 +08:00
committed by GitHub

View File

@@ -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