Skip to content

Commit 64a17e7

Browse files
committed
update for 1.23 and add test plan
Signed-off-by: Mike Brown <[email protected]>
1 parent 027a4d3 commit 64a17e7

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

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

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ authentication.)
110110
### Goals
111111

112112
Modify the current pullIfNotPresent policy management enforced by `kubelet` to
113-
ensure the images pulled with a secret by `kublet` since boot. During the
113+
ensure the images pulled with a secret by `kubelet` since boot. During the
114114
EnsureImagesExist step `kubelet` will require authentication of present images
115115
pulled with auth since boot.
116116

@@ -132,8 +132,10 @@ use un-encrypted...
132132

133133
## Proposal
134134

135-
`kubelet` will keep a list, since boot, of container images that required
135+
For alpha `kubelet` will keep a list, since boot, of container images that required
136136
authentication and a list of the authentications that successfully pulled the image.
137+
For beta the list will be persisted across reboot of host, and restart of kubelet.
138+
Additionally, an API will be considered to manage the ensure metadata.
137139

138140
`kubelet` will ensure any image in the list is always pulled if an authentication
139141
used is not present, thus enforcing authentication / re-authentication.
@@ -161,12 +163,18 @@ Image authentications with a registry may expire. To mitigate expirations a
161163
a timeout could be used to force re-authentication. The timeout could be a
162164
container runtime feature or a `kubelet` feature. If at the container runtime,
163165
images would not be present during the EnsureImagesExist step, thus would have
164-
to be pulled and authenticated if necessary.
166+
to be pulled and authenticated if necessary. This timeout feature will be
167+
implemented in beta.
165168

166169
Since images can be pre-loaded, loaded outside the `kubelet` process, and
167170
garbage collected.. the list of images that required authentication in `kubelet`
168171
will not be a source of truth for how all images were pulled that are in the
169172
container runtime cache. To mitigate, images can be garbage collected at boot.
173+
And for beta, we will persist ensure metadata across reboot of host, and restart
174+
of kubelet, and possibly look at a way to add ensure metadata for images loaded
175+
outside of kubelet. In beta we will add a switch to enable re-auth on boot for
176+
admins seeking that instead of having to garbage collect where they do not use
177+
or expect preloaded images since boot.
170178

171179

172180
## Design Details
@@ -178,7 +186,35 @@ See PR for detailed design / behavior documentation.
178186

179187
### Test Plan
180188

181-
See PR (exhaustive unit tests added for alpha covering feature gate on and off for new and modified functions)
189+
For alpha, exhaustive Kubelet unit tests will be provided. Functions affected by the feature gate will be run with the feature gate on and with the feature gate off. Unit buckets will be provided for:
190+
- HashAuth - (new, small) returns a hash code for a CRI pull image auth [link](https://github.com/kubernetes/kubernetes/pull/94899/files#diff-ca08601dfd2fdf846f066d0338dc332beddd5602ab3a71b8fac95b419842da63R704-R751)
191+
- shouldPullImage - (modified, large sized change) determines if image should be pulled based on presence, and image pull policy, and now with the feature gate on if the image has been pulled/ensured by a secret. A unit test bucket did not exist for this function. The unit bucket will cover a matrix for:
192+
```
193+
pullIfNotPresent := &v1.Container{
194+
..
195+
ImagePullPolicy: v1.PullIfNotPresent,
196+
}
197+
pullNever := &v1.Container{
198+
..
199+
ImagePullPolicy: v1.PullNever,
200+
}
201+
pullAlways := &v1.Container{
202+
..
203+
ImagePullPolicy: v1.PullAlways,
204+
}
205+
tests := []struct {
206+
description string
207+
container *v1.Container
208+
imagePresent bool
209+
pulledBySecret bool
210+
ensuredBySecret bool
211+
expectedWithFGOff bool
212+
expectedWithFGOn bool
213+
}
214+
```
215+
[TestShouldPullImage link](https://github.com/kubernetes/kubernetes/pull/94899/files#diff-7297f08c72da9bf6479e80c03b45e24ea92ccb11c0031549e51b51f88a91f813R311-R438)
216+
217+
At beta we should revisit if integration buckets are warranted for e2e node and/or cri-tools/critest, and after gathering feedback.
182218

183219
### Graduation Criteria
184220

@@ -341,7 +377,7 @@ Why should this KEP _not_ be implemented. N/A
341377
## Alternatives [optional]
342378

343379
- Make the behavior change enabled by default by changing the feature gate to true by default instead of false by default.
344-
- Discussions went back and forth on whether this should go directly to GA as a fix or alpha as a feature gate. It seems this should be the default security posture for pullIfNotPresent as it is not clear to admins/users that an image pulled by a first pod with authentication can be used by a second pod without authentication. The performance cost should be minimal as only the manifest needs to be re-authenticated. But after further review and discussion with MrunalP we'll go ahead and have a kubelet feature gate with default off for alpha in v1.22.
380+
- Discussions went back and forth on whether this should go directly to GA as a fix or alpha as a feature gate. It seems this should be the default security posture for pullIfNotPresent as it is not clear to admins/users that an image pulled by a first pod with authentication can be used by a second pod without authentication. The performance cost should be minimal as only the manifest needs to be re-authenticated. But after further review and discussion with MrunalP we'll go ahead and have a kubelet feature gate with default off for alpha in v1.23.
345381
- Set the flag at some other scope e.g. pod spec (doing it at the pod spec was rejected by SIG-Node).
346382
- For beta/ga we may revisit/replace the in memory hash map in kubelet design, with an extension to the CRI API for having the container runtime
347383
ensure the image instead of kubelet.

keps/sig-node/2535-ensure-secret-pulled-images/kep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ approvers:
1818
prr-approvers:
1919
- "@johnbelarmic"
2020
stage: alpha
21-
latest-milestone: "v1.22"
21+
latest-milestone: "v1.23"
2222
milestone:
23-
alpha: "v1.22"
24-
beta: "v1.23"
25-
stable: "v1.25"
23+
alpha: "v1.23"
24+
beta: "v1.24"
25+
stable: "v1.26"
2626
feature-gates:
2727
- name: KubeletEnsureSecretPulledImages
2828
components:

0 commit comments

Comments
 (0)