Skip to content

Commit 96039be

Browse files
feat(health): add Rabbitmq topology resource customizations (#22066)
Signed-off-by: Francis Provencher <[email protected]>
1 parent 4905876 commit 96039be

40 files changed

+737
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
local hs = {}
2+
if obj.status ~= nil and obj.status.conditions ~= nil then
3+
for i, condition in ipairs(obj.status.conditions) do
4+
if condition.type == "Ready" then
5+
if condition.status == "True" and condition.reason == "SuccessfulCreateOrUpdate" then
6+
hs.status = "Healthy"
7+
hs.message = "RabbitMQ binding ready"
8+
return hs
9+
end
10+
11+
if condition.status == "False" and condition.reason == "FailedCreateOrUpdate" then
12+
hs.status = "Degraded"
13+
hs.message = "RabbitMQ binding failed to be created or updated"
14+
return hs
15+
end
16+
end
17+
end
18+
end
19+
20+
hs.status = "Unknown"
21+
hs.message = "RabbitMQ binding status is unknown"
22+
return hs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests:
2+
- healthStatus:
3+
status: Degraded
4+
message: RabbitMQ binding failed to be created or updated
5+
inputPath: testdata/degraded.yaml
6+
- healthStatus:
7+
status: Unknown
8+
message: RabbitMQ binding status is unknown
9+
inputPath: testdata/unknown.yaml
10+
- healthStatus:
11+
status: Healthy
12+
message: RabbitMQ binding ready
13+
inputPath: testdata/healthy.yaml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Binding
3+
metadata:
4+
labels:
5+
app: example-rabbitmq
6+
name: example-rabbitmq
7+
namespace: example
8+
spec:
9+
destination: destination
10+
destinationType: queue
11+
rabbitmqClusterReference:
12+
name: example-rabbitmq
13+
routingKey: v1.example.request
14+
source: operation-requests
15+
vhost: /
16+
status:
17+
conditions:
18+
- lastTransitionTime: 2025-02-24T17:51:10Z
19+
reason: FailedCreateOrUpdate
20+
status: "False"
21+
type: Ready
22+
observedGeneration: 1
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Binding
3+
metadata:
4+
labels:
5+
app: example-rabbitmq
6+
name: example-rabbitmq
7+
namespace: example
8+
spec:
9+
destination: destination
10+
destinationType: queue
11+
rabbitmqClusterReference:
12+
name: example-rabbitmq
13+
routingKey: v1.example.request
14+
source: operation-requests
15+
vhost: /
16+
status:
17+
conditions:
18+
- lastTransitionTime: 2025-02-24T17:51:10Z
19+
reason: SuccessfulCreateOrUpdate
20+
status: "True"
21+
type: Ready
22+
observedGeneration: 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Binding
3+
metadata:
4+
labels:
5+
app: example-rabbitmq
6+
name: example-rabbitmq
7+
namespace: example
8+
spec:
9+
destination: destination
10+
destinationType: queue
11+
rabbitmqClusterReference:
12+
name: example-rabbitmq
13+
routingKey: v1.example.request
14+
source: operation-requests
15+
vhost: /
16+
status: {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
local hs = {}
2+
if obj.status ~= nil and obj.status.conditions ~= nil then
3+
for i, condition in ipairs(obj.status.conditions) do
4+
if condition.type == "Ready" then
5+
if condition.status == "True" and condition.reason == "SuccessfulCreateOrUpdate" then
6+
hs.status = "Healthy"
7+
hs.message = "RabbitMQ exchange ready"
8+
return hs
9+
end
10+
11+
if condition.status == "False" and condition.reason == "FailedCreateOrUpdate" then
12+
hs.status = "Degraded"
13+
hs.message = "RabbitMQ exchange failed to be created or updated"
14+
return hs
15+
end
16+
end
17+
end
18+
end
19+
20+
hs.status = "Unknown"
21+
hs.message = "RabbitMQ exchange status is unknown"
22+
return hs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
tests:
2+
- healthStatus:
3+
status: Degraded
4+
message: RabbitMQ exchange failed to be created or updated
5+
inputPath: testdata/degraded.yaml
6+
- healthStatus:
7+
status: Unknown
8+
message: RabbitMQ exchange status is unknown
9+
inputPath: testdata/unknown.yaml
10+
- healthStatus:
11+
status: Healthy
12+
message: RabbitMQ exchange ready
13+
inputPath: testdata/healthy.yaml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Exchange
3+
metadata:
4+
generation: 3
5+
name: example-rabbit
6+
namespace: example-rabbit
7+
spec:
8+
autoDelete: false
9+
durable: true
10+
name: example-rabbit
11+
rabbitmqClusterReference:
12+
name: example-rabbit
13+
type: topic
14+
vhost: /
15+
status:
16+
conditions:
17+
- lastTransitionTime: 2025-02-24T17:51:10Z
18+
reason: FailedCreateOrUpdate
19+
status: "False"
20+
type: Ready
21+
observedGeneration: 1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Exchange
3+
metadata:
4+
generation: 3
5+
name: example-rabbit
6+
namespace: example-rabbit
7+
spec:
8+
autoDelete: false
9+
durable: true
10+
name: example-rabbit
11+
rabbitmqClusterReference:
12+
name: example-rabbit
13+
type: topic
14+
vhost: /
15+
status:
16+
conditions:
17+
- lastTransitionTime: 2025-02-24T17:51:10Z
18+
reason: SuccessfulCreateOrUpdate
19+
status: "True"
20+
type: Ready
21+
observedGeneration: 1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: Exchange
3+
metadata:
4+
generation: 3
5+
name: example-rabbit
6+
namespace: example-rabbit
7+
spec:
8+
autoDelete: false
9+
durable: true
10+
name: example-rabbit
11+
rabbitmqClusterReference:
12+
name: example-rabbit
13+
type: topic
14+
vhost: /
15+
status: {}

0 commit comments

Comments
 (0)