mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
feat: Add health checks for Crossplane providers (#4778)
Signed-off-by: Simon Rüegg <simon@rueggs.ch>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
installed = false
|
||||
healthy = false
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.type == "Installed" then
|
||||
installed = condition.status == "True"
|
||||
installed_message = condition.reason
|
||||
elseif condition.type == "Healthy" then
|
||||
healthy = condition.status == "True"
|
||||
healthy_message = condition.reason
|
||||
end
|
||||
end
|
||||
if installed and healthy then
|
||||
hs.status = "Healthy"
|
||||
else
|
||||
hs.status = "Degraded"
|
||||
end
|
||||
hs.message = installed_message .. " " .. healthy_message
|
||||
return hs
|
||||
end
|
||||
end
|
||||
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for provider to be installed"
|
||||
return hs
|
||||
@@ -0,0 +1,17 @@
|
||||
tests:
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: Waiting for provider to be installed
|
||||
inputPath: testdata/progressing_noStatus.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: ActivePackageRevision UnhealthyPackageRevision
|
||||
inputPath: testdata/degraded_installed.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: UnpackingPackage HealthyPackageRevision
|
||||
inputPath: testdata/degraded_healthy.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
message: ActivePackageRevision HealthyPackageRevision
|
||||
inputPath: testdata/healthy.yaml
|
||||
23
resource_customizations/pkg.crossplane.io/Provider/testdata/degraded_healthy.yaml
vendored
Normal file
23
resource_customizations/pkg.crossplane.io/Provider/testdata/degraded_healthy.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: pkg.crossplane.io/v1alpha1
|
||||
kind: Provider
|
||||
metadata:
|
||||
creationTimestamp: "2020-10-28T15:25:56Z"
|
||||
generation: 2
|
||||
name: provider-helm
|
||||
resourceVersion: "1664592"
|
||||
selfLink: /apis/pkg.crossplane.io/v1alpha1/providers/provider-helm
|
||||
uid: 6ce16954-64f1-48c5-8a80-e29af37fc736
|
||||
spec:
|
||||
package: crossplane/provider-helm:v0.3.5error
|
||||
revisionActivationPolicy: Automatic
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2020-11-06T12:37:16Z"
|
||||
reason: UnpackingPackage
|
||||
status: "False"
|
||||
type: Installed
|
||||
- lastTransitionTime: "2020-11-06T10:19:07Z"
|
||||
reason: HealthyPackageRevision
|
||||
status: "True"
|
||||
type: Healthy
|
||||
currentRevision: provider-helm-7f275162c62e
|
||||
23
resource_customizations/pkg.crossplane.io/Provider/testdata/degraded_installed.yaml
vendored
Normal file
23
resource_customizations/pkg.crossplane.io/Provider/testdata/degraded_installed.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: pkg.crossplane.io/v1alpha1
|
||||
kind: Provider
|
||||
metadata:
|
||||
creationTimestamp: "2020-10-28T15:25:56Z"
|
||||
generation: 4
|
||||
name: provider-helm
|
||||
resourceVersion: "1666009"
|
||||
selfLink: /apis/pkg.crossplane.io/v1alpha1/providers/provider-helm
|
||||
uid: 6ce16954-64f1-48c5-8a80-e29af37fc736
|
||||
spec:
|
||||
package: crossplane/provider-helm:v0.3.6
|
||||
revisionActivationPolicy: Automatic
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2020-11-06T12:44:22Z"
|
||||
reason: ActivePackageRevision
|
||||
status: "True"
|
||||
type: Installed
|
||||
- lastTransitionTime: "2020-11-06T12:44:21Z"
|
||||
reason: UnhealthyPackageRevision
|
||||
status: "False"
|
||||
type: Healthy
|
||||
currentRevision: provider-helm-61a254740524
|
||||
23
resource_customizations/pkg.crossplane.io/Provider/testdata/healthy.yaml
vendored
Normal file
23
resource_customizations/pkg.crossplane.io/Provider/testdata/healthy.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: pkg.crossplane.io/v1alpha1
|
||||
kind: Provider
|
||||
metadata:
|
||||
creationTimestamp: "2020-10-28T15:25:56Z"
|
||||
generation: 4
|
||||
name: provider-helm
|
||||
resourceVersion: "1666154"
|
||||
selfLink: /apis/pkg.crossplane.io/v1alpha1/providers/provider-helm
|
||||
uid: 6ce16954-64f1-48c5-8a80-e29af37fc736
|
||||
spec:
|
||||
package: crossplane/provider-helm:v0.3.6
|
||||
revisionActivationPolicy: Automatic
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2020-11-06T12:44:28Z"
|
||||
reason: ActivePackageRevision
|
||||
status: "True"
|
||||
type: Installed
|
||||
- lastTransitionTime: "2020-11-06T12:44:26Z"
|
||||
reason: HealthyPackageRevision
|
||||
status: "True"
|
||||
type: Healthy
|
||||
currentRevision: provider-helm-61a254740524
|
||||
12
resource_customizations/pkg.crossplane.io/Provider/testdata/progressing_noStatus.yaml
vendored
Normal file
12
resource_customizations/pkg.crossplane.io/Provider/testdata/progressing_noStatus.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: pkg.crossplane.io/v1alpha1
|
||||
kind: Provider
|
||||
metadata:
|
||||
creationTimestamp: "2020-10-28T15:25:56Z"
|
||||
generation: 4
|
||||
name: provider-helm
|
||||
resourceVersion: "1666154"
|
||||
selfLink: /apis/pkg.crossplane.io/v1alpha1/providers/provider-helm
|
||||
uid: 6ce16954-64f1-48c5-8a80-e29af37fc736
|
||||
spec:
|
||||
package: crossplane/provider-helm:v0.3.6
|
||||
revisionActivationPolicy: Automatic
|
||||
Reference in New Issue
Block a user