Skip to content

Commit 58a3559

Browse files
committed
Add pod condition details on the details tab of the agent status report page
1 parent 5d6e7c1 commit 58a3559

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

src/main/java/cd/go/contrib/elasticagent/model/reports/agent/KubernetesPodDetails.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import io.fabric8.kubernetes.api.model.PodCondition;
55

66
import java.util.ArrayList;
7+
import java.util.stream.Collectors;
78

89
public class KubernetesPodDetails {
910
private String name;
@@ -36,9 +37,7 @@ public static KubernetesPodDetails fromPod(Pod pod) {
3637
podDetails.conditions = new ArrayList<>();
3738
for (PodCondition podCondition : pod.getStatus().getConditions()) {
3839
Condition condition = new Condition(podCondition.getType(),
39-
podCondition.getStatus(),
40-
podCondition.getLastTransitionTime(),
41-
podCondition.getLastProbeTime());
40+
podCondition.getStatus());
4241
podDetails.conditions.add(condition);
4342
}
4443

@@ -81,21 +80,18 @@ public String getHostIP() {
8180
return hostIP;
8281
}
8382

84-
public ArrayList<Condition> getConditions() {
85-
return conditions;
83+
public String getConditions() {
84+
return String.join(", ", conditions.stream()
85+
.map(Condition::toString).collect(Collectors.toList()));
8686
}
8787

8888
private static class Condition {
8989
private final String type;
9090
private final String status;
91-
private final String lastTransitionTime;
92-
private final String lastProbeTime;
9391

94-
public Condition(String type, String status, String lastTransitionTime, String lastProbeTime) {
92+
public Condition(String type, String status) {
9593
this.type = type;
9694
this.status = status;
97-
this.lastTransitionTime = lastTransitionTime;
98-
this.lastProbeTime = lastProbeTime;
9995
}
10096

10197
public String getType() {
@@ -106,12 +102,9 @@ public String getStatus() {
106102
return status;
107103
}
108104

109-
public String getLastTransitionTime() {
110-
return lastTransitionTime;
111-
}
112-
113-
public String getLastProbeTime() {
114-
return lastProbeTime;
105+
@Override
106+
public String toString() {
107+
return String.format("%s: %s", type, status);
115108
}
116109
}
117110
}

src/main/resources/agent-status-report.template.ftlh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@
210210
<dt>Start Timestamp:</dt>
211211
<dd>${ podDetails.startedAt !}</dd>
212212

213+
<dt>Conditions:</dt>
214+
<dd>${ podDetails.conditions !}</dd>
215+
213216
<dt>Status:</dt>
214217
<dd>${ podDetails.phase !}</dd>
215218

0 commit comments

Comments
 (0)