feat: Implement Altinity clickhouse-operator CRD health checks (#24017)

Signed-off-by: Szymon Kośla <szymon.kosla@gmail.com>
This commit is contained in:
Szymon Kośla
2025-09-06 20:15:01 +02:00
committed by GitHub
parent 9922336968
commit c447628913
12 changed files with 240 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
local hs = {}
if obj.status ~= nil and obj.status.status ~= nil then
if obj.status.status == "Completed" then
hs.status = "Healthy"
hs.message = "ClickHouseKeeper installation completed successfully"
elseif obj.status.status == "InProgress" then
hs.status = "Progressing"
hs.message = "ClickHouseKeeper installation in progress"
else
hs.status = "Degraded"
hs.message = "ClickHouseKeeper status: " .. obj.status.status
end
else
hs.status = "Progressing"
hs.message = "ClickHouseKeeper status not yet available"
end
return hs

View File

@@ -0,0 +1,17 @@
tests:
- healthStatus:
status: Healthy
message: ClickHouseKeeper installation completed successfully
inputPath: testdata/healthy_completed.yaml
- healthStatus:
status: Progressing
message: ClickHouseKeeper installation in progress
inputPath: testdata/progressing_inprogress.yaml
- healthStatus:
status: Degraded
message: "ClickHouseKeeper status: Failed"
inputPath: testdata/degraded_failed.yaml
- healthStatus:
status: Progressing
message: ClickHouseKeeper status not yet available
inputPath: testdata/progressing_nostatus.yaml

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse-keeper.altinity.com/v1
kind: ClickHouseKeeperInstallation
metadata:
name: test-clickhouse-keeper
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9181
template:
spec:
containers:
- name: clickhouse-keeper
image: clickhouse/clickhouse-keeper:latest
status:
status: Failed

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse-keeper.altinity.com/v1
kind: ClickHouseKeeperInstallation
metadata:
name: test-clickhouse-keeper
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9181
template:
spec:
containers:
- name: clickhouse-keeper
image: clickhouse/clickhouse-keeper:latest
status:
status: Completed

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse-keeper.altinity.com/v1
kind: ClickHouseKeeperInstallation
metadata:
name: test-clickhouse-keeper
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9181
template:
spec:
containers:
- name: clickhouse-keeper
image: clickhouse/clickhouse-keeper:latest
status:
status: InProgress

View File

@@ -0,0 +1,20 @@
apiVersion: clickhouse-keeper.altinity.com/v1
kind: ClickHouseKeeperInstallation
metadata:
name: test-clickhouse-keeper
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9181
template:
spec:
containers:
- name: clickhouse-keeper
image: clickhouse/clickhouse-keeper:latest

View File

@@ -0,0 +1,17 @@
local hs = {}
if obj.status ~= nil and obj.status.status ~= nil then
if obj.status.status == "Completed" then
hs.status = "Healthy"
hs.message = "ClickHouse installation completed successfully"
elseif obj.status.status == "InProgress" then
hs.status = "Progressing"
hs.message = "ClickHouse installation in progress"
else
hs.status = "Degraded"
hs.message = "ClickHouse status: " .. obj.status.status
end
else
hs.status = "Progressing"
hs.message = "ClickHouse status not yet available"
end
return hs

View File

@@ -0,0 +1,17 @@
tests:
- healthStatus:
status: Healthy
message: ClickHouse installation completed successfully
inputPath: testdata/healthy_completed.yaml
- healthStatus:
status: Progressing
message: ClickHouse installation in progress
inputPath: testdata/progressing_inprogress.yaml
- healthStatus:
status: Degraded
message: "ClickHouse status: Failed"
inputPath: testdata/degraded_failed.yaml
- healthStatus:
status: Progressing
message: ClickHouse status not yet available
inputPath: testdata/progressing_nostatus.yaml

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
name: test-clickhouse
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9000
template:
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest
status:
status: Failed

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
name: test-clickhouse
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9000
template:
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest
status:
status: Completed

View File

@@ -0,0 +1,22 @@
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
name: test-clickhouse
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9000
template:
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest
status:
status: InProgress

View File

@@ -0,0 +1,20 @@
apiVersion: clickhouse.altinity.com/v1
kind: ClickHouseInstallation
metadata:
name: test-clickhouse
namespace: default
spec:
configuration:
clusters:
- name: cluster
layout:
shards:
- name: shard
replicas:
- name: replica
port: 9000
template:
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:latest