File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed 
agent-operator/src/main/java/com/walmartlabs/concord/agentoperator/agent Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 99 * Licensed under the Apache License, Version 2.0 (the "License"); 
1010 * you may not use this file except in compliance with the License. 
1111 * You may obtain a copy of the License at 
12-  *   
12+  * 
1313 *      http://www.apache.org/licenses/LICENSE-2.0 
14-  *   
14+  * 
1515 * Unless required by applicable law or agreed to in writing, software 
1616 * distributed under the License is distributed on an "AS IS" BASIS, 
1717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
@@ -48,10 +48,18 @@ public AgentClientFactory(boolean useMaintenanceMode) {
4848    }
4949
5050    public  AgentClient  create (Pod  pod ) {
51-         if  (useMaintenanceMode  && pod . getStatus () !=  null   && pod . getStatus (). getPodIP () !=  null ) {
51+         if  (useMaintenanceMode  && isRunning ( pod )  && hasIP ( pod ) ) {
5252            return  new  DefaultAgentClient (httpClient , pod .getStatus ().getPodIP ());
5353        } else  {
5454            return  new  NopAgentClient ();
5555        }
5656    }
57+ 
58+     private  static  boolean  isRunning (Pod  pod ) {
59+         return  pod .getStatus () != null  && "Running" .equals (pod .getStatus ().getPhase ());
60+     }
61+ 
62+     private  static  boolean  hasIP (Pod  pod ) {
63+         return  pod .getStatus () != null  && pod .getStatus ().getPodIP () != null ;
64+     }
5765}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments