Skip to content

Commit

Permalink
feat(health): Added Humio Operator Healthchecks (#11628)
Browse files Browse the repository at this point in the history
* Added Humio Operator Healthchecks

Signed-off-by: togie6 <22466611+togie6@users.noreply.github.com>

* Retrigger CI pipeline

Signed-off-by: togie6 <22466611+togie6@users.noreply.github.com>

* Removed duplicate if statement from HumioView

Signed-off-by: togie6 <22466611+togie6@users.noreply.github.com>

* Add HumioCluster Health Check

Signed-off-by: togie6 <22466611+togie6@users.noreply.github.com>

---------

Signed-off-by: togie6 <22466611+togie6@users.noreply.github.com>
Co-authored-by: pasha-codefresh <pavel@codefresh.io>
  • Loading branch information
togie6 and pasha-codefresh committed May 8, 2024
1 parent 9bc9ff9 commit 1cd6fca
Show file tree
Hide file tree
Showing 52 changed files with 1,428 additions and 0 deletions.
30 changes: 30 additions & 0 deletions resource_customizations/core.humio.com/HumioAction/health.lua
@@ -0,0 +1,30 @@
hs = {
status = "Progressing",
message = "Update in progress"
}
if obj.status ~= nil then
if obj.status.state ~= nil then
if obj.status.state == "Exists" then
hs.status = "Healthy"
hs.message = "Component state: Exists."
end
if obj.status.state == "NotFound" then
hs.status = "Missing"
hs.message = "Component state: NotFound."
end
if obj.status.state == "ConfigError" then
hs.status = "Degraded"
hs.message = "Component state: ConfigError."
end
if obj.status.state == "Unknown" then
hs.status = "Unknown"
hs.message = "Component state: Unknown."
end
if obj.status.state == "Unknown" then
hs.status = "Unknown"
hs.message = "Component state: Unknown."
end
end
return hs
end
return hs
@@ -0,0 +1,21 @@
tests:
- healthStatus:
status: Healthy
message: "Component state: Exists."
inputPath: testdata/healthy.yaml
- healthStatus:
status: Missing
message: "Component state: NotFound."
inputPath: testdata/notfound.yaml
- healthStatus:
status: Degraded
message: "Component state: ConfigError."
inputPath: testdata/configerror.yaml
- healthStatus:
status: Unknown
message: "Component state: Unknown."
inputPath: testdata/unknown.yaml
- healthStatus:
status: Progressing
message: "Update in progress"
inputPath: testdata/progressing.yaml
@@ -0,0 +1,23 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAction
metadata:
annotations:
creationTimestamp: '2022-12-08T02:03:07Z'
generation: 1
labels:
app.kubernetes.io/instance: humio-deploy
name: test-action-1
namespace: humio
resourceVersion: '10768054'
uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e
spec:
humioRepositoryProperties:
ingestTokenSource:
secretKeyRef:
key: test-token
name: token
managedClusterName: example-humiocluster
name: trigger_action
viewName: example-1
status:
state: ConfigError
@@ -0,0 +1,23 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAction
metadata:
annotations:
creationTimestamp: '2022-12-08T02:03:07Z'
generation: 1
labels:
app.kubernetes.io/instance: humio-deploy
name: test-action-1
namespace: humio
resourceVersion: '10768054'
uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e
spec:
humioRepositoryProperties:
ingestTokenSource:
secretKeyRef:
key: test-token
name: token
managedClusterName: example-humiocluster
name: trigger_action
viewName: example-1
status:
state: Exists
@@ -0,0 +1,23 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAction
metadata:
annotations:
creationTimestamp: '2022-12-08T02:03:07Z'
generation: 1
labels:
app.kubernetes.io/instance: humio-deploy
name: test-action-1
namespace: humio
resourceVersion: '10768054'
uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e
spec:
humioRepositoryProperties:
ingestTokenSource:
secretKeyRef:
key: test-token
name: token
managedClusterName: example-humiocluster
name: trigger_action
viewName: example-1
status:
state: NotFound
@@ -0,0 +1,21 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAction
metadata:
annotations:
creationTimestamp: '2022-12-08T02:03:07Z'
generation: 1
labels:
app.kubernetes.io/instance: humio-deploy
name: test-action-1
namespace: humio
resourceVersion: '10768054'
uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e
spec:
humioRepositoryProperties:
ingestTokenSource:
secretKeyRef:
key: test-token
name: token
managedClusterName: example-humiocluster
name: trigger_action
viewName: example-1
@@ -0,0 +1,23 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAction
metadata:
annotations:
creationTimestamp: '2022-12-08T02:03:07Z'
generation: 1
labels:
app.kubernetes.io/instance: humio-deploy
name: test-action-1
namespace: humio
resourceVersion: '10768054'
uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e
spec:
humioRepositoryProperties:
ingestTokenSource:
secretKeyRef:
key: test-token
name: token
managedClusterName: example-humiocluster
name: trigger_action
viewName: example-1
status:
state: Unknown
30 changes: 30 additions & 0 deletions resource_customizations/core.humio.com/HumioAlert/health.lua
@@ -0,0 +1,30 @@
hs = {
status = "Progressing",
message = "Update in progress"
}
if obj.status ~= nil then
if obj.status.state ~= nil then
if obj.status.state == "Exists" then
hs.status = "Healthy"
hs.message = "Component state: Exists."
end
if obj.status.state == "NotFound" then
hs.status = "Missing"
hs.message = "Component state: NotFound."
end
if obj.status.state == "ConfigError" then
hs.status = "Degraded"
hs.message = "Component state: ConfigError."
end
if obj.status.state == "Unknown" then
hs.status = "Unknown"
hs.message = "Component state: Unknown."
end
if obj.status.state == "Unknown" then
hs.status = "Unknown"
hs.message = "Component state: Unknown."
end
end
return hs
end
return hs
21 changes: 21 additions & 0 deletions resource_customizations/core.humio.com/HumioAlert/health_test.yaml
@@ -0,0 +1,21 @@
tests:
- healthStatus:
status: Healthy
message: "Component state: Exists."
inputPath: testdata/healthy.yaml
- healthStatus:
status: Missing
message: "Component state: NotFound."
inputPath: testdata/notfound.yaml
- healthStatus:
status: Degraded
message: "Component state: ConfigError."
inputPath: testdata/configerror.yaml
- healthStatus:
status: Unknown
message: "Component state: Unknown."
inputPath: testdata/unknown.yaml
- healthStatus:
status: Progressing
message: "Update in progress"
inputPath: testdata/progressing.yaml
@@ -0,0 +1,29 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAlert
metadata:
creationTimestamp: '2022-12-08T02:03:07Z'
finalizers:
- core.humio.com/finalizer
generation: 3
labels:
app.kubernetes.io/instance: humio-deploy
name: example-alert-1
namespace: humio
resourceVersion: '10768150'
uid: eb138512-0661-47c1-a056-0e53f3b5fa1f
spec:
actions:
- move-to-alerts
description: Error counts
labels:
- test-label
managedClusterName: example-humiocluster
name: example-alert
query:
queryString: '#repo = humio | error = true | count() | _count > 0'
start: 24h
silenced: false
throttleTimeMillis: 60000
viewName: example-view
status:
state: ConfigError
@@ -0,0 +1,29 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAlert
metadata:
creationTimestamp: '2022-12-08T02:03:07Z'
finalizers:
- core.humio.com/finalizer
generation: 3
labels:
app.kubernetes.io/instance: humio-deploy
name: example-alert-1
namespace: humio
resourceVersion: '10768150'
uid: eb138512-0661-47c1-a056-0e53f3b5fa1f
spec:
actions:
- move-to-alerts
description: Error counts
labels:
- test-label
managedClusterName: example-humiocluster
name: example-alert
query:
queryString: '#repo = humio | error = true | count() | _count > 0'
start: 24h
silenced: false
throttleTimeMillis: 60000
viewName: example-view
status:
state: Exists
@@ -0,0 +1,29 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAlert
metadata:
creationTimestamp: '2022-12-08T02:03:07Z'
finalizers:
- core.humio.com/finalizer
generation: 3
labels:
app.kubernetes.io/instance: humio-deploy
name: example-alert-1
namespace: humio
resourceVersion: '10768150'
uid: eb138512-0661-47c1-a056-0e53f3b5fa1f
spec:
actions:
- move-to-alerts
description: Error counts
labels:
- test-label
managedClusterName: example-humiocluster
name: example-alert
query:
queryString: '#repo = humio | error = true | count() | _count > 0'
start: 24h
silenced: false
throttleTimeMillis: 60000
viewName: example-view
status:
state: NotFound
@@ -0,0 +1,27 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAlert
metadata:
creationTimestamp: '2022-12-08T02:03:07Z'
finalizers:
- core.humio.com/finalizer
generation: 3
labels:
app.kubernetes.io/instance: humio-deploy
name: example-alert-1
namespace: humio
resourceVersion: '10768150'
uid: eb138512-0661-47c1-a056-0e53f3b5fa1f
spec:
actions:
- move-to-alerts
description: Error counts
labels:
- test-label
managedClusterName: example-humiocluster
name: example-alert
query:
queryString: '#repo = humio | error = true | count() | _count > 0'
start: 24h
silenced: false
throttleTimeMillis: 60000
viewName: example-view
@@ -0,0 +1,29 @@
apiVersion: core.humio.com/v1alpha1
kind: HumioAlert
metadata:
creationTimestamp: '2022-12-08T02:03:07Z'
finalizers:
- core.humio.com/finalizer
generation: 3
labels:
app.kubernetes.io/instance: humio-deploy
name: example-alert-1
namespace: humio
resourceVersion: '10768150'
uid: eb138512-0661-47c1-a056-0e53f3b5fa1f
spec:
actions:
- move-to-alerts
description: Error counts
labels:
- test-label
managedClusterName: example-humiocluster
name: example-alert
query:
queryString: '#repo = humio | error = true | count() | _count > 0'
start: 24h
silenced: false
throttleTimeMillis: 60000
viewName: example-view
status:
state: Unknown

0 comments on commit 1cd6fca

Please sign in to comment.