mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
feat(health): resource customization for RabbitMQCluster (#15286)
Signed-off-by: Álvaro Aguilar <alvaro.aguilar@scrm.lidl> Co-authored-by: Blake Pettersson <blake.pettersson@gmail.com>
This commit is contained in:
parent
7f417e2be4
commit
7d28c89f36
9 changed files with 353 additions and 0 deletions
|
|
@ -0,0 +1,53 @@
|
|||
hs = {}
|
||||
clusterAvailable = {}
|
||||
allReplicasReady = {}
|
||||
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.type == "ReconcileSuccess" and condition.status == "False" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = condition.message
|
||||
return hs
|
||||
end
|
||||
if condition.type == "ClusterAvailable" then
|
||||
clusterAvailable.status = condition.status
|
||||
clusterAvailable.message = condition.message
|
||||
end
|
||||
if condition.type == "AllReplicasReady" then
|
||||
allReplicasReady.status = condition.status
|
||||
allReplicasReady.message = condition.message
|
||||
end
|
||||
end
|
||||
|
||||
if clusterAvailable.status == "Unknown" or allReplicasReady.status == "Unknown" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = "No statefulset or endpoints found"
|
||||
return hs
|
||||
end
|
||||
|
||||
if clusterAvailable.status == "False" then
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for RabbitMQ cluster formation"
|
||||
return hs
|
||||
end
|
||||
|
||||
if allReplicasReady.status == "False" then
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for RabbitMQ instances ready"
|
||||
return hs
|
||||
end
|
||||
|
||||
if clusterAvailable.status == "True" and allReplicasReady.status == "True" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = "RabbitMQ cluster ready"
|
||||
return hs
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for RabbitMQ Operator"
|
||||
return hs
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
tests:
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: Unknown 'foo' parameter
|
||||
inputPath: testdata/degraded_badconfig.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: No statefulset or endpoints found
|
||||
inputPath: testdata/degraded_cluster_unknown.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: No statefulset or endpoints found
|
||||
inputPath: testdata/degraded_replicas_unknown.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: Waiting for RabbitMQ Operator
|
||||
inputPath: testdata/progressing_no_status.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: Waiting for RabbitMQ cluster formation
|
||||
inputPath: testdata/progressing_cluster_unavailable.yaml
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: Waiting for RabbitMQ instances ready
|
||||
inputPath: testdata/progressing_pods_not_ready.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: RabbitMQ cluster ready
|
||||
inputPath: testdata/healthy.yaml
|
||||
31
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml
vendored
Normal file
31
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_badconfig.yaml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
foo: bar
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Unknown 'foo' parameter
|
||||
reason: Initializing
|
||||
status: "False"
|
||||
type: ReconcileSuccess
|
||||
44
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml
vendored
Normal file
44
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_cluster_unknown.yaml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:34Z"
|
||||
reason: NotAllPodsReady
|
||||
message: 0/3 Pods ready
|
||||
status: "False"
|
||||
type: AllReplicasReady
|
||||
- lastTransitionTime: "2023-08-30T07:37:06Z"
|
||||
reason: CouldNotRetrieveEndpoints
|
||||
message: Could not verify available service endpoints
|
||||
status: "Unknown"
|
||||
type: ClusterAvailable
|
||||
- lastTransitionTime: "2023-08-30T07:33:06Z"
|
||||
reason: NoWarnings
|
||||
status: "True"
|
||||
type: NoWarnings
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Finish reconciling
|
||||
reason: Success
|
||||
status: "True"
|
||||
type: ReconcileSuccess
|
||||
44
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml
vendored
Normal file
44
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/degraded_replicas_unknown.yaml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:34Z"
|
||||
reason: MissingStatefulSet
|
||||
message: Could not find StatefulSet
|
||||
status: "Unknown"
|
||||
type: AllReplicasReady
|
||||
- lastTransitionTime: "2023-08-30T07:37:06Z"
|
||||
reason: NoEndpointsAvailable
|
||||
message: The service has no endpoints available
|
||||
status: "False"
|
||||
type: ClusterAvailable
|
||||
- lastTransitionTime: "2023-08-30T07:33:06Z"
|
||||
reason: NoWarnings
|
||||
status: "True"
|
||||
type: NoWarnings
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Finish reconciling
|
||||
reason: Success
|
||||
status: "True"
|
||||
type: ReconcileSuccess
|
||||
42
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml
vendored
Normal file
42
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/healthy.yaml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:34Z"
|
||||
reason: AllPodsAreReady
|
||||
status: "True"
|
||||
type: AllReplicasReady
|
||||
- lastTransitionTime: "2023-08-30T07:37:06Z"
|
||||
reason: AtLeastOneEndpointAvailable
|
||||
status: "True"
|
||||
type: ClusterAvailable
|
||||
- lastTransitionTime: "2023-08-30T07:33:06Z"
|
||||
reason: NoWarnings
|
||||
status: "True"
|
||||
type: NoWarnings
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Finish reconciling
|
||||
reason: Success
|
||||
status: "True"
|
||||
type: ReconcileSuccess
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:34Z"
|
||||
reason: NotAllPodsReady
|
||||
message: 0/3 Pods ready
|
||||
status: "False"
|
||||
type: AllReplicasReady
|
||||
- lastTransitionTime: "2023-08-30T07:37:06Z"
|
||||
reason: NoEndpointsAvailable
|
||||
message: The service has no endpoints available
|
||||
status: "False"
|
||||
type: ClusterAvailable
|
||||
- lastTransitionTime: "2023-08-30T07:33:06Z"
|
||||
reason: NoWarnings
|
||||
status: "True"
|
||||
type: NoWarnings
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Finish reconciling
|
||||
reason: Success
|
||||
status: "True"
|
||||
type: ReconcileSuccess
|
||||
23
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml
vendored
Normal file
23
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_no_status.yaml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
43
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml
vendored
Normal file
43
resource_customizations/rabbitmq.com/RabbitmqCluster/testdata/progressing_pods_not_ready.yaml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
apiVersion: rabbitmq.com/v1beta1
|
||||
kind: RabbitmqCluster
|
||||
metadata:
|
||||
labels:
|
||||
app: example-rabbitmq
|
||||
name: example-rabbitmq
|
||||
namespace: example
|
||||
spec:
|
||||
image: docker.io/bitnami/rabbitmq:3.10.7-debian-11-r8
|
||||
persistence:
|
||||
storage: 32Gi
|
||||
storageClassName: default
|
||||
rabbitmq:
|
||||
replicas: 3
|
||||
resources:
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1792Mi
|
||||
service:
|
||||
type: ClusterIP
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2023-08-30T07:44:34Z"
|
||||
reason: NotAllPodsReady
|
||||
message: 1/3 Pods ready
|
||||
status: "False"
|
||||
type: AllReplicasReady
|
||||
- lastTransitionTime: "2023-08-30T07:37:06Z"
|
||||
reason: AtLeastOneEndpointAvailable
|
||||
status: "True"
|
||||
type: ClusterAvailable
|
||||
- lastTransitionTime: "2023-08-30T07:33:06Z"
|
||||
reason: NoWarnings
|
||||
status: "True"
|
||||
type: NoWarnings
|
||||
- lastTransitionTime: "2023-08-30T07:44:39Z"
|
||||
message: Finish reconciling
|
||||
reason: Success
|
||||
status: "True"
|
||||
type: ReconcileSuccess
|
||||
Loading…
Reference in a new issue