feat: Confluent Connector Resource Health Checker - #17695 (#17697)

* Adding Synergy as a ArgoCD user

Signed-off-by: GitHub <noreply@github.com>

* Health checking Kafka Connector resources

Signed-off-by: Clint Chester <clint.chester@synergy.net.au>

* Includes Kafka Connect Task Failures

Signed-off-by: Clint Chester <clint.chester@synergy.net.au>

---------

Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Clint Chester <clint.chester@synergy.net.au>
This commit is contained in:
Clint Chester
2024-12-16 04:58:30 +08:00
committed by GitHub
parent fdf539dc6a
commit 99efafb55a
6 changed files with 134 additions and 0 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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