Commit 7d28c89 and authored Sep 18, 2024 · 9 / 24 · Verified
1 parent 7f417e2 commit 7d28c89 Copy full SHA for 7d28c89
File tree 9 files changed +353
-0
lines changed
resource_customizations/rabbitmq.com/RabbitmqCluster
9 files changed +353
-0
lines changed Original file line number Diff line number Diff line change
1
+ hs = {}
2
+ clusterAvailable = {}
3
+ allReplicasReady = {}
4
+
5
+ if obj .status ~= nil then
6
+ if obj .status .conditions ~= nil then
7
+
8
+ for i , condition in ipairs (obj .status .conditions ) do
9
+ if condition .type == " ReconcileSuccess" and condition .status == " False" then
10
+ hs .status = " Degraded"
11
+ hs .message = condition .message
12
+ return hs
13
+ end
14
+ if condition .type == " ClusterAvailable" then
15
+ clusterAvailable .status = condition .status
16
+ clusterAvailable .message = condition .message
17
+ end
18
+ if condition .type == " AllReplicasReady" then
19
+ allReplicasReady .status = condition .status
20
+ allReplicasReady .message = condition .message
21
+ end
22
+ end
23
+
24
+ if clusterAvailable .status == " Unknown" or allReplicasReady .status == " Unknown" then
25
+ hs .status = " Degraded"
26
+ hs .message = " No statefulset or endpoints found"
27
+ return hs
28
+ end
29
+
30
+ if clusterAvailable .status == " False" then
31
+ hs .status = " Progressing"
32
+ hs .message = " Waiting for RabbitMQ cluster formation"
33
+ return hs
34
+ end
35
+
36
+ if allReplicasReady .status == " False" then
37
+ hs .status = " Progressing"
38
+ hs .message = " Waiting for RabbitMQ instances ready"
39
+ return hs
40
+ end
41
+
42
+ if clusterAvailable .status == " True" and allReplicasReady .status == " True" then
43
+ hs .status = " Healthy"
44
+ hs .message = " RabbitMQ cluster ready"
45
+ return hs
46
+ end
47
+
48
+ end
49
+ end
50
+
51
+ hs .status = " Progressing"
52
+ hs .message = " Waiting for RabbitMQ Operator"
53
+ return hs
Original file line number Diff line number Diff line change
1
+ tests :
2
+ - healthStatus :
3
+ status : Degraded
4
+ message : Unknown 'foo' parameter
5
+ inputPath : testdata/degraded_badconfig.yaml
6
+ - healthStatus :
7
+ status : Degraded
8
+ message : No statefulset or endpoints found
9
+ inputPath : testdata/degraded_cluster_unknown.yaml
10
+ - healthStatus :
11
+ status : Degraded
12
+ message : No statefulset or endpoints found
13
+ inputPath : testdata/degraded_replicas_unknown.yaml
14
+ - healthStatus :
15
+ status : Progressing
16
+ message : Waiting for RabbitMQ Operator
17
+ inputPath : testdata/progressing_no_status.yaml
18
+ - healthStatus :
19
+ status : Progressing
20
+ message : Waiting for RabbitMQ cluster formation
21
+ inputPath : testdata/progressing_cluster_unavailable.yaml
22
+ - healthStatus :
23
+ status : Progressing
24
+ message : Waiting for RabbitMQ instances ready
25
+ inputPath : testdata/progressing_pods_not_ready.yaml
26
+ - healthStatus :
27
+ status : Healthy
28
+ message : RabbitMQ cluster ready
29
+ inputPath : testdata/healthy.yaml
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ foo : bar
25
+ status :
26
+ conditions :
27
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
28
+ message : Unknown 'foo' parameter
29
+ reason : Initializing
30
+ status : " False"
31
+ type : ReconcileSuccess
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ status :
25
+ conditions :
26
+ - lastTransitionTime : " 2023-08-30T07:44:34Z"
27
+ reason : NotAllPodsReady
28
+ message : 0/3 Pods ready
29
+ status : " False"
30
+ type : AllReplicasReady
31
+ - lastTransitionTime : " 2023-08-30T07:37:06Z"
32
+ reason : CouldNotRetrieveEndpoints
33
+ message : Could not verify available service endpoints
34
+ status : " Unknown"
35
+ type : ClusterAvailable
36
+ - lastTransitionTime : " 2023-08-30T07:33:06Z"
37
+ reason : NoWarnings
38
+ status : " True"
39
+ type : NoWarnings
40
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
41
+ message : Finish reconciling
42
+ reason : Success
43
+ status : " True"
44
+ type : ReconcileSuccess
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ status :
25
+ conditions :
26
+ - lastTransitionTime : " 2023-08-30T07:44:34Z"
27
+ reason : MissingStatefulSet
28
+ message : Could not find StatefulSet
29
+ status : " Unknown"
30
+ type : AllReplicasReady
31
+ - lastTransitionTime : " 2023-08-30T07:37:06Z"
32
+ reason : NoEndpointsAvailable
33
+ message : The service has no endpoints available
34
+ status : " False"
35
+ type : ClusterAvailable
36
+ - lastTransitionTime : " 2023-08-30T07:33:06Z"
37
+ reason : NoWarnings
38
+ status : " True"
39
+ type : NoWarnings
40
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
41
+ message : Finish reconciling
42
+ reason : Success
43
+ status : " True"
44
+ type : ReconcileSuccess
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ status :
25
+ conditions :
26
+ - lastTransitionTime : " 2023-08-30T07:44:34Z"
27
+ reason : AllPodsAreReady
28
+ status : " True"
29
+ type : AllReplicasReady
30
+ - lastTransitionTime : " 2023-08-30T07:37:06Z"
31
+ reason : AtLeastOneEndpointAvailable
32
+ status : " True"
33
+ type : ClusterAvailable
34
+ - lastTransitionTime : " 2023-08-30T07:33:06Z"
35
+ reason : NoWarnings
36
+ status : " True"
37
+ type : NoWarnings
38
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
39
+ message : Finish reconciling
40
+ reason : Success
41
+ status : " True"
42
+ type : ReconcileSuccess
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ status :
25
+ conditions :
26
+ - lastTransitionTime : " 2023-08-30T07:44:34Z"
27
+ reason : NotAllPodsReady
28
+ message : 0/3 Pods ready
29
+ status : " False"
30
+ type : AllReplicasReady
31
+ - lastTransitionTime : " 2023-08-30T07:37:06Z"
32
+ reason : NoEndpointsAvailable
33
+ message : The service has no endpoints available
34
+ status : " False"
35
+ type : ClusterAvailable
36
+ - lastTransitionTime : " 2023-08-30T07:33:06Z"
37
+ reason : NoWarnings
38
+ status : " True"
39
+ type : NoWarnings
40
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
41
+ message : Finish reconciling
42
+ reason : Success
43
+ status : " True"
44
+ type : ReconcileSuccess
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
Original file line number Diff line number Diff line change
1
+ apiVersion : rabbitmq.com/v1beta1
2
+ kind : RabbitmqCluster
3
+ metadata :
4
+ labels :
5
+ app : example-rabbitmq
6
+ name : example-rabbitmq
7
+ namespace : example
8
+ spec :
9
+ image : docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
10
+ persistence :
11
+ storage : 32Gi
12
+ storageClassName : default
13
+ rabbitmq :
14
+ replicas : 3
15
+ resources :
16
+ limits :
17
+ cpu : 250m
18
+ memory : 1792Mi
19
+ requests :
20
+ cpu : 250m
21
+ memory : 1792Mi
22
+ service :
23
+ type : ClusterIP
24
+ status :
25
+ conditions :
26
+ - lastTransitionTime : " 2023-08-30T07:44:34Z"
27
+ reason : NotAllPodsReady
28
+ message : 1/3 Pods ready
29
+ status : " False"
30
+ type : AllReplicasReady
31
+ - lastTransitionTime : " 2023-08-30T07:37:06Z"
32
+ reason : AtLeastOneEndpointAvailable
33
+ status : " True"
34
+ type : ClusterAvailable
35
+ - lastTransitionTime : " 2023-08-30T07:33:06Z"
36
+ reason : NoWarnings
37
+ status : " True"
38
+ type : NoWarnings
39
+ - lastTransitionTime : " 2023-08-30T07:44:39Z"
40
+ message : Finish reconciling
41
+ reason : Success
42
+ status : " True"
43
+ type : ReconcileSuccess
You can’t perform that action at this time.
0 commit comments