Skip to content

Commit

Permalink
feat: Confluent Connector Resource Health Checker - #17695 (#17697)
Browse files Browse the repository at this point in the history
* Adding Synergy as a ArgoCD user

Signed-off-by: GitHub <[email protected]>

* Health checking Kafka Connector resources

Signed-off-by: Clint Chester <[email protected]>

* Includes Kafka Connect Task Failures

Signed-off-by: Clint Chester <[email protected]>

---------

Signed-off-by: GitHub <[email protected]>
Signed-off-by: Clint Chester <[email protected]>
  • Loading branch information
Clint-Chester authored Dec 15, 2024
1 parent fdf539d commit 99efafb
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 0 deletions.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ Currently, the following organizations are **officially** using Argo CD:
1. [Swisscom](https://www.swisscom.ch)
1. [Swissquote](https://github.com/swissquote)
1. [Syncier](https://syncier.com/)
1. [Synergy](https://synergy.net.au)
1. [Syself](https://syself.com)
1. [TableCheck](https://tablecheck.com/)
1. [Tailor Brands](https://www.tailorbrands.com)
Expand Down
25 changes: 25 additions & 0 deletions resource_customizations/platform.confluent.io/Connector/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
hs = {}
if obj.status ~= nil and obj.status.state ~= nil then
if obj.status.state == "CREATED" and obj.status.connectorState == "RUNNING" and obj.status.failedTasksCount == nil then
hs.status = "Healthy"
hs.message = "Connector running"
return hs
end
if obj.status.state == "ERROR" then
hs.status = "Degraded"
if obj.status.conditions and #obj.status.conditions > 0 then
hs.message = obj.status.conditions[1].message -- Kafka Connector only has one condition and nests the issues in the error message here
else
hs.message = "No conditions available"
end
return hs
end
if obj.status.failedTasksCount ~= nil and obj.status.failedTasksCount > 0 then
hs.status = "Degraded"
hs.message = "Connector has failed tasks"
return hs
end
end
hs.status = "Progressing"
hs.message = "Waiting for Kafka Connector"
return hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests:
- healthStatus:
status: Healthy
message: 'Connector running'
inputPath: testdata/connector-healthy.yaml
- healthStatus:
status: Degraded
message: 'connect Rest API request failed: Connector configuration is invalid and contains the following 1 error(s): Could not read properties from file'
inputPath: testdata/connector-failure.yaml
- healthStatus:
status: Degraded
message: 'Connector has failed tasks'
inputPath: testdata/connector-task-failure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: platform.confluent.io/v1beta1
kind: Connector
metadata:
finalizers:
- connect.finalizers.platform.confluent.io
generation: 1
name: connect
namespace: confluent
spec:
class: io.confluent.connect.sftp.SftpSinkConnector
configs:
topics: test-topic
connectClusterRef:
name: connect
name: test-sftp-connector
taskMax: 3
status:
appState: Failed
conditions:
- lastProbeTime: '2024-04-02T07:43:35Z'
lastTransitionTime: '2024-04-02T07:43:35Z'
message: >-
connect Rest API request failed: Connector configuration is invalid and contains the following 1 error(s): Could not read properties from file
reason: CreateFailed
status: 'False'
type: platform.confluent.io/app-ready
state: ERROR
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: platform.confluent.io/v1beta1
kind: Connector
metadata:
finalizers:
- connect.finalizers.platform.confluent.io
generation: 1
name: connect
namespace: confluent
spec:
class: io.confluent.connect.sftp.SftpSinkConnector
configs:
topics: test-topic
connectClusterRef:
name: connect
name: test-sftp-connector
taskMax: 3
status:
appState: Created
conditions:
- lastProbeTime: '2024-04-02T07:43:35Z'
lastTransitionTime: '2024-04-02T07:43:35Z'
message: Application is created
reason: Created
status: 'True'
type: platform.confluent.io/app-ready
connectorState: RUNNING
restartPolicy:
maxRetry: 10
type: OnFailure
state: CREATED
tasksReady: 3/3
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: platform.confluent.io/v1beta1
kind: Connector
metadata:
finalizers:
- connect.finalizers.platform.confluent.io
generation: 1
name: connect
namespace: confluent
spec:
class: io.confluent.connect.sftp.SftpSinkConnector
configs:
topics: test-topic
connectClusterRef:
name: connect
name: test-sftp-connector
taskMax: 3
status:
appState: Unknown
conditions:
- lastProbeTime: '2024-01-19T06:42:40Z'
lastTransitionTime: '2024-01-19T06:42:40Z'
message: Application is created
reason: Created
status: 'True'
type: platform.confluent.io/app-ready
connectorState: RUNNING
failedTasks:
task-0:
id: 0
retryCount: 10
failedTasksCount: 1
observedGeneration: 1
restartPolicy:
maxRetry: 10
type: OnFailure
state: CREATED
tasksReady: 0/1

0 comments on commit 99efafb

Please sign in to comment.