Skip to content

Commit 6658c1e

Browse files
authored
Update admin_tenants.go
1 parent 942ca4f commit 6658c1e

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

restapi/admin_tenants.go

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,32 +1351,21 @@ func getTenantPodsResponse(session *models.Principal, params admin_api.GetTenant
13511351
return nil, prepareError(err)
13521352
}
13531353
listOpts := metav1.ListOptions{
1354-
TypeMeta: metav1.TypeMeta{},
1355-
LabelSelector: "",
1356-
FieldSelector: "",
1357-
Watch: false,
1358-
AllowWatchBookmarks: false,
1359-
ResourceVersion: "",
1360-
ResourceVersionMatch: "",
1361-
TimeoutSeconds: nil,
1362-
Limit: 0,
1363-
Continue: "",
1354+
LabelSelector: "fmt.Sprintf("%s=%s", miniov2.TenantLabel, params.Tenant),",
13641355
}
13651356
pods, err := clientset.CoreV1().Pods(params.Namespace).List(ctx, listOpts)
13661357
if err != nil {
13671358
return nil, prepareError(err)
13681359
}
13691360
retval := []*models.TenantPod{}
13701361
for i := range pods.Items {
1371-
if pods.Items[i].Name[0:len(params.Tenant)] == params.Tenant {
1372-
restarts := int64(pods.Items[i].Status.ContainerStatuses[0].RestartCount)
1373-
retval = append(retval, &models.TenantPod{Name: &pods.Items[i].ObjectMeta.Name,
1374-
Status: string(pods.Items[i].Status.Phase),
1375-
TimeCreated: pods.Items[i].CreationTimestamp.Unix(),
1376-
PodIP: pods.Items[i].Status.PodIP,
1377-
Restarts: restarts,
1378-
Node: pods.Items[i].Spec.NodeName})
1379-
}
1362+
restarts := int64(pods.Items[i].Status.ContainerStatuses[0].RestartCount)
1363+
retval = append(retval, &models.TenantPod{Name: &pods.Items[i].ObjectMeta.Name,
1364+
Status: string(pods.Items[i].Status.Phase),
1365+
TimeCreated: pods.Items[i].CreationTimestamp.Unix(),
1366+
PodIP: pods.Items[i].Status.PodIP,
1367+
Restarts: restarts,
1368+
Node: pods.Items[i].Spec.NodeName})
13801369
}
13811370
return retval, nil
13821371
}

0 commit comments

Comments
 (0)