Skip to content

Commit

Permalink
Update admin_tenants.go
Browse files Browse the repository at this point in the history
  • Loading branch information
adfost committed May 4, 2021
1 parent 942ca4f commit 6658c1e
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions restapi/admin_tenants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1351,32 +1351,21 @@ func getTenantPodsResponse(session *models.Principal, params admin_api.GetTenant
return nil, prepareError(err)
}
listOpts := metav1.ListOptions{
TypeMeta: metav1.TypeMeta{},
LabelSelector: "",
FieldSelector: "",
Watch: false,
AllowWatchBookmarks: false,
ResourceVersion: "",
ResourceVersionMatch: "",
TimeoutSeconds: nil,
Limit: 0,
Continue: "",
LabelSelector: "fmt.Sprintf("%s=%s", miniov2.TenantLabel, params.Tenant),",
}
pods, err := clientset.CoreV1().Pods(params.Namespace).List(ctx, listOpts)
if err != nil {
return nil, prepareError(err)
}
retval := []*models.TenantPod{}
for i := range pods.Items {
if pods.Items[i].Name[0:len(params.Tenant)] == params.Tenant {
restarts := int64(pods.Items[i].Status.ContainerStatuses[0].RestartCount)
retval = append(retval, &models.TenantPod{Name: &pods.Items[i].ObjectMeta.Name,
Status: string(pods.Items[i].Status.Phase),
TimeCreated: pods.Items[i].CreationTimestamp.Unix(),
PodIP: pods.Items[i].Status.PodIP,
Restarts: restarts,
Node: pods.Items[i].Spec.NodeName})
}
restarts := int64(pods.Items[i].Status.ContainerStatuses[0].RestartCount)
retval = append(retval, &models.TenantPod{Name: &pods.Items[i].ObjectMeta.Name,
Status: string(pods.Items[i].Status.Phase),
TimeCreated: pods.Items[i].CreationTimestamp.Unix(),
PodIP: pods.Items[i].Status.PodIP,
Restarts: restarts,
Node: pods.Items[i].Spec.NodeName})
}
return retval, nil
}
Expand Down

0 comments on commit 6658c1e

Please sign in to comment.