Skip to content

Commit d40d27f

Browse files
authored
Merge branch 'master' into ib/tidy-up-more
2 parents b41160d + 0f46390 commit d40d27f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

agent-operator/src/main/java/com/walmartlabs/concord/agentoperator/agent/AgentClientFactory.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
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
}

0 commit comments

Comments
 (0)