Skip to content

Commit ab8d44c

Browse files
authored
return failed status if container returns with non-zero code (#598)
Signed-off-by: Matthias Bertschy <[email protected]>
1 parent eba9d45 commit ab8d44c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ require (
3333
github.com/joncrlsn/dque v0.0.0-20241024143830-7723fd131a64
3434
github.com/kubescape/backend v0.0.25
3535
github.com/kubescape/go-logger v0.0.24
36-
github.com/kubescape/k8s-interface v0.0.197
36+
github.com/kubescape/k8s-interface v0.0.198
3737
github.com/kubescape/storage v0.0.200
3838
github.com/kubescape/workerpool v0.0.0-20250526074519-0e4a4e7f44cf
3939
github.com/moby/sys/mountinfo v0.7.2
40+
github.com/oleiade/lane/v2 v2.0.0
4041
github.com/opencontainers/go-digest v1.0.0
4142
github.com/opencontainers/image-spec v1.1.1
4243
github.com/panjf2000/ants/v2 v2.11.3
@@ -245,7 +246,6 @@ require (
245246
github.com/ncw/directio v1.0.5 // indirect
246247
github.com/nwaples/rardecode v1.1.3 // indirect
247248
github.com/oklog/ulid v1.3.1 // indirect
248-
github.com/oleiade/lane/v2 v2.0.0 // indirect
249249
github.com/olekukonko/tablewriter v0.0.5 // indirect
250250
github.com/olvrng/ujson v1.1.0 // indirect
251251
github.com/opencontainers/runtime-spec v1.2.1 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,8 @@ github.com/kubescape/backend v0.0.25 h1:PLESA7KGJskebR5hiSqPeJ1cPQ8Ra+4yNYXKyIej
704704
github.com/kubescape/backend v0.0.25/go.mod h1:FpazfN+c3Ucuvv4jZYCnk99moSBRNMVIxl5aWCZAEBo=
705705
github.com/kubescape/go-logger v0.0.24 h1:JRNlblY16Ty7hD6MSYNPvWYDxNzVAufsDDX/sZJayL0=
706706
github.com/kubescape/go-logger v0.0.24/go.mod h1:sMPVCr3VpW/e+SeMaXig5kClGvmZbDXN8YktUeNU4nY=
707-
github.com/kubescape/k8s-interface v0.0.197 h1:v+frj62buBQ79/C5iZVKcDuwuZuw/pEQQasSO8fwFUk=
708-
github.com/kubescape/k8s-interface v0.0.197/go.mod h1:j9snZbH+RxOaa1yG/bWgTClj90q7To0rGgQepxy4b+k=
707+
github.com/kubescape/k8s-interface v0.0.198 h1:U7PNTyS9ZE9ZkSrLMclLO7Sz4grf/2CLbmpVT6Hc0nU=
708+
github.com/kubescape/k8s-interface v0.0.198/go.mod h1:j9snZbH+RxOaa1yG/bWgTClj90q7To0rGgQepxy4b+k=
709709
github.com/kubescape/storage v0.0.200 h1:gLCPiAPxDii03Jo326Ye0qx1cXOAz6KH+A9B0WuL1CE=
710710
github.com/kubescape/storage v0.0.200/go.mod h1:uv4LMQjcTYIn7bgyMFGc0UBZ3gxdl7MNixPSjALP08E=
711711
github.com/kubescape/workerpool v0.0.0-20250526074519-0e4a4e7f44cf h1:hI0jVwrB6fT4GJWvuUjzObfci1CUknrZdRHfnRVtKM0=

pkg/containerprofilemanager/v1/lifecycle.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ func (cpm *ContainerProfileManager) deleteContainer(container *containercollecti
241241
container.K8s.PodName, container.K8s.ContainerName, containerID) == 0 {
242242
entry.data.watchedContainerData.SetStatus(objectcache.WatchedContainerStatusCompleted)
243243
} else {
244-
// TODO return error code to storage instead of staying on learning
245-
// so we can close the TS and move away - this will not reflect on the CP and AP/NN
244+
entry.data.watchedContainerData.SetStatus(objectcache.WatchedContainerStatusFailed)
246245
}
247246

248247
// Send container termination signal (blocking send, safe because monitoring goroutine is always running)

pkg/objectcache/shared_container_data.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const (
3636
WatchedContainerStatusInitializing WatchedContainerStatus = helpersv1.Initializing
3737
WatchedContainerStatusReady WatchedContainerStatus = helpersv1.Learning
3838
WatchedContainerStatusCompleted WatchedContainerStatus = helpersv1.Completed
39+
WatchedContainerStatusFailed WatchedContainerStatus = helpersv1.Failed
3940

4041
WatchedContainerStatusMissingRuntime WatchedContainerStatus = helpersv1.MissingRuntime
4142
WatchedContainerStatusTooLarge WatchedContainerStatus = helpersv1.TooLarge

0 commit comments

Comments
 (0)