Skip to content

Commit 90602fc

Browse files
authored
Merge pull request #298 from hybrid-cloud-patterns/argocd-pvc-healthcheck
Added health check for pvc resource in argocd.yaml
2 parents eaf2619 + fd004fb commit 90602fc

File tree

6 files changed

+132
-0
lines changed

6 files changed

+132
-0
lines changed

clustergroup/templates/plumbing/argocd.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ metadata:
1212
annotations:
1313
argocd.argoproj.io/compare-options: IgnoreExtraneous
1414
spec:
15+
# Adding health checks to argocd to prevent pvc resources
16+
# that aren't bound state from blocking deployments
17+
resourceCustomizations: |
18+
PersistentVolumeClaim:
19+
health.lua: |
20+
hs = {}
21+
if obj.status ~= nil then
22+
if obj.status.phase ~= nil then
23+
if obj.status.phase == "Pending" then
24+
hs.status = "Healthy"
25+
hs.message = obj.status.phase
26+
return hs
27+
elseif obj.status.phase == "Bound" then
28+
hs.status = "Healthy"
29+
hs.message = obj.status.phase
30+
return hs
31+
end
32+
end
33+
end
34+
hs.status = "Progressing"
35+
hs.message = "Waiting for PVC"
36+
return hs
1537
applicationInstanceLabelKey: argocd.argoproj.io/instance
1638
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
1739
# we can support helmChart with kustomize

tests/clustergroup-industrial-edge-factory.expected.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,28 @@ metadata:
443443
annotations:
444444
argocd.argoproj.io/compare-options: IgnoreExtraneous
445445
spec:
446+
# Adding health checks to argocd to prevent pvc resources
447+
# that aren't bound state from blocking deployments
448+
resourceCustomizations: |
449+
PersistentVolumeClaim:
450+
health.lua: |
451+
hs = {}
452+
if obj.status ~= nil then
453+
if obj.status.phase ~= nil then
454+
if obj.status.phase == "Pending" then
455+
hs.status = "Healthy"
456+
hs.message = obj.status.phase
457+
return hs
458+
elseif obj.status.phase == "Bound" then
459+
hs.status = "Healthy"
460+
hs.message = obj.status.phase
461+
return hs
462+
end
463+
end
464+
end
465+
hs.status = "Progressing"
466+
hs.message = "Waiting for PVC"
467+
return hs
446468
applicationInstanceLabelKey: argocd.argoproj.io/instance
447469
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
448470
# we can support helmChart with kustomize

tests/clustergroup-industrial-edge-hub.expected.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,28 @@ metadata:
10761076
annotations:
10771077
argocd.argoproj.io/compare-options: IgnoreExtraneous
10781078
spec:
1079+
# Adding health checks to argocd to prevent pvc resources
1080+
# that aren't bound state from blocking deployments
1081+
resourceCustomizations: |
1082+
PersistentVolumeClaim:
1083+
health.lua: |
1084+
hs = {}
1085+
if obj.status ~= nil then
1086+
if obj.status.phase ~= nil then
1087+
if obj.status.phase == "Pending" then
1088+
hs.status = "Healthy"
1089+
hs.message = obj.status.phase
1090+
return hs
1091+
elseif obj.status.phase == "Bound" then
1092+
hs.status = "Healthy"
1093+
hs.message = obj.status.phase
1094+
return hs
1095+
end
1096+
end
1097+
end
1098+
hs.status = "Progressing"
1099+
hs.message = "Waiting for PVC"
1100+
return hs
10791101
applicationInstanceLabelKey: argocd.argoproj.io/instance
10801102
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
10811103
# we can support helmChart with kustomize

tests/clustergroup-medical-diagnosis-hub.expected.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,28 @@ metadata:
12521252
annotations:
12531253
argocd.argoproj.io/compare-options: IgnoreExtraneous
12541254
spec:
1255+
# Adding health checks to argocd to prevent pvc resources
1256+
# that aren't bound state from blocking deployments
1257+
resourceCustomizations: |
1258+
PersistentVolumeClaim:
1259+
health.lua: |
1260+
hs = {}
1261+
if obj.status ~= nil then
1262+
if obj.status.phase ~= nil then
1263+
if obj.status.phase == "Pending" then
1264+
hs.status = "Healthy"
1265+
hs.message = obj.status.phase
1266+
return hs
1267+
elseif obj.status.phase == "Bound" then
1268+
hs.status = "Healthy"
1269+
hs.message = obj.status.phase
1270+
return hs
1271+
end
1272+
end
1273+
end
1274+
hs.status = "Progressing"
1275+
hs.message = "Waiting for PVC"
1276+
return hs
12551277
applicationInstanceLabelKey: argocd.argoproj.io/instance
12561278
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
12571279
# we can support helmChart with kustomize

tests/clustergroup-naked.expected.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,28 @@ metadata:
266266
annotations:
267267
argocd.argoproj.io/compare-options: IgnoreExtraneous
268268
spec:
269+
# Adding health checks to argocd to prevent pvc resources
270+
# that aren't bound state from blocking deployments
271+
resourceCustomizations: |
272+
PersistentVolumeClaim:
273+
health.lua: |
274+
hs = {}
275+
if obj.status ~= nil then
276+
if obj.status.phase ~= nil then
277+
if obj.status.phase == "Pending" then
278+
hs.status = "Healthy"
279+
hs.message = obj.status.phase
280+
return hs
281+
elseif obj.status.phase == "Bound" then
282+
hs.status = "Healthy"
283+
hs.message = obj.status.phase
284+
return hs
285+
end
286+
end
287+
end
288+
hs.status = "Progressing"
289+
hs.message = "Waiting for PVC"
290+
return hs
269291
applicationInstanceLabelKey: argocd.argoproj.io/instance
270292
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
271293
# we can support helmChart with kustomize

tests/clustergroup-normal.expected.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,28 @@ metadata:
841841
annotations:
842842
argocd.argoproj.io/compare-options: IgnoreExtraneous
843843
spec:
844+
# Adding health checks to argocd to prevent pvc resources
845+
# that aren't bound state from blocking deployments
846+
resourceCustomizations: |
847+
PersistentVolumeClaim:
848+
health.lua: |
849+
hs = {}
850+
if obj.status ~= nil then
851+
if obj.status.phase ~= nil then
852+
if obj.status.phase == "Pending" then
853+
hs.status = "Healthy"
854+
hs.message = obj.status.phase
855+
return hs
856+
elseif obj.status.phase == "Bound" then
857+
hs.status = "Healthy"
858+
hs.message = obj.status.phase
859+
return hs
860+
end
861+
end
862+
end
863+
hs.status = "Progressing"
864+
hs.message = "Waiting for PVC"
865+
return hs
844866
applicationInstanceLabelKey: argocd.argoproj.io/instance
845867
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
846868
# we can support helmChart with kustomize

0 commit comments

Comments
 (0)