Skip to content

Commit

Permalink
feat: introduce health checks for MonoVertexRollouts (argoproj#19688)
Browse files Browse the repository at this point in the history
Signed-off-by: Dillen Padhiar <[email protected]>
  • Loading branch information
dpadhiar authored Aug 27, 2024
1 parent 4ec26ce commit 32ee00f
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
local hs = {}
local healthyCondition = {}

if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
if condition.type == "ChildResourcesHealthy" then
healthyCondition = condition
end
end
end

if obj.metadata.generation == obj.status.observedGeneration then
if (healthyCondition ~= {} and healthyCondition.status == "False" and (obj.metadata.generation == healthyCondition.observedGeneration) and healthyCondition.reason == "MonoVertexFailed") or obj.status.phase == "Failed" then
hs.status = "Degraded"
if obj.status.phase == "Failed" then
hs.message = obj.status.message
else
hs.message = healthyCondition.message
end
return hs
elseif healthyCondition ~= {} and healthyCondition.status == "True" and (obj.metadata.generation == healthyCondition.observedGeneration) and obj.status.phase == "Deployed" then
hs.status = "Healthy"
hs.message = healthyCondition.message
return hs
end
end
end

hs.status = "Progressing"
hs.message = "Waiting for MonoVertex status"
return hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tests:
- healthStatus:
status: Progressing
message: "Waiting for MonoVertex status"
inputPath: testdata/progressing.yaml
- healthStatus:
status: Healthy
message: "Successful"
inputPath: testdata/healthy.yaml
- healthStatus:
status: Degraded
message: "MonoVertex Failed"
inputPath: testdata/degraded.yaml
- healthStatus:
status: Progressing
message: "Waiting for MonoVertex status"
inputPath: testdata/progressing-reason.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: numaplane.numaproj.io/v1alpha1
kind: MonoVertexRollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"numaplane.numaproj.io/v1alpha1","kind":"MonoVertexRollout","metadata":{"annotations":{},"labels":{"argocd.argoproj.io/instance":"demo-app"},"name":"my-monovertex","namespace":"example-namespace"},"spec":{"monoVertex":{"spec":{"sink":{"udsink":{"container":{"image":"quay.io/numaio/numaflow-java/simple-sink:stable"}}},"source":{"transformer":{"container":{"image":"quay.io/numaio/numaflow-rs/source-transformer-now:stable"}},"udsource":{"container":{"image":"quay.io/numaio/numaflow-java/source-simple-source:stable"}}}}}}}
creationTimestamp: '2024-08-21T20:44:18Z'
finalizers:
- numaplane.numaproj.io/numaplane-controller
generation: 1
labels:
argocd.argoproj.io/instance: demo-app
name: my-monovertex
namespace: example-namespace
resourceVersion: '947414'
uid: a63f377e-1500-437e-9267-579f4a790518
spec:
monoVertex:
spec:
sink:
udsink:
container:
image: 'bad-image'
source:
transformer:
container:
image: 'quay.io/numaio/numaflow-rs/source-transformer-now:stable'
udsource:
container:
image: 'quay.io/numaio/numaflow-java/source-simple-source:stable'
status:
conditions:
- lastTransitionTime: '2024-08-21T20:44:18Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourceDeployed
- lastTransitionTime: '2024-08-22T21:10:23Z'
message: MonoVertex Failed
observedGeneration: 1
reason: MonoVertexFailed
status: 'False'
type: ChildResourcesHealthy
message: Deployed
observedGeneration: 1
phase: Deployed
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: numaplane.numaproj.io/v1alpha1
kind: MonoVertexRollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"numaplane.numaproj.io/v1alpha1","kind":"MonoVertexRollout","metadata":{"annotations":{},"labels":{"argocd.argoproj.io/instance":"demo-app"},"name":"my-monovertex","namespace":"example-namespace"},"spec":{"monoVertex":{"spec":{"sink":{"udsink":{"container":{"image":"quay.io/numaio/numaflow-java/simple-sink:stable"}}},"source":{"transformer":{"container":{"image":"quay.io/numaio/numaflow-rs/source-transformer-now:stable"}},"udsource":{"container":{"image":"quay.io/numaio/numaflow-java/source-simple-source:stable"}}}}}}}
creationTimestamp: '2024-08-21T20:44:18Z'
finalizers:
- numaplane.numaproj.io/numaplane-controller
generation: 1
labels:
argocd.argoproj.io/instance: demo-app
name: my-monovertex
namespace: example-namespace
resourceVersion: '947414'
uid: a63f377e-1500-437e-9267-579f4a790518
spec:
monoVertex:
spec:
sink:
udsink:
container:
image: 'quay.io/numaio/numaflow-java/simple-sink:stable'
source:
transformer:
container:
image: 'quay.io/numaio/numaflow-rs/source-transformer-now:stable'
udsource:
container:
image: 'quay.io/numaio/numaflow-java/source-simple-source:stable'
status:
conditions:
- lastTransitionTime: '2024-08-21T20:44:18Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourceDeployed
- lastTransitionTime: '2024-08-22T21:10:23Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourcesHealthy
message: Deployed
observedGeneration: 1
phase: Deployed
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: numaplane.numaproj.io/v1alpha1
kind: MonoVertexRollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"numaplane.numaproj.io/v1alpha1","kind":"MonoVertexRollout","metadata":{"annotations":{},"labels":{"argocd.argoproj.io/instance":"demo-app"},"name":"my-monovertex","namespace":"example-namespace"},"spec":{"monoVertex":{"spec":{"sink":{"udsink":{"container":{"image":"quay.io/numaio/numaflow-java/simple-sink:stable"}}},"source":{"transformer":{"container":{"image":"quay.io/numaio/numaflow-rs/source-transformer-now:stable"}},"udsource":{"container":{"image":"quay.io/numaio/numaflow-java/source-simple-source:stable"}}}}}}}
creationTimestamp: '2024-08-21T20:44:18Z'
finalizers:
- numaplane.numaproj.io/numaplane-controller
generation: 1
labels:
argocd.argoproj.io/instance: demo-app
name: my-monovertex
namespace: example-namespace
resourceVersion: '947414'
uid: a63f377e-1500-437e-9267-579f4a790518
spec:
monoVertex:
spec:
sink:
udsink:
container:
image: 'quay.io/numaio/numaflow-java/simple-sink:stable'
source:
transformer:
container:
image: 'quay.io/numaio/numaflow-rs/source-transformer-now:stable'
udsource:
container:
image: 'quay.io/numaio/numaflow-java/source-simple-source:stable'
status:
conditions:
- lastTransitionTime: '2024-08-21T20:44:18Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourceDeployed
- lastTransitionTime: '2024-08-22T21:10:23Z'
message: Progressing
observedGeneration: 1
reason: Progressing
status: 'False'
type: ChildResourcesHealthy
message: Deployed
observedGeneration: 1
phase: Deployed
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: numaplane.numaproj.io/v1alpha1
kind: MonoVertexRollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"numaplane.numaproj.io/v1alpha1","kind":"MonoVertexRollout","metadata":{"annotations":{},"labels":{"argocd.argoproj.io/instance":"demo-app"},"name":"my-monovertex","namespace":"example-namespace"},"spec":{"monoVertex":{"spec":{"sink":{"udsink":{"container":{"image":"quay.io/numaio/numaflow-java/simple-sink:stable"}}},"source":{"transformer":{"container":{"image":"quay.io/numaio/numaflow-rs/source-transformer-now:stable"}},"udsource":{"container":{"image":"quay.io/numaio/numaflow-java/source-simple-source:stable"}}}}}}}
creationTimestamp: '2024-08-21T20:44:18Z'
finalizers:
- numaplane.numaproj.io/numaplane-controller
generation: 2
labels:
argocd.argoproj.io/instance: demo-app
name: my-monovertex
namespace: example-namespace
resourceVersion: '947414'
uid: a63f377e-1500-437e-9267-579f4a790518
spec:
monoVertex:
spec:
sink:
udsink:
container:
image: 'quay.io/numaio/numaflow-java/simple-sink:stable'
source:
transformer:
container:
image: 'quay.io/numaio/numaflow-rs/source-transformer-now:stable'
udsource:
container:
image: 'quay.io/numaio/numaflow-java/source-simple-source:stable'
status:
conditions:
- lastTransitionTime: '2024-08-21T20:44:18Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourceDeployed
- lastTransitionTime: '2024-08-22T21:10:23Z'
message: Successful
observedGeneration: 1
reason: Successful
status: 'True'
type: ChildResourcesHealthy
message: Deployed
observedGeneration: 1
phase: Deployed

0 comments on commit 32ee00f

Please sign in to comment.