Skip to content

Commit e7e4f16

Browse files
committed
add resource count and argocd-cmd-param-cm changes
Signed-off-by: Alexander Matyushentsev <[email protected]>
1 parent 99fed87 commit e7e4f16

17 files changed

+879
-777
lines changed

applicationset/controllers/applicationset_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,11 +1435,13 @@ func (r *ApplicationSetReconciler) updateResourcesStatus(ctx context.Context, lo
14351435
sort.Slice(statuses, func(i, j int) bool {
14361436
return statuses[i].Name < statuses[j].Name
14371437
})
1438+
resourcesCount := len(statuses)
14381439
if r.MaxResourcesStatusCount > 0 && len(statuses) > r.MaxResourcesStatusCount {
14391440
logCtx.Warnf("Truncating ApplicationSet %s resource status from %d to max allowed %d entries", appset.Name, len(statuses), r.MaxResourcesStatusCount)
14401441
statuses = statuses[:r.MaxResourcesStatusCount]
14411442
}
14421443
appset.Status.Resources = statuses
1444+
appset.Status.ResourcesCount = resourcesCount
14431445
// DefaultRetry will retry 5 times with a backoff factor of 1, jitter of 0.1 and a duration of 10ms
14441446
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
14451447
namespacedName := types.NamespacedName{Namespace: appset.Namespace, Name: appset.Name}
@@ -1452,6 +1454,7 @@ func (r *ApplicationSetReconciler) updateResourcesStatus(ctx context.Context, lo
14521454
}
14531455

14541456
updatedAppset.Status.Resources = appset.Status.Resources
1457+
updatedAppset.Status.ResourcesCount = resourcesCount
14551458

14561459
// Update the newly fetched object with new status resources
14571460
err := r.Client.Status().Update(ctx, updatedAppset)

assets/swagger.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/operator-manual/argocd-cmd-params-cm.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ data:
292292
applicationsetcontroller.global.preserved.labels: "acme.com/label1,acme.com/label2"
293293
# Enable GitHub API metrics for generators that use GitHub API
294294
applicationsetcontroller.enable.github.api.metrics: "false"
295+
# The maximum number of resources stored in the status of an ApplicationSet. This is a safeguard to prevent the status from growing too large.
296+
applicationsetcontroller.status.max.resources.count: "5000"
295297

296298
## Argo CD Notifications Controller Properties
297299
# Set the logging level. One of: debug|info|warn|error (default "info")

manifests/base/applicationset-controller/argocd-applicationset-controller-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ spec:
187187
name: argocd-cmd-params-cm
188188
key: applicationsetcontroller.requeue.after
189189
optional: true
190+
- name: ARGOCD_APPLICATIONSET_CONTROLLER_MAX_RESOURCES_STATUS_COUNT
191+
valueFrom:
192+
configMapKeyRef:
193+
name: argocd-cmd-params-cm
194+
key: applicationsetcontroller.status.max.resources.count
195+
optional: true
190196
volumeMounts:
191197
- mountPath: /app/config/ssh
192198
name: ssh-known-hosts

manifests/core-install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/core-install.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/install.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/namespace-install-with-hydrator.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifests/ha/namespace-install.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)