@@ -98,7 +98,7 @@ func (pm *PoolManager) handlePodRunning(exporter *Exporter, pod *v1.Pod, uri str
98
98
ip := pod .Status .PodIP
99
99
podName := pod .Name
100
100
if ip != "" {
101
- log .Infof ("New running pod detected %s with IP %s" , podName , ip )
101
+ log .Infof ("Pod in Running state detected %s with IP %s. Adding in the Pool Manager.. " , podName , ip )
102
102
pm .Add (uri )
103
103
exporter .UpdatePoolManager (* pm )
104
104
} else {
@@ -119,13 +119,15 @@ func (pm *PoolManager) processPodAdded(exporter *Exporter, pod *v1.Pod, uri stri
119
119
// To be included in the pool manager, the pod must be in the "Running" phase. The function checks the pod's current phase
120
120
// and, if it is running, calls handlePodRunning to append the pod to the pool manager's PodPhases.
121
121
func (pm * PoolManager ) processPodModified (exporter * Exporter , pod * v1.Pod , uri string ) {
122
- lastPhase , exists := pm .PodPhases [pod .Name ]
122
+ podName := pod .Name
123
+ currentPhase := pod .Status .Phase
124
+ lastPhase , exists := pm .PodPhases [podName ]
123
125
124
- if exists && lastPhase == v1 .PodPending && pod . Status . Phase == v1 .PodRunning {
125
- log .Infof ("Pod %s transitioned from Pending to Running" , pod . Name )
126
+ if exists && lastPhase == v1 .PodPending && currentPhase == v1 .PodRunning {
127
+ log .Infof ("Pod %s transitioned from Pending to Running" , podName )
126
128
pm .handlePodRunning (exporter , pod , uri )
127
129
}
128
- pm .PodPhases [pod . Name ] = pod . Status . Phase
130
+ pm .PodPhases [podName ] = currentPhase
129
131
}
130
132
131
133
// processPodDeleted handles the removal of a pods URI from the pool manager's PodPhases.
0 commit comments