registry

package
v3.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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

func GetSrcRegistry(rcs []Context) (*Context, error)

GetSrcRegistry gets the source registry.

type Digest

type Digest struct {
	Hash string
	Tags []string
}

type DigestTags

type DigestTags map[image.Digest]TagSlice

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

type ImageWithDigestSlice struct {
	Name    string
	Digests []Digest
}

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 Images

type Images []Image

Images is a slice of Image types.

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

type TagSet map[image.Tag]interface{}

TagSet is a set of Tags.

func (TagSet) Intersection

func (a TagSet) Intersection(b TagSet) TagSet

Intersection is a set operation.

func (TagSet) Minus

func (a TagSet) Minus(b TagSet) TagSet

Minus is a set operation.

func (TagSet) ToSet

func (a TagSet) ToSet() container.Set

ToSet converts a TagSet to a Set.

func (TagSet) Union

func (a TagSet) Union(b TagSet) TagSet

Union is a set operation.

type TagSlice

type TagSlice []image.Tag

TagSlice is a slice of Tags.

func (TagSlice) Intersection

func (a TagSlice) Intersection(b TagSlice) TagSet

Intersection is a set operation.

func (TagSlice) Minus

func (a TagSlice) Minus(b TagSlice) TagSet

Minus is a set operation.

func (TagSlice) ToTagSet

func (a TagSlice) ToTagSet() TagSet

ToTagSet converts a TagSlice to a TagSet.

func (TagSlice) Union

func (a TagSlice) Union(b TagSlice) TagSet

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL