mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
feat: health check for OnePasswordItem (#10690)
Signed-off-by: Chris Hoffman <cehoffman@gmail.com> Signed-off-by: Chris Hoffman <cehoffman@gmail.com>
This commit is contained in:
parent
4f043cc2eb
commit
0e068f5bcc
5 changed files with 65 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
hs = {}
|
||||
if obj.status ~= nil then
|
||||
if obj.status.conditions ~= nil then
|
||||
for i, condition in ipairs(obj.status.conditions) do
|
||||
if condition.type == "Ready" and condition.status == "True" then
|
||||
hs.status = "Healthy"
|
||||
hs.message = condition.message
|
||||
return hs
|
||||
end
|
||||
if condition.type == "Ready" and condition.status == "False" then
|
||||
hs.status = "Degraded"
|
||||
hs.message = condition.message
|
||||
return hs
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hs.status = "Progressing"
|
||||
hs.message = "Waiting for controller to report status"
|
||||
return hs
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
tests:
|
||||
- healthStatus:
|
||||
status: Progressing
|
||||
message: Waiting for controller to report status
|
||||
inputPath: testdata/new.yaml
|
||||
- healthStatus:
|
||||
status: Degraded
|
||||
message: Error
|
||||
inputPath: testdata/degraded.yaml
|
||||
- healthStatus:
|
||||
status: Healthy
|
||||
inputPath: testdata/healthy.yaml
|
||||
13
resource_customizations/onepassword.com/OnePasswordItem/testdata/degraded.yaml
vendored
Normal file
13
resource_customizations/onepassword.com/OnePasswordItem/testdata/degraded.yaml
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
apiVersion: onepassword.com/v1
|
||||
kind: OnePasswordItem
|
||||
metadata:
|
||||
name: degraded-item
|
||||
namespace: test-namespace
|
||||
spec:
|
||||
itemPath: vaults/Test Vault/items/Test Item
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2022-09-24T01:11:54Z'
|
||||
message: Error
|
||||
status: 'False'
|
||||
type: Ready
|
||||
12
resource_customizations/onepassword.com/OnePasswordItem/testdata/healthy.yaml
vendored
Normal file
12
resource_customizations/onepassword.com/OnePasswordItem/testdata/healthy.yaml
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
apiVersion: onepassword.com/v1
|
||||
kind: OnePasswordItem
|
||||
metadata:
|
||||
name: healthy-item
|
||||
namespace: test-namespace
|
||||
spec:
|
||||
itemPath: vaults/Test Vault/items/Test Item
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: '2022-09-24T01:11:54Z'
|
||||
status: 'True'
|
||||
type: Ready
|
||||
7
resource_customizations/onepassword.com/OnePasswordItem/testdata/new.yaml
vendored
Normal file
7
resource_customizations/onepassword.com/OnePasswordItem/testdata/new.yaml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: onepassword.com/v1
|
||||
kind: OnePasswordItem
|
||||
metadata:
|
||||
name: new-item
|
||||
namespace: test-namespace
|
||||
spec:
|
||||
itemPath: vaults/Test Vault/items/Test Item
|
||||
Loading…
Reference in a new issue