Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync option to GC old ConfigMaps & Secrets #1636

Open
jessesuen opened this issue May 22, 2019 · 10 comments
Open

Sync option to GC old ConfigMaps & Secrets #1636

jessesuen opened this issue May 22, 2019 · 10 comments
Labels
component:core Syncing, diffing, cluster state cache enhancement New feature or request more-information-needed Further information is requested type:usability Enhancement of an existing feature

Comments

@jessesuen
Copy link
Member

jessesuen commented May 22, 2019

Spawned from: #1629

It may be desirable for Argo CD to have GC controls on ConfigMaps/Secrets which are no longer referenced, to complement the feature in #1629, which ignores "extra" resources in a namespace.

One proposal is to introduce a new sync option: --prune-unreferenced-config at the API and spec level:

The CLI to enable this command might be something like:

argocd app sync --prune-unreferenced-config

For declarative app specs which desire to have this happen automatically as part of auto-sync, the spec addition would be:

spec:
  syncPolicy:
    automated:
      pruneUnreferencedConfig: true

The way pruneUnreferencedConfig would work is, when set to true:

  1. Before performing sync, iterate all live configmaps/secrets which are part of the application which are candidates for pruning (i.e. no longer defined in git)
  2. For each configmap/secret which is a pruning candidate, iterate all pods of the corresponding namespace.
  3. If any pod is referencing the configmap or secret, do not prune, otherwise proceed to perform pruning.
@jessesuen jessesuen added the enhancement New feature or request label May 22, 2019
@jessesuen jessesuen changed the title Sync option to GC old configmaps/secrets Sync option to GC old ConfigMaps & Secrets May 22, 2019
@jessesuen
Copy link
Member Author

jessesuen commented May 22, 2019

Need syntax to support all of the following cases during argocd app sync:

  1. don't prune any extra resources
  2. don't prune any extra resources except for unreferenced configs
  3. prune all extra resources except for referenced configs
  4. prune all extra resources

@jessesuen
Copy link
Member Author

Here is the proposed syntax. We would introduce a syncOptions feature to support this. The first option would be ConfigGC=true|false

  1. don't prune any extra resources

CLI:

argocd app sync

Spec:

spec:
  syncPolicy:
    automated: {}
  1. don't prune any extra resources except for unreferenced configs

CLI:

argocd app sync -o ConfigGC=true

Spec:

spec:
  syncPolicy:
    automated:
      syncOptions:
      - ConfigGC=true
  1. prune all extra resources except for referenced configs

CLI:

argocd app sync --prune -o ConfigGC=false

Spec:

spec:
  syncPolicy:
    automated:
      prune: true
      syncOptions:
      - ConfigGC=false
  1. prune all extra resources

CLI:

argocd app sync --prune

Spec:

spec:
  syncPolicy:
    automated:
      prune: true

@alexec
Copy link
Contributor

alexec commented Jun 4, 2019

Related to #1629

@stale
Copy link

stale bot commented Aug 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 13, 2019
@alexmt alexmt removed the wontfix This will not be worked on label Aug 19, 2019
@alexec
Copy link
Contributor

alexec commented Oct 2, 2019

@kplimack
Copy link

kplimack commented Jan 6, 2020

👍

@alexmt alexmt added this to the v1.5 milestone Jan 8, 2020
@alexmt alexmt modified the milestones: v1.5, v1.6 Feb 18, 2020
@jannfis jannfis added component:core Syncing, diffing, cluster state cache type:usability Enhancement of an existing feature labels May 14, 2020
@alexmt alexmt removed this from the v1.6 GitOps Engine milestone May 27, 2020
@Myafq
Copy link

Myafq commented Jun 16, 2020

Is there any workaround for such garbage collecting?

@kahirokunn
Copy link

Is there any progress?

@adrian-gierakowski
Copy link

would you accept a PR for this?

@andrii-korotkov-verkada
Copy link
Contributor

I think these should be managed by changing the manifests. If something was deleted, enabling application austosync with prune would clean this up.

@andrii-korotkov-verkada andrii-korotkov-verkada added the more-information-needed Further information is requested label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core Syncing, diffing, cluster state cache enhancement New feature or request more-information-needed Further information is requested type:usability Enhancement of an existing feature
Projects
None yet
Development

No branches or pull requests

9 participants