Documentation ¶
Index ¶
- func IsParentImageValid(registry image.Registry, img ImageWithParentDigestSlice) bool
- func ValidateParentImages(registry image.Registry, images []ImageWithParentDigestSlice)
- type Context
- type Digest
- type DigestTags
- type Image
- type ImageWithDigestSlice
- type ImageWithParentDigestSlice
- type Images
- type RegInvImage
- func (a RegInvImage) Minus(b RegInvImage) RegInvImage
- func (rii *RegInvImage) ToCSV() string
- func (a RegInvImage) ToSet() container.Set
- func (rii *RegInvImage) ToSorted() []ImageWithDigestSlice
- func (rii *RegInvImage) ToYAML(o YamlMarshalingOpts) string
- func (a RegInvImage) Union(b RegInvImage) RegInvImage
- type TagSet
- type TagSlice
- type YamlMarshalingOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsParentImageValid ¶
func IsParentImageValid(registry image.Registry, img ImageWithParentDigestSlice) bool
IsParentImageValid only returns true if all child images, from the parent's manifest list, are from the same image location. Example:
VALID parent=gcr.io/foo/bar child=gcr.io/foo/bar INVALID parent=gcr.io/foo/bar child=gcr.io/foo/bar/foo
TODO: Review/optimize/de-dupe (https://github.com/kubernetes-sigs/promo-tools/pull/351)
func ValidateParentImages ¶
func ValidateParentImages(registry image.Registry, images []ImageWithParentDigestSlice)
TODO: Review/optimize/de-dupe (https://github.com/kubernetes-sigs/promo-tools/pull/351)
Types ¶
type Context ¶
type Context struct { Name image.Registry `yaml:"name,omitempty"` ServiceAccount string `yaml:"service-account,omitempty"` Token gcloud.Token `yaml:"-"` Src bool `yaml:"src,omitempty"` }
Context holds information about a registry, to be written in a manifest file.
func GetSrcRegistry ¶
GetSrcRegistry gets the source registry.
type DigestTags ¶
DigestTags is a map where each digest is associated with a TagSlice. It is associated with a TagSlice because an image digest can have more than 1 tag pointing to it, even within the same image name's namespace (tags are namespaced by the image name).
type Image ¶
type Image struct { Name image.Name `yaml:"name"` Dmap DigestTags `yaml:"dmap,omitempty"` }
Image holds information about an image. It's like an "Object" in the OOP sense, and holds all the information relating to a particular image that we care about.
type ImageWithDigestSlice ¶
ImageWithDigestSlice uses a slice of digests instead of a map, allowing its contents to be sorted.
type ImageWithParentDigestSlice ¶
type ImageWithParentDigestSlice struct { Name string // contains filtered or unexported fields }
TODO: Review/optimize/de-dupe (https://github.com/kubernetes-sigs/promo-tools/pull/351)
func FilterParentImages ¶
func FilterParentImages(registry image.Registry, images *[]ImageWithDigestSlice) ([]ImageWithParentDigestSlice, error)
FilterParentImages filters the given ImageWithDigestSlice and only returns the images of who contain manifest lists (aka: fat-manifests). This is determined by inspecting the "mediaType" of every image manifest in the registry.
TODO: Review/optimize/de-dupe (https://github.com/kubernetes-sigs/promo-tools/pull/351)
type RegInvImage ¶
type RegInvImage map[image.Name]DigestTags
A RegInvImage is a map containing all of the image names, and their associated digest-to-tags mappings. It is the simplest view of a Docker Registry, because the keys are just the image.Names (where each image.Name does *not* include the registry name, because we already key this by the RegistryName in MasterInventory).
The image.Name is actually a path name, because it can be "foo/bar/baz", where the image name is the string after the last slash (in this case, "baz").
func (RegInvImage) Minus ¶
func (a RegInvImage) Minus(b RegInvImage) RegInvImage
Minus is a set operation. TODO: ST1016: methods on the same type should have the same receiver name
func (*RegInvImage) ToCSV ¶
func (rii *RegInvImage) ToCSV() string
ToCSV is like ToYAML, but instead of printing things in an indented format, it prints one image on each line as a CSV. If there is a tag pointing to the image, then it is printed next to the image on the same line.
Example: a@sha256:0000000000000000000000000000000000000000000000000000000000000000,a:1.0 a@sha256:0000000000000000000000000000000000000000000000000000000000000000,a:latest b@sha256:1111111111111111111111111111111111111111111111111111111111111111,-
func (RegInvImage) ToSet ¶
func (a RegInvImage) ToSet() container.Set
ToSet converts a RegInvImage to a Set.
func (*RegInvImage) ToSorted ¶
func (rii *RegInvImage) ToSorted() []ImageWithDigestSlice
ToSorted converts a RegInvImage type to a sorted structure.
func (*RegInvImage) ToYAML ¶
func (rii *RegInvImage) ToYAML(o YamlMarshalingOpts) string
ToYAML displays a RegInvImage as YAML, but with the map items sorted alphabetically.
func (RegInvImage) Union ¶
func (a RegInvImage) Union(b RegInvImage) RegInvImage
Union is a set operation.
type TagSet ¶
TagSet is a set of Tags.
func (TagSet) Intersection ¶
Intersection is a set operation.
type TagSlice ¶
TagSlice is a slice of Tags.
func (TagSlice) Intersection ¶
Intersection is a set operation.
type YamlMarshalingOpts ¶
type YamlMarshalingOpts struct { // Render multiple tags on separate lines. I.e., // prefer // // sha256:abc...: // - one // - two // // over // // sha256:abc...: ["one", "two"] // // If there is only 1 tag, it will be on one line in brackets (e.g., // '["one"]'). SplitTagsOverMultipleLines bool // Do not quote the digest. I.e., prefer // // sha256:...: // // over // // "sha256:...": // BareDigest bool }
YamlMarshalingOpts holds options for tweaking the YAML output.