Commit 0087deb
committed
Allow for a custom healthcheck field in the operator configmap
By populating the `gitops.customHealthChecks` in the `patterns-operator-config`
it is possible to customize the healthchecks in the argocd clusterwide
hub instance.
Tested as follows:
1. Observe stock argocd healthcheck:
```sh
oc get argocd -n vp-gitops vp-gitops -o jsonpath='{.spec.resourceHealthChecks}' | jq -r '.[].kind'
Subscription
```
2. Patch operator configmap
```sh
cat > custom-hc.yaml
- group: app
kind: Deployment
check: |
hs = {}
if obj.status ~= nil then
if obj.status.readyReplicas == obj.status.replicas then
hs.status = "Healthy"
else
hs.status = "Progressing"
end
end
return hs
- group: batch
kind: Job
check: |
hs = {}
if obj.status ~= nil and obj.status.succeeded ~= nil and obj.status.succeeded > 0 then
hs.status = "Healthy"
else
hs.status = "Progressing"
end
return hs
oc patch configmap patterns-operator-config \
-n patterns-operator \
--type merge \
-p "$(jq -n --arg v "$(cat ~/custom-hc.yaml)" '{"data":{"gitops.customHealthChecks":$v}}')"
```
3. Observe the change (no pod restarts needed):
```sh
oc get argocd -n vp-gitops vp-gitops -o jsonpath='{.spec.resourceHealthChecks}' | jq -r '.[].kind'
Subscription
Deployment
Job
```
4. Edit the configmap and remove the Job healthcheck:
```sh
oc get argocd -n vp-gitops vp-gitops -o jsonpath='{.spec.resourceHealthChecks}' | jq -r '.[].kind'
Subscription
Deployment
```1 parent 5422ed6 commit 0087deb
3 files changed
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
2244 | 2294 | | |
2245 | 2295 | | |
2246 | 2296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments