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

feat: use OS conform path for storing cached results #324

Merged

Conversation

patrickpichler
Copy link
Contributor

Closes #323

📑 Description

Instead of storing cached values in the config yaml, they are now stored under these OS specific locations:

  • Linux: ~/.cache/k8sgpt
  • MacOS: ~/Library/Caches
  • Windows: %LocalAppData%\cache

Additionally a Cache package and interface has been introduced. Currently there are two implementations:

  • Noop - Doesn't do anything
  • FileBased - Stores data in files under the locations listed above

✅ Checks

  • My pull request adheres to the code style of this project
  • [] My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Copy link
Contributor

@matthisholleville matthisholleville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your great contribution again ! As mentioned on Slack, have you run any tests on the Docker image?

pkg/cache/cache.go Outdated Show resolved Hide resolved
Instead of storing cached values in the config yaml, they are now stored
under these OS specific locations:
* Linux: `~/.cache/k8sgpt`
* MacOS: `~/Library/Caches`
* Windows: `%LocalAppData%\cache`

Additionally a `Cache` package and interface has been introduced.
Currently there are two implementations:
* Noop - Doesn't do anything
* FileBased - Stores data in files under the locations listed above

fixes k8sgpt-ai#323

Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
@patrickpichler
Copy link
Contributor Author

@matthisholleville I did some quick tests in docker images and it should work as expected, since
the distroless static container sets and creates a home directory 🙂

Copy link
Contributor

@thschue thschue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@matthisholleville matthisholleville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@matthisholleville matthisholleville merged commit 5d6f3c3 into k8sgpt-ai:main Apr 25, 2023
@patrickpichler patrickpichler deleted the feature/323/store-cache branch April 25, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feature: Store cache in XDG specified cache directory
3 participants