-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MGMT-14453](https://issues.redhat.com//browse/MGMT-14453): Fix bugs …
…in the installer cache This PR is for the purpose of resolving multiple bugs within the installer cache, due to the poor condition of the current cache, it makes sense to fix this in a single PR. * https://issues.redhat.com/browse/MGMT-14452 Installer cache removes in-used cached image when out of space * https://issues.redhat.com/browse/MGMT-14453 INSTALLER_CACHE_CAPACITY small value cause to assisted-service crash * https://issues.redhat.com/browse/MGMT-14457 Installer cache - fails to install when running parallel with same version * Additionally, the cache did not respect limits, so this has been addressed here. Fixes: I have implemented fixes for each of the following issues. * Mutex was ineffective as not instantiated corrctly, leading to [MGMT-14452](https://issues.redhat.com//browse/MGMT-14452), [MGMT-14453](https://issues.redhat.com//browse/MGMT-14453). * Naming convention for hardlinks changed to be UUID based to resolve [MGMT-14457](https://issues.redhat.com//browse/MGMT-14457). * Any time we either extract or use a release, the modified time must be updated, not only for cached releases. This was causing premature pruning of hardlinks. * LRU cache order updated to be based on microseconds instead of seconds. * Eviction checks updated to consider max release size and also cache threshold. * We now check there is enough space before writing. * During eviction - releases without hard links will be evicted before releases with hard links.
- Loading branch information
1 parent
ef9f0c8
commit 6938c2f
Showing
12 changed files
with
677 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Installer Cache for Openshift Releases | ||
During the phase where a cluster is prepared for installation, the manifests for the cluster need to be generated. | ||
In order to generate manifests, the installation binary for the desired version of Openshift is required. | ||
It is the job of the Installer Cache to provide this binary. | ||
|
||
The installer cache can be operated in a mode where it will function as a 'Least Recently Used' (LRU cache) or as a simple directory of releases. | ||
|
||
## Settings | ||
The installer cache has a number of settings, which can be overridden by providing them in as environment variables in the assisted service config map. | ||
|
||
### INSTALLER_CACHE_CAPACITY | ||
|
||
This defaults to `0`, which means that there is no limit to the size of the installer cache. | ||
This should be kept at zero if the storage directory is not ephemeral. | ||
|
||
Otherwise, it will accept a capacity, followed by either "GiB", "MiB", "KiB" or "B" | ||
|
||
For example "32 GiB" | ||
|
||
### INSTALLER_CACHE_MAX_RELEASE_SIZE | ||
|
||
This is the estimated maximum size that we believe any Openshift release could ever be. The default at the time of writing is 2 GiB. | ||
This setting is used by the installercache to decide if there is enough space to write a release to the cache or if some things will need to be evicted first. | ||
|
||
This will accept a capacity, followed by either "GiB", "MiB", "KiB" or "B" | ||
For example "1 GiB" | ||
|
||
### INSTALLER_CACHE_RELEASE_FETCH_RETRY_INTERVAL | ||
|
||
If the cache finds itself unable to write a release (as indicated by `INSTALLER_CACHE_MAX_RELEASE_SIZE`) to the cache without breaking the cache limit | ||
then it is possible that a request to fetch a release may need to be retried. | ||
`INSTALLER_CACHE_RELEASE_FETCH_RETRY_INTERVAL` is the interval at which this retry should be attempted. | ||
This is expressed as a duration, for example "30s" | ||
|
||
## Where the files are stored | ||
|
||
The files will be stored on the volume that is mapped to the working directory of the pod, defined as `WORK_DIR` in environment variables. | ||
There is one instance of the installer cache per node. This means that in SAAS for example, there are three independent caches, one for each node. | ||
This is entirely expected and normal. | ||
|
||
## Usage | ||
|
||
Usage of the cache is quite straightforward... | ||
|
||
The caller of the installer cache makes a call to | ||
|
||
``` | ||
func (i *Installers) Get(ctx context.Context, releaseID, releaseIDMirror, pullSecret string, ocRelease oc.Release, ocpVersion string, clusterID strfmt.UUID) (*Release, error) | ||
``` | ||
|
||
This call returns an `*installercache.Release` instance that the caller must retain until they are finished using the release. Once the caller is done, they call `release.Cleanup(...)` which advises the cache that the user is done with the release. | ||
|
||
The cache guarantees to never breach `INSTALLER_CACHE_CAPACITY`. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.