Skip to content

Commit 0f1a7a1

Browse files
committed
Fix config.json interpretation
As outlined in kubernetes/kubernetes#119941, the implementation is more specific than a regular glob match. Updating the docs to reflect that. Signed-off-by: Sascha Grunert <[email protected]>
1 parent 375683b commit 0f1a7a1

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

content/en/docs/concepts/containers/images.md

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -265,38 +265,26 @@ See [Configure a kubelet image credential provider](/docs/tasks/administer-clust
265265
The interpretation of `config.json` varies between the original Docker
266266
implementation and the Kubernetes interpretation. In Docker, the `auths` keys
267267
can only specify root URLs, whereas Kubernetes allows glob URLs as well as
268-
prefix-matched paths. This means that a `config.json` like this is valid:
268+
prefix-matched paths. The only limitation is that glob patterns (`*`) have to
269+
include the dot (`.`) for each subdomain. The amount of matched subdomains has
270+
to be equal to the amount of glob patterns (`*.`), for example:
271+
272+
- `*.kubernetes.io` will *not* match `kubernetes.io`, but `abc.kubernetes.io`
273+
- `*.*.kubernetes.io` will *not* match `abc.kubernetes.io`, but `abc.def.kubernetes.io`
274+
- `prefix.*.io` will match `prefix.kubernetes.io`
275+
- `*-good.kubernetes.io` will match `prefix-good.kubernetes.io`
276+
277+
This means that a `config.json` like this is valid:
269278

270279
```json
271280
{
272281
"auths": {
273-
"*my-registry.io/images": {
274-
"auth": ""
275-
}
282+
"my-registry.io/images": { "auth": "" },
283+
"*.my-registry.io/images": { "auth": "" }
276284
}
277285
}
278286
```
279287

280-
The root URL (`*my-registry.io`) is matched by using the following syntax:
281-
282-
```
283-
pattern:
284-
{ term }
285-
286-
term:
287-
'*' matches any sequence of non-Separator characters
288-
'?' matches any single non-Separator character
289-
'[' [ '^' ] { character-range } ']'
290-
character class (must be non-empty)
291-
c matches character c (c != '*', '?', '\\', '[')
292-
'\\' c matches character c
293-
294-
character-range:
295-
c matches character c (c != '\\', '-', ']')
296-
'\\' c matches character c
297-
lo '-' hi matches character c for lo <= c <= hi
298-
```
299-
300288
Image pull operations would now pass the credentials to the CRI container
301289
runtime for every valid pattern. For example the following container image names
302290
would match successfully:
@@ -305,10 +293,14 @@ would match successfully:
305293
- `my-registry.io/images/my-image`
306294
- `my-registry.io/images/another-image`
307295
- `sub.my-registry.io/images/my-image`
296+
297+
But not:
298+
308299
- `a.sub.my-registry.io/images/my-image`
300+
- `a.b.sub.my-registry.io/images/my-image`
309301

310302
The kubelet performs image pulls sequentially for every found credential. This
311-
means, that multiple entries in `config.json` are possible, too:
303+
means, that multiple entries in `config.json` for different paths are possible, too:
312304

313305
```json
314306
{

0 commit comments

Comments
 (0)