Skip to content

Conversation

@ahatzz11
Copy link

@ahatzz11 ahatzz11 commented Nov 26, 2024

Add configurable cache TTL and jitter settings.

Problem

Currently, the image existence cache has a hardcoded TTL of 24 hours with a 3-hour jitter. This can be problematic for users who:

  • Need to adjust cache duration based on potential artifact cleanup policies
  • Want to disable caching entirely
  • Need to tune jitter settings to prevent cache stampede in their environment

Solution

Added two new configuration options:

  • cacheTtlMinutes (default: 1440 - 24 hours): Controls how long image existence information is cached
  • cacheJitterMaxMinutes (default: 180 - 3 hours): Controls the maximum random time added to prevent cache stampede

Both settings are configurable via the .k8s-image-swapper.yaml config file. Once this gets reviewed I'll make some updates to the helm-chart to support these new configuration values.

Fixes #843

@ahatzz11 ahatzz11 changed the title Add new cacheTtlMinutes and cacheJitterMaxMinutes configuration options feat: Add new cacheTtlMinutes and cacheJitterMaxMinutes configuration options Nov 26, 2024
@github-actions github-actions bot added the enhancement New feature or request label Dec 11, 2024
@ahatzz11
Copy link
Author

ahatzz11 commented Aug 1, 2025

@estahn Can we get some eyes on this? We hit this issue again today and it's always a huge rabbit hole to debug. I love the future state you have outlined, but organizations need something in the mean time to ensure k8s-image-swapper doesn't wreck havoc when paired with a cleanup policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not replacing pruned images

1 participant