Skip to content

XDG cache dir can be deleted at any time #7206

Closed

Description

@okulev

Helm 3 uses the XDG base dir specification and this is very nice. The specification states that $XDG_CACHE_HOME dir contains "user specific non-essential data files". To my surprise what is not stated is that cache dir can be cleaned up by user at any time. All caches (should) work like this.

In Helm 3.0.1, the cache dir is used for plugins and repositories and these per XDG can disappear at any time. I think plugins and repositories should be kept in $XDG_DATA_HOME.

Activity

  1. okulev commented on Dec 12, 2019

    @okulev
    Author

    Here is a plan for migration:

    1. New plugins and repositories are downloaded to $XDG_DATA_HOME/helm/unpacked-plugins and $XDG_DATA_HOME/helm/repositories.
    2. $XDG_CACHE_HOME is no longer used for plugins management. The symbolic links to $XDG_CACHE_HOME/helm/plugins continue to work.
    3. $XDG_CACHE_HOME/helm/repository is virtually merged with $XDG_DATA_HOME/helm/repositories when list of repositories is needed. There is deprecation warning each time virtual merge happens. Helm 3.1.0 removes any use of $XDG_CACHE_HOME, including virtual merging.
  2. marckhouzam commented on Dec 12, 2019

    @marckhouzam
    Member

    Thanks for bringing this up. I think you are right that we need to make sure Helm handles cache deletion properly.

    In Helm 3.0.1, the cache dir is used for plugins and repositories and these per XDG can disappear at any time. I think plugins and repositories should be kept in $XDG_DATA_HOME.

    To my knowledge, the information for repositories that is stored in the cache can be recreated. I haven't tried but I believe that if I delete the cache and then try to work with repositories, helm will indicate the repository *-index.yaml file is missing and it will direct the user to do a helm repo update. This sounds ok to me. When a user willingly deletes their cache they should expect some minor impacts.

    I'm not sure what info about plugins is stored in the cache. How will the user be impacted with respect to plugins if the cache is removed? Can all data be recreated reasonably easily?

    @okulev would you be able to try it out and report how helm behaves after a cache delete?

  3. added
    v3.x
    on Dec 12, 2019
  4. okulev commented on Dec 16, 2019

    @okulev
    Author

    I was wrong about ~/.cache/helm/repository. After deleting this directory, helm repo list still shows repositories. helm search repo doesn't work though and explicitly suggests that helm repo update should be run. Repositories cache should updated automatically when it is missing. Deleting a cache should not affect user experience except the additional time for automatic restoring of cache.

    After deleting ~/.cache/helm/plugins, plugins disappear from helm plugin list. Either plugins should be moved to $XDG_DATA_HOME (I recommend this), or like repos a list should be kept in ~/.config so that plugins re re-downloaded when needed. IMHO The latter is acceptable only if plugins are automatically downloaded when they are missing from ~/.cache.

  5. marckhouzam commented on Dec 17, 2019

    @marckhouzam
    Member

    Repositories cache should be updated automatically when it is missing. Deleting a cache should not affect user experience except the additional time for automatic restoring of cache.

    If helm suggests that helm repo update should be run instead of running it automatically, it may be a design decision. I don't have the answer to that. Hopefully another maintainer can shed some light.

    After deleting ~/.cache/helm/plugins, plugins disappear from helm plugin list.

    I can see this too. It affects plugins downloaded from the internet but not plugins installed from a local repo. Interestingly, the list of plugins is already stored in $XDG_DATA_HOME/helm/plugins but they are symbolic links to the cache, where the plugin has been extracted.

    Either plugins should be moved to $XDG_DATA_HOME (I recommend this), or like repos a list should be kept in ~/.config so that plugins re re-downloaded when needed. IMHO The latter is acceptable only if plugins are automatically downloaded when they are missing from ~/.cache.

    I agree that loosing plugins when deleting the cache seems excessive.
    It would be good to know if there is a reason behind plugins being extracted in the cache?

    Your suggested solutions do sound reasonable. Or maybe we can make helm plugin update work in a similar fashion as helm repo update and reload the plugins? This would require the list of plugins to accept symlinks that don't point to anything.

  6. ml- commented on Apr 15, 2020

    @ml-

    I've noticed this a while ago and am surprised that there is no progress or regarding this issue.

    It is fairly common to have $XDG_CACHE_HOME mounted as tmpfs due to various performance benefits. This path is also not meant to hold any data that is relevent or should require user interaction to be recreated.

    As already mentioned in this issue, the content could disappear any second without prior notice without having significant impact on running applications.

    I would go even that far to say that repositories should not be stored in cache as long as Helm can't restore the data without user interactions. Especially long-running applications that use Helm can suffer from this.

    Will keep an eye on this issue and would really appreciate it if a maintainer could have a look at this.

    Edit:
    Also setting HELM_REPOSITORY_CACHE doesn't seem to work. Files still go to XDG_CACHE_HOME.

  7. jdolitsky commented on Apr 15, 2020

    @jdolitsky
    Contributor

    Would this be fixed with #7529 ?

  8. ml- commented on Apr 15, 2020

    @ml-

    No, I don't think so. It still requires you to bend your XDG_* env vars, which is not a good idea as it might break other applications that rely on those vars.

  9. added 3 commits that reference this issue on Apr 21, 2020
    3762515
    f787e6b
    1b505f2
  10. added a commit that references this issue on Apr 22, 2020
    1cdd0a2
  11. added a commit that references this issue on May 8, 2020
    f68c282
  12. added a commit that references this issue on May 23, 2020
    48d09a2
  13. added a commit that references this issue on Jun 8, 2020
    ede5718
  14. added a commit that references this issue on Oct 2, 2020
    84e3658
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question/supportv3.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions