imagelock

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package imagelock implements utility routines for manipulating Images.lock files

Index

Constants

View Source
const APIVersionV0 = "v0"

APIVersionV0 is the initial version of the API

View Source
const DefaultAnnotationsKey = "images"

DefaultAnnotationsKey is the default annotations key used to include the images metadata

View Source
const DefaultImagesLockFileName = "Images.lock"

DefaultImagesLockFileName is the default lock file name

Variables

This section is empty.

Functions

func GetImageRemoteDescriptor

func GetImageRemoteDescriptor(image string, opts ...crane.Option) (*remote.Descriptor, error)

GetImageRemoteDescriptor returns the image descriptor

func Insecure

func Insecure(ic *Config)

Insecure asks the tool to allow insecure HTTPS connections to the remote server.

func WithAnnotationsKey

func WithAnnotationsKey(str string) func(ic *Config)

WithAnnotationsKey provides a custom annotation key to use when reading/writing the list of images

func WithAuth added in v0.4.0

func WithAuth(username, password string) func(ic *Config)

WithAuth provides authentication information to access the container registry

func WithContext

func WithContext(ctx context.Context) func(ic *Config)

WithContext provides an execution context

func WithInsecure

func WithInsecure(insecure bool) func(ic *Config)

WithInsecure configures the InsecureMode of the Config

func WithPlatforms

func WithPlatforms(platforms []string) func(ic *Config)

WithPlatforms configures the Platforms of the Config

Types

type Auth added in v0.4.0

type Auth struct {
	Username string
	Password string
}

Auth defines the authentication information to access the container registry

type ChartImage

type ChartImage struct {
	Name    string       // The name of the image.
	Image   string       // The image reference.
	Chart   string       // The chart containing the image.
	Digests []DigestInfo // List of image digests associated with the image.
}

ChartImage represents an chart image with its associated information.

func (*ChartImage) Diff

func (i *ChartImage) Diff(other *ChartImage) error

Diff returns an error if the Image is not equivalent to the provided one

func (*ChartImage) FetchDigests

func (i *ChartImage) FetchDigests(cfg *Config) error

FetchDigests fetches the image digests for the image from upstream. It updates the Image's Digests field with the fetched digests. If an error occurs during the fetch, it returns the error.

func (*ChartImage) GetDigestForArch

func (i *ChartImage) GetDigestForArch(arch string) (*DigestInfo, error)

GetDigestForArch returns the image digest for the specified architecture. It searches through the image's digests and returns the first digest that matches the given architecture. If no matching digest is found, it returns an error.

type Config

type Config struct {
	InsecureMode   bool
	AnnotationsKey string
	Context        context.Context
	Auth           Auth
	Platforms      []string
}

Config defines configuration options for ImageLock functions

func NewImagesLockConfig

func NewImagesLockConfig(opts ...Option) *Config

NewImagesLockConfig returns a new ImageLockConfig with default values

type DigestInfo

type DigestInfo struct {
	Digest digest.Digest
	Arch   string
}

DigestInfo defines the digest information for an Architecture

type ImageList

type ImageList []*ChartImage

ImageList defines a list of images

func GetImagesFromChartAnnotations

func GetImagesFromChartAnnotations(c *chart.Chart, cfg *Config) (ImageList, error)

GetImagesFromChartAnnotations reads the images annotation from the chart (if present) and returns a list of ChartImage

func (ImageList) Dedup

func (imgs ImageList) Dedup() ImageList

Dedup returns a cleaned ImageSet removing duplicates

func (ImageList) ToAnnotation

func (imgs ImageList) ToAnnotation() ([]byte, error)

ToAnnotation returns the annotation text describing the list of named images, ready to be inserted in the Chart.yaml file

type ImagesLock

type ImagesLock struct {
	APIVersion string            `yaml:"apiVersion"` // The version of the API used for the lock file.
	Kind       string            // The type of object represented by the lock file.
	Metadata   map[string]string // Additional metadata associated with the lock file.

	Chart struct {
		Name       string // The name of the chart.
		Version    string // The version of the chart.
		AppVersion string `yaml:"appVersion"` // The version of the app contained in the chart
	} // Information about the chart associated with the lock file.

	Images ImageList // List of included images
}

ImagesLock represents the lock file containing information about the included images.

func FromYAML

func FromYAML(r io.Reader) (*ImagesLock, error)

FromYAML reads a ImagesLock from the YAML read from r

func FromYAMLFile

func FromYAMLFile(file string) (*ImagesLock, error)

FromYAMLFile reads a ImagesLock from the YAML file

func GenerateFromChart

func GenerateFromChart(chartPath string, opts ...Option) (*ImagesLock, error)

GenerateFromChart creates a ImagesLock from the Chart at chartPath

func NewImagesLock

func NewImagesLock() *ImagesLock

NewImagesLock creates a new empty ImagesLock

func (*ImagesLock) FindImageByName

func (il *ImagesLock) FindImageByName(chartName string, imageName string) (*ChartImage, error)

FindImageByName finds a included Image based on its name and containing chart

func (*ImagesLock) ToYAML

func (il *ImagesLock) ToYAML(w io.Writer) error

ToYAML writes the serialized YAML representation of the ImagesLock to w

func (*ImagesLock) Validate

func (il *ImagesLock) Validate(expectedImages ImageList) error

Validate checks if the provided list of images matches the contained set

type Option

type Option func(*Config)

Option defines a ImageLockConfig option

Jump to

Keyboard shortcuts

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