Skip to content

Commit c3ea05f

Browse files
authored
Beef up the documentation for pkg/name (#452)
1 parent c0e9ae6 commit c3ea05f

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

pkg/name/digest.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Package name defines structured types for representing image references.
1615
package name
1716

1817
import (

pkg/name/doc.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2018 Google LLC All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package name defines structured types for representing image references.
16+
//
17+
// What's in a name? For image references, not nearly enough!
18+
//
19+
// Image references look a lot like URLs, but they differ in that they don't
20+
// contain the scheme (http or https), they can end with a :tag or a @digest
21+
// (the latter being validated), and they perform defaulting for missing
22+
// components.
23+
//
24+
// Since image references don't contain the scheme, we do our best to infer
25+
// if we use http or https from the given hostname. We allow http fallback for
26+
// any host that looks like localhost (localhost, 127.0.0.1, ::1), ends in
27+
// ".local", or is in the "private" address space per RFC 1918. For everything
28+
// else, we assume https only. To override this heuristic, use the Insecure
29+
// option.
30+
//
31+
// Image references with a digest signal to us that we should verify the content
32+
// of the image matches the digest. E.g. when pulling a Digest reference, we'll
33+
// calculate the sha256 of the manifest returned by the registry and error out
34+
// if it doesn't match what we asked for.
35+
//
36+
// For defaulting, we interpret "ubuntu" as
37+
// "index.docker.io/library/ubuntu:latest" because we add the missing repo
38+
// "library", the missing registry "index.docker.io", and the missing tag
39+
// "latest". To disable this defaulting, use the StrictValidation option. This
40+
// is useful e.g. to only allow image references that explicitly set a tag or
41+
// digest, so that you don't accidentally pull "latest".
42+
package name

0 commit comments

Comments
 (0)