Skip to content

Commit b9d10b0

Browse files
committed
health
Signed-off-by: Alexandre Gaudreault <[email protected]>
1 parent e5182cc commit b9d10b0

File tree

4 files changed

+119
-3
lines changed

4 files changed

+119
-3
lines changed

resource_customizations/argoproj.io/ApplicationSet/health.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ if obj.status ~= nil then
88
hs.message = condition.message
99
return hs
1010
end
11+
if condition.type == "ResourcesUpToDate" and condition.status == "False" then
12+
hs.status = "Progressing"
13+
hs.message = condition.message
14+
return hs
15+
end
16+
if condition.type == "RolloutProgressing" and condition.status == "True" then
17+
hs.status = "Progressing"
18+
hs.message = condition.message
19+
return hs
20+
end
1121
if condition.type == "ResourcesUpToDate" and condition.status == "True" then
1222
hs.status = "Healthy"
1323
hs.message = condition.message
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
tests:
22
- healthStatus:
33
status: Healthy
4-
message: "ApplicationSet up to date"
4+
message: ApplicationSet up to date
55
inputPath: testdata/healthyApplicationSet.yaml
66
- healthStatus:
77
status: Degraded
8-
message: "found less than two generators, Merge requires two or more"
8+
message: found less than two generators, Merge requires two or more
99
inputPath: testdata/errorApplicationSetWithStatusMessage.yaml
1010
- healthStatus:
1111
status: Progressing
12-
message: "Waiting for the status to be reported"
12+
message: Waiting for the status to be reported
1313
inputPath: testdata/noStatusApplicationSet.yaml
14+
- healthStatus:
15+
status: Progressing
16+
message: could not create application
17+
inputPath: testdata/failedCreateApplicationSet.yaml
18+
- healthStatus:
19+
status: Progressing
20+
message: ApplicationSet is performing rollout of step 1
21+
inputPath: testdata/progressiveSyncApplicationSet.yaml
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: cluster-git
5+
namespace: argocd
6+
spec:
7+
generators:
8+
- merge:
9+
generators: []
10+
mergeKeys:
11+
- server
12+
template:
13+
metadata:
14+
name: '{{name}}'
15+
spec:
16+
destination:
17+
namespace: default
18+
server: '{{server}}'
19+
project: default
20+
source:
21+
path: helm-guestbook
22+
repoURL: https://github.com/argoproj/argocd-example-apps/
23+
targetRevision: HEAD
24+
status:
25+
conditions:
26+
- lastTransitionTime: '2025-05-30T15:41:02Z'
27+
message: All applications have been generated successfully
28+
reason: ApplicationSetUpToDate
29+
status: 'False'
30+
type: ErrorOccurred
31+
- lastTransitionTime: '2025-05-27T18:45:48Z'
32+
message: Successfully generated parameters for all Applications
33+
reason: ParametersGenerated
34+
status: 'True'
35+
type: ParametersGenerated
36+
- lastTransitionTime: '2025-05-30T15:41:02Z'
37+
message: 'could not create application'
38+
reason: CreateApplicationError
39+
status: 'False'
40+
type: ResourcesUpToDate
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ApplicationSet
3+
metadata:
4+
name: cluster-git
5+
namespace: argocd
6+
spec:
7+
generators:
8+
- merge:
9+
generators: []
10+
mergeKeys:
11+
- server
12+
strategy:
13+
rollingSync:
14+
steps:
15+
- matchExpressions:
16+
- key: env
17+
operator: In
18+
values:
19+
- dev
20+
- matchExpressions:
21+
- key: env
22+
operator: In
23+
values:
24+
- prod
25+
template:
26+
metadata:
27+
name: '{{name}}'
28+
spec:
29+
destination:
30+
namespace: default
31+
server: '{{server}}'
32+
project: default
33+
source:
34+
path: helm-guestbook
35+
repoURL: https://github.com/argoproj/argocd-example-apps/
36+
targetRevision: HEAD
37+
status:
38+
conditions:
39+
- lastTransitionTime: '2025-05-30T15:41:02Z'
40+
message: All applications have been generated successfully
41+
reason: ApplicationSetUpToDate
42+
status: 'False'
43+
type: ErrorOccurred
44+
- lastTransitionTime: '2025-05-27T18:45:48Z'
45+
message: Successfully generated parameters for all Applications
46+
reason: ParametersGenerated
47+
status: 'True'
48+
type: ParametersGenerated
49+
- lastTransitionTime: '2025-05-30T15:41:02Z'
50+
message: All applications have been generated successfully
51+
reason: ApplicationSetUpToDate
52+
status: 'True'
53+
type: ResourcesUpToDate
54+
- lastTransitionTime: '2025-05-30T15:44:06Z'
55+
message: ApplicationSet is performing rollout of step 1
56+
reason: ApplicationSetModified
57+
status: 'True'
58+
type: RolloutProgressing

0 commit comments

Comments
 (0)