Merge pull request #418 from Garrybest/remove-hard-code

modify hard code in cluster_status_controller
This commit is contained in:
karmada-bot 2021-06-05 10:43:44 +08:00 committed by GitHub
commit fc22d2336e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -402,7 +402,7 @@ func convertObjectsToPods(podList []runtime.Object) ([]*corev1.Pod, error) {
func getReadyStatusForNode(nodeStatus corev1.NodeStatus) bool {
for _, condition := range nodeStatus.Conditions {
if condition.Type == "Ready" {
if condition.Type == corev1.NodeReady {
if condition.Status == corev1.ConditionTrue {
return true
}
@ -431,9 +431,9 @@ func getClusterAllocatable(nodeList []*corev1.Node) (allocatable corev1.Resource
func getUsedResource(podList []*corev1.Pod) corev1.ResourceList {
var requestCPU, requestMem int64
for _, pod := range podList {
if pod.Status.Phase == "Running" {
if pod.Status.Phase == corev1.PodRunning {
for _, c := range pod.Status.Conditions {
if c.Type == "Ready" && c.Status == "True" {
if c.Type == corev1.PodReady && c.Status == corev1.ConditionTrue {
podRes := addPodRequestResource(pod)
requestCPU += podRes.MilliCPU
requestMem += podRes.Memory