fix(appset): do not remove progressive sync conditions (#23506)

Signed-off-by: Alexandre Gaudreault <alexandre_gaudreault@intuit.com>
This commit is contained in:
Alexandre Gaudreault
2025-07-01 11:28:06 -04:00
committed by GitHub
parent a6a78ef8d6
commit 6ec1aa1b84
10 changed files with 729 additions and 277 deletions

View File

@@ -8,6 +8,22 @@ if obj.status ~= nil then
hs.message = condition.message
return hs
end
end
for i, condition in pairs(obj.status.conditions) do
if condition.type == "ResourcesUpToDate" and condition.status == "False" then
hs.status = "Degraded"
hs.message = condition.message
return hs
end
end
for i, condition in pairs(obj.status.conditions) do
if condition.type == "RolloutProgressing" and condition.status == "True" then
hs.status = "Progressing"
hs.message = condition.message
return hs
end
end
for i, condition in pairs(obj.status.conditions) do
if condition.type == "ResourcesUpToDate" and condition.status == "True" then
hs.status = "Healthy"
hs.message = condition.message

View File

@@ -1,13 +1,21 @@
tests:
- healthStatus:
status: Healthy
message: "ApplicationSet up to date"
message: ApplicationSet up to date
inputPath: testdata/healthyApplicationSet.yaml
- healthStatus:
status: Degraded
message: "found less than two generators, Merge requires two or more"
message: found less than two generators, Merge requires two or more
inputPath: testdata/errorApplicationSetWithStatusMessage.yaml
- healthStatus:
status: Progressing
message: "Waiting for the status to be reported"
message: Waiting for the status to be reported
inputPath: testdata/noStatusApplicationSet.yaml
- healthStatus:
status: Degraded
message: could not create application
inputPath: testdata/resourceNotUpdatedApplicationSet.yaml
- healthStatus:
status: Progressing
message: ApplicationSet is performing rollout of step 1
inputPath: testdata/progressiveSyncApplicationSet.yaml

View File

@@ -0,0 +1,58 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-git
namespace: argocd
spec:
generators:
- merge:
generators: []
mergeKeys:
- server
strategy:
rollingSync:
steps:
- matchExpressions:
- key: env
operator: In
values:
- dev
- matchExpressions:
- key: env
operator: In
values:
- prod
template:
metadata:
name: '{{name}}'
spec:
destination:
namespace: default
server: '{{server}}'
project: default
source:
path: helm-guestbook
repoURL: https://github.com/argoproj/argocd-example-apps/
targetRevision: HEAD
status:
conditions:
- lastTransitionTime: '2025-05-30T15:41:02Z'
message: All applications have been generated successfully
reason: ApplicationSetUpToDate
status: 'False'
type: ErrorOccurred
- lastTransitionTime: '2025-05-27T18:45:48Z'
message: Successfully generated parameters for all Applications
reason: ParametersGenerated
status: 'True'
type: ParametersGenerated
- lastTransitionTime: '2025-05-30T15:41:02Z'
message: All applications have been generated successfully
reason: ApplicationSetUpToDate
status: 'True'
type: ResourcesUpToDate
- lastTransitionTime: '2025-05-30T15:44:06Z'
message: ApplicationSet is performing rollout of step 1
reason: ApplicationSetModified
status: 'True'
type: RolloutProgressing

View File

@@ -0,0 +1,40 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-git
namespace: argocd
spec:
generators:
- merge:
generators: []
mergeKeys:
- server
template:
metadata:
name: '{{name}}'
spec:
destination:
namespace: default
server: '{{server}}'
project: default
source:
path: helm-guestbook
repoURL: https://github.com/argoproj/argocd-example-apps/
targetRevision: HEAD
status:
conditions:
- lastTransitionTime: '2025-05-30T15:41:02Z'
message: All applications have been generated successfully
reason: ApplicationSetUpToDate
status: 'False'
type: ErrorOccurred
- lastTransitionTime: '2025-05-27T18:45:48Z'
message: Successfully generated parameters for all Applications
reason: ParametersGenerated
status: 'True'
type: ParametersGenerated
- lastTransitionTime: '2025-05-30T15:41:02Z'
message: 'could not create application'
reason: CreateApplicationError
status: 'False'
type: ResourcesUpToDate