This commit is contained in:
Phillip Jie 2026-04-20 22:55:28 -07:00 committed by GitHub
commit e59d6052bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,28 @@
local hs = {}
if obj.status ~= nil and obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
if condition.type == "ACK.Terminal" and condition.status == "True" then
hs.status = "Degraded"
hs.message = condition.message
return hs
end
if condition.type == "Ready" then
if condition.status == "False" then
hs.status = "Progressing"
hs.message = condition.message
return hs
elseif condition.status == "True" then
hs.status = "Healthy"
hs.message = ""
return hs
end
end
end
end
hs.status = "Progressing"
hs.message = "Waiting for resource to be ready"
return hs

View file

@ -0,0 +1,17 @@
tests:
- healthStatus:
status: Healthy
message: ""
inputPath: testdata/healthy.yaml
- healthStatus:
status: Progressing
message: bucket in CREATING state
inputPath: testdata/progressing.yaml
- healthStatus:
status: Progressing
message: Waiting for resource to be ready
inputPath: testdata/progressing_no_conditions.yaml
- healthStatus:
status: Degraded
message: Resource already exists
inputPath: testdata/degraded.yaml

View file

@ -0,0 +1,28 @@
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: test-s3-bucket
namespace: default
spec:
name: test-s3-bucket
status:
ackResourceMetadata:
arn: arn:aws:s3:::test-s3-bucket
ownerAccountID: "111111111111"
region: us-west-2
conditions:
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: Resource already exists
reason: This resource already exists but is not managed by ACK.
status: "True"
type: ACK.Terminal
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: Resource not synced
reason: resource is in terminal condition
status: "False"
type: ACK.ResourceSynced
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: Resource already exists
reason: ACK.Terminal
status: "False"
type: Ready

View file

@ -0,0 +1,24 @@
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: test-s3-bucket
namespace: default
spec:
name: test-s3-bucket
status:
ackResourceMetadata:
arn: arn:aws:s3:::test-s3-bucket
ownerAccountID: "111111111111"
region: us-west-2
conditions:
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: Resource synced successfully
reason: ""
status: "True"
type: ACK.ResourceSynced
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: Resource synced successfully
reason: ""
status: "True"
type: Ready
location: http://test-s3-bucket.s3.amazonaws.com/

View file

@ -0,0 +1,23 @@
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: test-s3-bucket
namespace: default
spec:
name: test-s3-bucket
status:
ackResourceMetadata:
arn: arn:aws:s3:::test-s3-bucket
ownerAccountID: "111111111111"
region: us-west-2
conditions:
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: bucket in CREATING state
reason: bucket in CREATING state
status: "False"
type: ACK.ResourceSynced
- lastTransitionTime: "2026-04-15T18:20:17Z"
message: bucket in CREATING state
reason: bucket in CREATING state
status: "False"
type: Ready

View file

@ -0,0 +1,12 @@
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: test-s3-bucket
namespace: default
spec:
name: test-s3-bucket
status:
ackResourceMetadata:
arn: arn:aws:s3:::test-s3-bucket
ownerAccountID: "111111111111"
region: us-west-2

View file

@ -1078,6 +1078,7 @@ func Test_getHealthScriptPaths(t *testing.T) {
assert.Equal(t, []string{
"_.cnrm.cloud.google.com/_",
"_.crossplane.io/_",
"_.services.k8s.aws/_",
"_.upbound.io/_",
"grafana-org-operator.kubitus-project.gitlab.io/_",
}, paths)