Skip to content

Commit a038f80

Browse files
jensensclaude
andcommitted
feat: ArgoCD health check for VinylCache via Helm chart (#22)
When argocd.resourceCustomizations.enabled=true, the chart deploys a ConfigMap in the ArgoCD namespace with a custom Lua health check for VinylCache resources. ArgoCD discovers it via the app.kubernetes.io/part-of: argocd label. Health states: - Ready=True → Healthy - Ready=False → Degraded - No Ready condition → Progressing Includes Helm unit tests for all scenarios. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e0ef05d commit a038f80

5 files changed

Lines changed: 550 additions & 1 deletion

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- if .Values.argocd.resourceCustomizations.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "cloud-vinyl.fullname" . }}-argocd-health
6+
namespace: {{ .Values.argocd.namespace | default "argocd" }}
7+
labels:
8+
app.kubernetes.io/part-of: argocd
9+
{{- include "cloud-vinyl.labels" . | nindent 4 }}
10+
data:
11+
resource.customizations.health.vinyl.bluedynamics.eu_VinylCache: |
12+
hs = {}
13+
if obj.status ~= nil and obj.status.conditions ~= nil then
14+
for _, c in ipairs(obj.status.conditions) do
15+
if c.type == "Ready" and c.status == "True" then
16+
hs.status = "Healthy"
17+
hs.message = c.message
18+
return hs
19+
end
20+
if c.type == "Ready" and c.status == "False" then
21+
hs.status = "Degraded"
22+
hs.message = c.message
23+
return hs
24+
end
25+
end
26+
end
27+
hs.status = "Progressing"
28+
hs.message = "Waiting for VinylCache to become ready"
29+
return hs
30+
{{- end }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
suite: ArgoCD Health Check Tests
2+
templates:
3+
- argocd-health.yaml
4+
tests:
5+
- it: should not render when argocd.resourceCustomizations.enabled is false
6+
set:
7+
argocd:
8+
resourceCustomizations:
9+
enabled: false
10+
asserts:
11+
- hasDocuments:
12+
count: 0
13+
14+
- it: should render ConfigMap when argocd.resourceCustomizations.enabled is true
15+
set:
16+
argocd:
17+
resourceCustomizations:
18+
enabled: true
19+
namespace: argocd
20+
asserts:
21+
- isKind:
22+
of: ConfigMap
23+
- equal:
24+
path: metadata.namespace
25+
value: argocd
26+
- isSubset:
27+
path: metadata.labels
28+
content:
29+
app.kubernetes.io/part-of: argocd
30+
31+
- it: should contain VinylCache health check Lua script
32+
set:
33+
argocd:
34+
resourceCustomizations:
35+
enabled: true
36+
asserts:
37+
- exists:
38+
path: data["resource.customizations.health.vinyl.bluedynamics.eu_VinylCache"]
39+
40+
- it: should use custom namespace when set
41+
set:
42+
argocd:
43+
resourceCustomizations:
44+
enabled: true
45+
namespace: custom-argocd
46+
asserts:
47+
- equal:
48+
path: metadata.namespace
49+
value: custom-argocd

charts/cloud-vinyl/values.schema.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@
145145
},
146146
"affinity": {"type": "object"},
147147
"podSecurityContext": {"type": "object"},
148-
"securityContext": {"type": "object"}
148+
"securityContext": {"type": "object"},
149+
"argocd": {
150+
"type": "object",
151+
"additionalProperties": false,
152+
"properties": {
153+
"resourceCustomizations": {
154+
"type": "object",
155+
"additionalProperties": false,
156+
"properties": {
157+
"enabled": {"type": "boolean"}
158+
}
159+
},
160+
"namespace": {"type": "string"}
161+
}
162+
}
149163
}
150164
}

charts/cloud-vinyl/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,12 @@ securityContext:
9595
capabilities:
9696
drop:
9797
- ALL
98+
99+
# ArgoCD integration.
100+
argocd:
101+
resourceCustomizations:
102+
# Deploy a ConfigMap with a custom health check for VinylCache resources.
103+
# ArgoCD picks this up automatically via the app.kubernetes.io/part-of: argocd label.
104+
enabled: false
105+
# Namespace where ArgoCD is installed.
106+
namespace: argocd

0 commit comments

Comments
 (0)