Skip to content

Commit b7d0177

Browse files
committed
Revert "kep-2535: not persist on disk and add PullImageSecretRecheckDuration flag to define different behaviors"
This reverts commit b14b2ee. As the suggestion to drop the persist caused it to be blocked at code merge in 1.30. Reintroduce the cache concept Signed-off-by: Peter Hunt <[email protected]>
1 parent b38aeda commit b7d0177

File tree

1 file changed

+30
-20
lines changed
  • keps/sig-node/2535-ensure-secret-pulled-images

1 file changed

+30
-20
lines changed

keps/sig-node/2535-ensure-secret-pulled-images/README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
1616
- [Risks and Mitigations](#risks-and-mitigations)
1717
- [Design Details](#design-details)
18-
- [Test Plan](#test-plan)
19-
- [Prerequisite testing updates](#prerequisite-testing-updates)
20-
- [Unit tests](#unit-tests)
2118
- [Integration tests](#integration-tests)
2219
- [e2e tests](#e2e-tests)
2320
- [Graduation Criteria](#graduation-criteria)
@@ -146,6 +143,7 @@ For beta an API will be considered to manage the ensure metadata.
146143
`kubelet` will ensure any image in the list is always pulled if an authentication
147144
used is not present, thus enforcing authentication / re-authentication.
148145

146+
149147
### User Stories
150148

151149
#### Story 1
@@ -176,36 +174,46 @@ Since images can be pre-loaded, loaded outside the `kubelet` process, and
176174
garbage collected.. the list of images that required authentication in `kubelet`
177175
will not be a source of truth for how all images were pulled that are in the
178176
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
180178
of kubelet, and possibly look at a way to add ensure metadata for images loaded
181179
outside of kubelet. In beta we will add a switch to enable re-auth on boot for
182180
admins seeking that instead of having to garbage collect where they do not use
183181
or expect preloaded images since boot.
184182

183+
185184
## Design Details
186185

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.
189188

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).
191190

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.
196192

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.
198195

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)
202197

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+
> ```
204213
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.`
209217
210218
### Test Plan
211219
@@ -248,6 +256,8 @@ For alpha, exhaustive Kubelet unit tests will be provided. Functions affected by
248256
249257
[TestShouldPullImage link](https://github.com/kubernetes/kubernetes/pull/94899/files#diff-7297f08c72da9bf6479e80c03b45e24ea92ccb11c0031549e51b51f88a91f813R311-R438)
250258

259+
PersistHashMeta() ** will be persisting SHA256 entries vs hash **
260+
251261
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:
252262

253263
- <package>: <date> - <current test coverage>

0 commit comments

Comments
 (0)