|
15 | 15 | - [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
|
16 | 16 | - [Risks and Mitigations](#risks-and-mitigations)
|
17 | 17 | - [Design Details](#design-details)
|
18 |
| - - [Test Plan](#test-plan) |
19 |
| - - [Prerequisite testing updates](#prerequisite-testing-updates) |
20 |
| - - [Unit tests](#unit-tests) |
21 | 18 | - [Integration tests](#integration-tests)
|
22 | 19 | - [e2e tests](#e2e-tests)
|
23 | 20 | - [Graduation Criteria](#graduation-criteria)
|
@@ -146,6 +143,7 @@ For beta an API will be considered to manage the ensure metadata.
|
146 | 143 | `kubelet` will ensure any image in the list is always pulled if an authentication
|
147 | 144 | used is not present, thus enforcing authentication / re-authentication.
|
148 | 145 |
|
| 146 | + |
149 | 147 | ### User Stories
|
150 | 148 |
|
151 | 149 | #### Story 1
|
@@ -176,36 +174,46 @@ Since images can be pre-loaded, loaded outside the `kubelet` process, and
|
176 | 174 | garbage collected.. the list of images that required authentication in `kubelet`
|
177 | 175 | will not be a source of truth for how all images were pulled that are in the
|
178 | 176 | container runtime cache. To mitigate, images can be garbage collected at boot.
|
179 |
| -And for alpha, we will not persist ensure metadata across reboot of host, and restart |
| 177 | +And we will persist ensure metadata across reboot of host, and restart |
180 | 178 | of kubelet, and possibly look at a way to add ensure metadata for images loaded
|
181 | 179 | outside of kubelet. In beta we will add a switch to enable re-auth on boot for
|
182 | 180 | admins seeking that instead of having to garbage collect where they do not use
|
183 | 181 | or expect preloaded images since boot.
|
184 | 182 |
|
| 183 | + |
185 | 184 | ## Design Details
|
186 | 185 |
|
187 |
| -Kubelet will track, in memory, a hash map for the credentials that were successfully |
188 |
| -used to pull an image. |
| 186 | +Kubelet will track, in memory, a hash map for the credentials that were successfully used to pull an image. |
| 187 | +It has been decided that the hash map will be persisted to disk, in alpha. |
189 | 188 |
|
190 |
| -See PR linked above for detailed design / behavior documentation. |
| 189 | +The persisted "cache" will undergo cleanup operations on a timely basis (by default once an hour). |
191 | 190 |
|
192 |
| -Kubelet will add a new flag, named `PullImageSecretRecheckDuration` to make |
193 |
| -the expired duration configurable. The default value could be 1d. For a pod with |
194 |
| -IfNotPresent image pull policy and an image pull secret, kubelet will recheck |
195 |
| -the secret after `PullImageSecretRecheckDuration`. |
| 191 | +The persistence of the on storage cache is mainly for restarting kubelet and/or node reboot. |
196 | 192 |
|
197 |
| -Use image pull policy `Always` if user want to recheck the secret everytime. |
| 193 | +The max size of the cache will scale with the number of unique cache entries * the number of unique images that have not been garbage collected. |
| 194 | +It is not expected that this will be a significant number of bytes. Will be verified by actual use in Alpha and subsequent metrics in Beta. |
198 | 195 |
|
199 |
| -For image pull policy "if not present", when admin/user doesn't want to automatically |
200 |
| -recheck the secret, set `PullImageSecretRecheckDuration` to 0 to disable it(which means |
201 |
| -never recheck). |
| 196 | +See `/var/lib/kubelet/image_manager_state` in [kubernetes/kubernetes#114847](https://github.com/kubernetes/kubernetes/pull/114847) |
202 | 197 |
|
203 |
| -Note: using the tag `:latest` is equivalent to using the image pull policy `Always.` |
| 198 | +> ``` |
| 199 | +> { |
| 200 | +> "images": { |
| 201 | +> "sha256:eb6cbbefef909d52f4b2b29f8972bbb6d86fc9dba6528e65aad4f119ce469f7a": { |
| 202 | +> "authHash": { ** per review comment use SHA256 here vs hash ** |
| 203 | +> "115b8808c3e7f073": { |
| 204 | +> "ensured": true, |
| 205 | +> "dueDate": "2023-05-30T05:26:53.76740982+08:00" |
| 206 | +> } |
| 207 | +> }, |
| 208 | +> "name": "daocloud.io/daocloud/dce-registry-tool:3.0.8" |
| 209 | +> } |
| 210 | +> } |
| 211 | +> } |
| 212 | +> ``` |
204 | 213 |
|
205 |
| -Note: since the cache is not persisted to disk, a recheck will happen every kubelet restart. |
206 |
| -This is acceptable because kubelet only restarts during upgrades or in maintenance modes. |
207 |
| -In other words, it should be relatively infrequent(and much less frequent than the default |
208 |
| -value of `PullImageSecretRecheckDuration`). |
| 214 | +See PR linked above for detailed design / behavior documentation. |
| 215 | +
|
| 216 | +Note: using the tag `:latest` is equivalent to using the image pull policy `Always.` |
209 | 217 |
|
210 | 218 | ### Test Plan
|
211 | 219 |
|
@@ -248,6 +256,8 @@ For alpha, exhaustive Kubelet unit tests will be provided. Functions affected by
|
248 | 256 |
|
249 | 257 | [TestShouldPullImage link](https://github.com/kubernetes/kubernetes/pull/94899/files#diff-7297f08c72da9bf6479e80c03b45e24ea92ccb11c0031549e51b51f88a91f813R311-R438)
|
250 | 258 |
|
| 259 | +PersistHashMeta() ** will be persisting SHA256 entries vs hash ** |
| 260 | + |
251 | 261 | Additionally, for Alpha we will update this readme with an enumeration of the core packages being touched by the PR to implement this enhancement and provide the current unit coverage for those in the form of:
|
252 | 262 |
|
253 | 263 | - <package>: <date> - <current test coverage>
|
|
0 commit comments