Skip to content

Commit

Permalink
Add pod name and namespace to pod related events. (#578)
Browse files Browse the repository at this point in the history
* Add pod name and namespace to pod related events.

* Add generated .net client with new event properties.
  • Loading branch information
jankaspar committed May 20, 2021
1 parent 8016092 commit 3acd6c1
Show file tree
Hide file tree
Showing 7 changed files with 1,137 additions and 123 deletions.
48 changes: 48 additions & 0 deletions client/DotNet/Armada.Client/ClientGenerated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,12 @@ public partial class ApiJobFailedEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -882,6 +888,12 @@ public partial class ApiJobIngressInfoEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -972,6 +984,12 @@ public partial class ApiJobPendingEvent
[Newtonsoft.Json.JsonProperty("kubernetesId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string KubernetesId { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -1038,6 +1056,12 @@ public partial class ApiJobRunningEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -1191,6 +1215,12 @@ public partial class ApiJobSucceededEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -1218,6 +1248,12 @@ public partial class ApiJobTerminatedEvent
[Newtonsoft.Json.JsonProperty("kubernetesId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string KubernetesId { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -1251,6 +1287,12 @@ public partial class ApiJobUnableToScheduleEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down Expand Up @@ -1287,6 +1329,12 @@ public partial class ApiJobUtilisationEvent
[Newtonsoft.Json.JsonProperty("nodeName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string NodeName { get; set; }

[Newtonsoft.Json.JsonProperty("podName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodName { get; set; }

[Newtonsoft.Json.JsonProperty("podNamespace", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string PodNamespace { get; set; }

[Newtonsoft.Json.JsonProperty("podNumber", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? PodNumber { get; set; }

Expand Down
16 changes: 16 additions & 0 deletions internal/executor/reporter/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func CreateEventForCurrentState(pod *v1.Pod, clusterId string) (api.Event, error
ClusterId: clusterId,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
}, nil
case v1.PodRunning:
return &api.JobRunningEvent{
Expand All @@ -37,6 +39,8 @@ func CreateEventForCurrentState(pod *v1.Pod, clusterId string) (api.Event, error
ClusterId: clusterId,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
}, nil
case v1.PodFailed:
Expand All @@ -56,6 +60,8 @@ func CreateEventForCurrentState(pod *v1.Pod, clusterId string) (api.Event, error
ClusterId: clusterId,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
}, nil
default:
Expand All @@ -82,6 +88,8 @@ func CreateJobUnableToScheduleEvent(pod *v1.Pod, reason string, clusterId string
Reason: reason,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
}
}
Expand Down Expand Up @@ -118,6 +126,8 @@ func CreateJobIngressInfoEvent(pod *v1.Pod, clusterId string, associatedService
ClusterId: clusterId,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
IngressAddresses: containerPortMapping,
}, nil
Expand All @@ -139,6 +149,8 @@ func CreateJobFailedEvent(pod *v1.Pod, reason string, cause api.Cause, container
ExitCodes: exitCodes,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
ContainerStatuses: containerStatuses,
Cause: cause,
Expand All @@ -155,6 +167,8 @@ func CreateJobUtilisationEvent(pod *v1.Pod, maxResources common.ComputeResources
MaxResourcesForPeriod: maxResources,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
NodeName: pod.Spec.NodeName,
}
}
Expand All @@ -168,6 +182,8 @@ func CreateJobTerminatedEvent(pod *v1.Pod, reason string, clusterId string) api.
ClusterId: clusterId,
KubernetesId: string(pod.ObjectMeta.UID),
PodNumber: getPodNumber(pod),
PodName: pod.Name,
PodNamespace: pod.Namespace,
Reason: reason,
}
}
48 changes: 48 additions & 0 deletions pkg/api/api.swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -581,6 +587,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -672,6 +684,12 @@ func SwaggerJsonTemplate() string {
" \"kubernetesId\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -739,6 +757,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -914,6 +938,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -942,6 +972,12 @@ func SwaggerJsonTemplate() string {
" \"kubernetesId\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -976,6 +1012,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down Expand Up @@ -1016,6 +1058,12 @@ func SwaggerJsonTemplate() string {
" \"nodeName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podName\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNamespace\": {\n" +
" \"type\": \"string\"\n" +
" },\n" +
" \"podNumber\": {\n" +
" \"type\": \"integer\",\n" +
" \"format\": \"int32\"\n" +
Expand Down
48 changes: 48 additions & 0 deletions pkg/api/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -570,6 +576,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -661,6 +673,12 @@
"kubernetesId": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -728,6 +746,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -903,6 +927,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -931,6 +961,12 @@
"kubernetesId": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -965,6 +1001,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down Expand Up @@ -1005,6 +1047,12 @@
"nodeName": {
"type": "string"
},
"podName": {
"type": "string"
},
"podNamespace": {
"type": "string"
},
"podNumber": {
"type": "integer",
"format": "int32"
Expand Down

0 comments on commit 3acd6c1

Please sign in to comment.