Skip to content

Commit

Permalink
add endpoint conditions to node cryostat annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Dec 20, 2024
1 parent 2ce072b commit 7067272
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.OwnerReference;
import io.fabric8.kubernetes.api.model.discovery.v1.Endpoint;
import io.fabric8.kubernetes.api.model.discovery.v1.EndpointConditions;
import io.fabric8.kubernetes.api.model.discovery.v1.EndpointPort;
import io.fabric8.kubernetes.api.model.discovery.v1.EndpointSlice;
import io.fabric8.kubernetes.client.KubernetesClient;
Expand Down Expand Up @@ -235,7 +236,8 @@ List<TargetTuple> tuplesFromEndpoints(EndpointSlice slice) {
queryForNode(ref.getNamespace(), ref.getName(), ref.getKind())
.getLeft(),
addr,
port));
port,
endpoint.getConditions()));
}
}
}
Expand Down Expand Up @@ -602,12 +604,19 @@ private class TargetTuple {
HasMetadata obj;
String addr;
EndpointPort port;

TargetTuple(ObjectReference objRef, HasMetadata obj, String addr, EndpointPort port) {
EndpointConditions conditions;

TargetTuple(
ObjectReference objRef,
HasMetadata obj,
String addr,
EndpointPort port,
EndpointConditions conditions) {
this.objRef = objRef;
this.obj = obj;
this.addr = addr;
this.port = port;
this.conditions = conditions;
}

public Target toTarget() {
Expand Down Expand Up @@ -640,7 +649,15 @@ public Target toTarget() {
"NAMESPACE",
objRef.getNamespace(),
isPod ? "POD_NAME" : "OBJECT_NAME",
objRef.getName()));
objRef.getName(),
"CONDITION_READY",
String.valueOf(Boolean.TRUE.equals(conditions.getReady())),
"CONDITION_SERVING",
String.valueOf(
Boolean.TRUE.equals(conditions.getServing())),
"CONDITION_TERMINATING",
String.valueOf(
Boolean.TRUE.equals(conditions.getTerminating()))));

return target;
} catch (Exception e) {
Expand Down

0 comments on commit 7067272

Please sign in to comment.