Skip to content

Commit 0679215

Browse files
authored
fix: #24781 update crossplane healthchecks to V2 version (#24782)
Signed-off-by: Jonasz Łasut-Balcerzak <[email protected]>
1 parent d5d7e8f commit 0679215

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

resource_customizations/_.crossplane.io/_/health.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Health check copied from here: https://github.com/crossplane/docs/blob/bd701357e9d5eecf529a0b42f23a78850a6d1d87/content/master/guides/crossplane-with-argo-cd.md
1+
-- Health check copied from here: https://github.com/crossplane/docs/blob/709889c5dbe6e5a2ea3dffd66fe276cf465b47b5/content/master/guides/crossplane-with-argo-cd.md
22

33
health_status = {
44
status = "Progressing",
@@ -18,9 +18,10 @@ local has_no_status = {
1818
"Composition",
1919
"CompositionRevision",
2020
"DeploymentRuntimeConfig",
21-
"ControllerConfig",
21+
"ClusterProviderConfig",
2222
"ProviderConfig",
23-
"ProviderConfigUsage"
23+
"ProviderConfigUsage",
24+
"ControllerConfig" -- Added to ensure that healthcheck is backwards-compatible with Crossplane v1
2425
}
2526
if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.kind) then
2627
health_status.status = "Healthy"
@@ -29,7 +30,7 @@ if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.
2930
end
3031

3132
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then
32-
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then
33+
if (obj.kind == "ProviderConfig" or obj.kind == "ClusterProviderConfig") and obj.status.users ~= nil then
3334
health_status.status = "Healthy"
3435
health_status.message = "Resource is in use."
3536
return health_status
@@ -54,7 +55,7 @@ for i, condition in ipairs(obj.status.conditions) do
5455
end
5556
end
5657

57-
if contains({"Ready", "Healthy", "Offered", "Established"}, condition.type) then
58+
if contains({"Ready", "Healthy", "Offered", "Established", "ValidPipeline", "RevisionHealthy"}, condition.type) then
5859
if condition.status == "True" then
5960
health_status.status = "Healthy"
6061
health_status.message = "Resource is up-to-date."

resource_customizations/_.crossplane.io/_/health_test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ tests:
33
status: Healthy
44
message: "Resource is up-to-date."
55
inputPath: testdata/composition_healthy.yaml
6+
- healthStatus:
7+
status: Healthy
8+
message: "Resource is up-to-date."
9+
inputPath: testdata/configurationrevision_healthy.yaml
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: pkg.crossplane.io/v1
2+
kind: ConfigurationRevision
3+
metadata:
4+
annotations:
5+
meta.crossplane.io/license: Apache-2.0
6+
meta.crossplane.io/maintainer: Upbound <[email protected]>
7+
meta.crossplane.io/source: github.com/upbound/configuration-getting-started
8+
name: upbound-configuration-getting-started-869bca254eb1
9+
spec:
10+
desiredState: Active
11+
ignoreCrossplaneConstraints: false
12+
image: xpkg.upbound.io/upbound/configuration-getting-started:v0.3.0
13+
packagePullPolicy: IfNotPresent
14+
revision: 1
15+
skipDependencyResolution: false
16+
status:
17+
conditions:
18+
- lastTransitionTime: "2025-09-29T18:06:40Z"
19+
observedGeneration: 1
20+
reason: HealthyPackageRevision
21+
status: "True"
22+
type: RevisionHealthy

resource_customizations/_.upbound.io/_/health.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- Health check copied from here: https://github.com/crossplane/docs/blob/bd701357e9d5eecf529a0b42f23a78850a6d1d87/content/master/guides/crossplane-with-argo-cd.md
1+
-- Health check copied from here: https://github.com/crossplane/docs/blob/709889c5dbe6e5a2ea3dffd66fe276cf465b47b5/content/master/guides/crossplane-with-argo-cd.md
22

33
health_status = {
44
status = "Progressing",
@@ -15,6 +15,7 @@ local function contains (table, val)
1515
end
1616

1717
local has_no_status = {
18+
"ClusterProviderConfig",
1819
"ProviderConfig",
1920
"ProviderConfigUsage"
2021
}
@@ -26,7 +27,7 @@ if obj.status == nil or next(obj.status) == nil and contains(has_no_status, obj.
2627
end
2728

2829
if obj.status == nil or next(obj.status) == nil or obj.status.conditions == nil then
29-
if obj.kind == "ProviderConfig" and obj.status.users ~= nil then
30+
if (obj.kind == "ProviderConfig" or obj.kind == "ClusterProviderConfig") and obj.status.users ~= nil then
3031
health_status.status = "Healthy"
3132
health_status.message = "Resource is in use."
3233
return health_status

0 commit comments

Comments
 (0)