提交 4f89ea27 编写于 作者: G Gao Hongtao 提交者: wu-sheng

Filtering pods not in 'Running' phase (#2771)

* Filtering pods not in 'Running' phase

* Amending checkstyle errors
上级 bcdf1c4b
...@@ -63,6 +63,8 @@ public class K8sALSServiceMeshHTTPAnalysis implements ALSHTTPAnalysis { ...@@ -63,6 +63,8 @@ public class K8sALSServiceMeshHTTPAnalysis implements ALSHTTPAnalysis {
private static final String ADDRESS_TYPE_INTERNAL_IP = "InternalIP"; private static final String ADDRESS_TYPE_INTERNAL_IP = "InternalIP";
private static final String VALID_PHASE = "Running";
@Getter(AccessLevel.PROTECTED) @Getter(AccessLevel.PROTECTED)
private final AtomicReference<Map<String, ServiceMetaInfo>> ipServiceMap = new AtomicReference<>(); private final AtomicReference<Map<String, ServiceMetaInfo>> ipServiceMap = new AtomicReference<>();
...@@ -93,8 +95,13 @@ public class K8sALSServiceMeshHTTPAnalysis implements ALSHTTPAnalysis { ...@@ -93,8 +95,13 @@ public class K8sALSServiceMeshHTTPAnalysis implements ALSHTTPAnalysis {
Map<String, ServiceMetaInfo> ipMap = new HashMap<>(list.getItems().size()); Map<String, ServiceMetaInfo> ipMap = new HashMap<>(list.getItems().size());
long startTime = System.nanoTime(); long startTime = System.nanoTime();
for (V1Pod item : list.getItems()) { for (V1Pod item : list.getItems()) {
if (!item.getStatus().getPhase().equals(VALID_PHASE)) {
logger.debug("Invalid pod {} is not in a valid phase {}", item.getMetadata().getName(), item.getStatus().getPhase());
continue;
}
if (item.getStatus().getPodIP().equals(item.getStatus().getHostIP())) { if (item.getStatus().getPodIP().equals(item.getStatus().getHostIP())) {
logger.warn("Pod {}.{} is removed because hostIP and podIP are identical ", item.getMetadata().getName()); logger.debug("Pod {}.{} is removed because hostIP and podIP are identical ", item.getMetadata().getName(),
item.getMetadata().getNamespace());
continue; continue;
} }
ipMap.put(item.getStatus().getPodIP(), createServiceMetaInfo(item.getMetadata())); ipMap.put(item.getStatus().getPodIP(), createServiceMetaInfo(item.getMetadata()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册